@pallasoft/ps-core-components 2.46.0 → 2.47.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 (103) hide show
  1. package/dist/components/ps-data-boundary.d.ts +2 -1
  2. package/dist/components/ps-data-boundary.js +2 -2
  3. package/dist/components/ps-empty-value.d.ts +5 -0
  4. package/dist/components/ps-empty-value.js +8 -0
  5. package/dist/components/ps-image.d.ts +14 -0
  6. package/dist/components/ps-image.js +29 -0
  7. package/dist/components/ps-signed-value.d.ts +6 -0
  8. package/dist/components/ps-signed-value.js +9 -0
  9. package/dist/constants/ps-empty-value-config.d.ts +4 -0
  10. package/dist/constants/ps-empty-value-config.js +7 -0
  11. package/dist/constants/ps-image-config.d.ts +7 -0
  12. package/dist/constants/ps-image-config.js +10 -0
  13. package/dist/constants/ps-image-fit.d.ts +7 -0
  14. package/dist/constants/ps-image-fit.js +11 -0
  15. package/dist/constants/ps-image-status.d.ts +5 -0
  16. package/dist/constants/ps-image-status.js +9 -0
  17. package/dist/constants/ps-signed-value-classes.d.ts +2 -0
  18. package/dist/constants/ps-signed-value-classes.js +9 -0
  19. package/dist/esm/components/ps-data-boundary.js +2 -2
  20. package/dist/esm/components/ps-empty-value.js +4 -0
  21. package/dist/esm/components/ps-image.js +25 -0
  22. package/dist/esm/components/ps-signed-value.js +5 -0
  23. package/dist/esm/constants/ps-empty-value-config.js +4 -0
  24. package/dist/esm/constants/ps-image-config.js +7 -0
  25. package/dist/esm/constants/ps-image-fit.js +8 -0
  26. package/dist/esm/constants/ps-image-status.js +6 -0
  27. package/dist/esm/constants/ps-signed-value-classes.js +6 -0
  28. package/dist/esm/hooks/use-ps-cursor-pages.js +82 -0
  29. package/dist/esm/hooks/use-ps-draft-state.js +18 -0
  30. package/dist/esm/hooks/use-ps-optimistic-rows.js +2 -1
  31. package/dist/esm/hooks/use-ps-remote-read.js +31 -0
  32. package/dist/esm/hooks/use-ps-text-param.js +16 -0
  33. package/dist/esm/index.js +30 -0
  34. package/dist/esm/interfaces/ps-cursor-pages-input.js +1 -0
  35. package/dist/esm/interfaces/ps-cursor-pages-result.js +1 -0
  36. package/dist/esm/interfaces/ps-draft-state-options.js +1 -0
  37. package/dist/esm/interfaces/ps-draft-state-result.js +1 -0
  38. package/dist/esm/interfaces/ps-remote-read-input.js +1 -0
  39. package/dist/esm/interfaces/ps-remote-read-result.js +1 -0
  40. package/dist/esm/models/ps-cursor-pages-state.js +1 -0
  41. package/dist/esm/models/ps-draft-state-data.js +1 -0
  42. package/dist/esm/models/ps-image-state-data.js +1 -0
  43. package/dist/esm/models/ps-remote-read-state.js +1 -0
  44. package/dist/esm/models/ps-remote-settled-data.js +1 -0
  45. package/dist/esm/models/ps-text-param-data.js +1 -0
  46. package/dist/esm/models/ps-text-param-options.js +1 -0
  47. package/dist/esm/services/ps-cursor-pages-service.js +14 -0
  48. package/dist/esm/services/ps-draft-state-service.js +11 -0
  49. package/dist/esm/services/ps-image-service.js +11 -0
  50. package/dist/esm/services/ps-optimistic-release-service.js +11 -5
  51. package/dist/esm/services/ps-remote-read-service.js +19 -0
  52. package/dist/esm/services/ps-signed-value-service.js +13 -0
  53. package/dist/hooks/use-ps-cursor-pages.d.ts +3 -0
  54. package/dist/hooks/use-ps-cursor-pages.js +86 -0
  55. package/dist/hooks/use-ps-draft-state.d.ts +3 -0
  56. package/dist/hooks/use-ps-draft-state.js +22 -0
  57. package/dist/hooks/use-ps-optimistic-rows.js +2 -1
  58. package/dist/hooks/use-ps-remote-read.d.ts +3 -0
  59. package/dist/hooks/use-ps-remote-read.js +35 -0
  60. package/dist/hooks/use-ps-text-param.d.ts +4 -0
  61. package/dist/hooks/use-ps-text-param.js +20 -0
  62. package/dist/index.d.ts +30 -0
  63. package/dist/index.js +30 -0
  64. package/dist/interfaces/ps-cursor-pages-input.d.ts +8 -0
  65. package/dist/interfaces/ps-cursor-pages-input.js +2 -0
  66. package/dist/interfaces/ps-cursor-pages-result.d.ts +7 -0
  67. package/dist/interfaces/ps-cursor-pages-result.js +2 -0
  68. package/dist/interfaces/ps-draft-state-options.d.ts +3 -0
  69. package/dist/interfaces/ps-draft-state-options.js +2 -0
  70. package/dist/interfaces/ps-draft-state-result.d.ts +7 -0
  71. package/dist/interfaces/ps-draft-state-result.js +2 -0
  72. package/dist/interfaces/ps-optimistic-changes.d.ts +1 -0
  73. package/dist/interfaces/ps-remote-read-input.d.ts +5 -0
  74. package/dist/interfaces/ps-remote-read-input.js +2 -0
  75. package/dist/interfaces/ps-remote-read-result.d.ts +5 -0
  76. package/dist/interfaces/ps-remote-read-result.js +2 -0
  77. package/dist/models/ps-cursor-pages-state.d.ts +8 -0
  78. package/dist/models/ps-cursor-pages-state.js +2 -0
  79. package/dist/models/ps-draft-state-data.d.ts +4 -0
  80. package/dist/models/ps-draft-state-data.js +2 -0
  81. package/dist/models/ps-image-state-data.d.ts +5 -0
  82. package/dist/models/ps-image-state-data.js +2 -0
  83. package/dist/models/ps-remote-read-state.d.ts +6 -0
  84. package/dist/models/ps-remote-read-state.js +2 -0
  85. package/dist/models/ps-remote-settled-data.d.ts +4 -0
  86. package/dist/models/ps-remote-settled-data.js +2 -0
  87. package/dist/models/ps-text-param-data.d.ts +5 -0
  88. package/dist/models/ps-text-param-data.js +2 -0
  89. package/dist/models/ps-text-param-options.d.ts +5 -0
  90. package/dist/models/ps-text-param-options.js +2 -0
  91. package/dist/services/ps-cursor-pages-service.d.ts +6 -0
  92. package/dist/services/ps-cursor-pages-service.js +18 -0
  93. package/dist/services/ps-draft-state-service.d.ts +6 -0
  94. package/dist/services/ps-draft-state-service.js +15 -0
  95. package/dist/services/ps-image-service.d.ts +6 -0
  96. package/dist/services/ps-image-service.js +15 -0
  97. package/dist/services/ps-optimistic-release-service.d.ts +1 -1
  98. package/dist/services/ps-optimistic-release-service.js +11 -5
  99. package/dist/services/ps-remote-read-service.d.ts +8 -0
  100. package/dist/services/ps-remote-read-service.js +23 -0
  101. package/dist/services/ps-signed-value-service.d.ts +5 -0
  102. package/dist/services/ps-signed-value-service.js +17 -0
  103. package/package.json +2 -2
@@ -0,0 +1,8 @@
1
+ import type { PsRemoteReadState } from '../models/ps-remote-read-state';
2
+ import type { PsRemoteSettledData } from '../models/ps-remote-settled-data';
3
+ export declare class PsRemoteReadService {
4
+ private static readonly client;
5
+ static initialState<Data>(): PsRemoteReadState<Data>;
6
+ static isPending(settled: PsRemoteSettledData | null, url: string | null, reloadKey: unknown): boolean;
7
+ static read<Data>(url: string, parse: (value: unknown) => Data, signal: AbortSignal): Promise<Data>;
8
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsRemoteReadService = void 0;
4
+ const ps_utilities_1 = require("@pallasoft/ps-utilities");
5
+ class PsRemoteReadService {
6
+ static initialState() {
7
+ return { data: null, error: null, settled: null };
8
+ }
9
+ static isPending(settled, url, reloadKey) {
10
+ if (url === null)
11
+ return false;
12
+ return settled === null || settled.url !== url || !Object.is(settled.reloadKey, reloadKey);
13
+ }
14
+ static async read(url, parse, signal) {
15
+ const response = await PsRemoteReadService.client.get(url, {
16
+ responseType: 'json',
17
+ signal,
18
+ });
19
+ return parse(response.data);
20
+ }
21
+ }
22
+ exports.PsRemoteReadService = PsRemoteReadService;
23
+ PsRemoteReadService.client = ps_utilities_1.Client.HttpService.createApiClient();
@@ -0,0 +1,5 @@
1
+ import { AmountDirection } from '@pallasoft/ps-utilities';
2
+ export declare class PsSignedValueService {
3
+ static direction(value: string): AmountDirection;
4
+ static text(value: string, format: ((value: string) => string) | undefined): string;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsSignedValueService = void 0;
4
+ const ps_utilities_1 = require("@pallasoft/ps-utilities");
5
+ class PsSignedValueService {
6
+ static direction(value) {
7
+ const sign = ps_utilities_1.Common.DecimalStringService.sign(value);
8
+ if (sign > 0)
9
+ return ps_utilities_1.AmountDirection.In;
10
+ return sign < 0 ? ps_utilities_1.AmountDirection.Out : ps_utilities_1.AmountDirection.Neutral;
11
+ }
12
+ static text(value, format) {
13
+ const body = format === undefined ? value : format(value);
14
+ return ps_utilities_1.Common.DecimalStringService.sign(value) > 0 ? `+${body}` : body;
15
+ }
16
+ }
17
+ exports.PsSignedValueService = PsSignedValueService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-core-components",
3
- "version": "2.46.0",
3
+ "version": "2.47.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -48,7 +48,7 @@
48
48
  "@dnd-kit/utilities": "^3.2.2",
49
49
  "@pallasoft/ps-icons": "^1.5.4",
50
50
  "@pallasoft/ps-motion-components": "^1.2.2",
51
- "@pallasoft/ps-utilities": "^2.23.0",
51
+ "@pallasoft/ps-utilities": "^2.25.0",
52
52
  "@portabletext/react": "^3.2.4",
53
53
  "@portabletext/types": "^2.0.13",
54
54
  "@radix-ui/react-accordion": "^1.2.12",