@pallasoft/ps-core-components 2.46.1 → 2.47.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-data-boundary.d.ts +2 -1
- package/dist/components/ps-data-boundary.js +2 -2
- package/dist/components/ps-empty-value.d.ts +5 -0
- package/dist/components/ps-empty-value.js +8 -0
- package/dist/components/ps-image.d.ts +14 -0
- package/dist/components/ps-image.js +29 -0
- package/dist/components/ps-signed-value.d.ts +6 -0
- package/dist/components/ps-signed-value.js +9 -0
- package/dist/constants/ps-empty-value-config.d.ts +4 -0
- package/dist/constants/ps-empty-value-config.js +7 -0
- package/dist/constants/ps-image-config.d.ts +7 -0
- package/dist/constants/ps-image-config.js +10 -0
- package/dist/constants/ps-image-fit.d.ts +7 -0
- package/dist/constants/ps-image-fit.js +11 -0
- package/dist/constants/ps-image-status.d.ts +5 -0
- package/dist/constants/ps-image-status.js +9 -0
- package/dist/constants/ps-signed-value-classes.d.ts +2 -0
- package/dist/constants/ps-signed-value-classes.js +9 -0
- package/dist/esm/components/ps-data-boundary.js +2 -2
- package/dist/esm/components/ps-empty-value.js +4 -0
- package/dist/esm/components/ps-image.js +25 -0
- package/dist/esm/components/ps-signed-value.js +5 -0
- package/dist/esm/constants/ps-empty-value-config.js +4 -0
- package/dist/esm/constants/ps-image-config.js +7 -0
- package/dist/esm/constants/ps-image-fit.js +8 -0
- package/dist/esm/constants/ps-image-status.js +6 -0
- package/dist/esm/constants/ps-signed-value-classes.js +6 -0
- package/dist/esm/hooks/use-ps-cursor-pages.js +82 -0
- package/dist/esm/hooks/use-ps-draft-state.js +18 -0
- package/dist/esm/hooks/use-ps-optimistic-fetcher.js +2 -4
- package/dist/esm/hooks/use-ps-optimistic-save.js +1 -1
- package/dist/esm/hooks/use-ps-remote-read.js +31 -0
- package/dist/esm/hooks/use-ps-text-param.js +16 -0
- package/dist/esm/index.js +32 -12
- package/dist/esm/models/ps-image-state-data.js +1 -0
- package/dist/esm/models/ps-remote-read-state.js +1 -0
- package/dist/esm/models/ps-remote-settled-data.js +1 -0
- package/dist/esm/models/ps-text-param-data.js +1 -0
- package/dist/esm/models/ps-text-param-options.js +1 -0
- package/dist/esm/services/ps-cursor-pages-service.js +14 -0
- package/dist/esm/services/ps-draft-state-service.js +11 -0
- package/dist/esm/services/ps-image-service.js +11 -0
- package/dist/esm/services/ps-remote-read-service.js +19 -0
- package/dist/esm/services/ps-signed-value-service.js +13 -0
- package/dist/hooks/use-ps-cursor-pages.d.ts +3 -0
- package/dist/hooks/use-ps-cursor-pages.js +86 -0
- package/dist/hooks/use-ps-draft-state.d.ts +3 -0
- package/dist/hooks/use-ps-draft-state.js +22 -0
- package/dist/hooks/use-ps-optimistic-fetcher.js +7 -9
- package/dist/hooks/use-ps-optimistic-save.js +4 -4
- package/dist/hooks/use-ps-remote-read.d.ts +3 -0
- package/dist/hooks/use-ps-remote-read.js +35 -0
- package/dist/hooks/use-ps-text-param.d.ts +4 -0
- package/dist/hooks/use-ps-text-param.js +20 -0
- package/dist/index.d.ts +32 -12
- package/dist/index.js +39 -12
- package/dist/interfaces/ps-cursor-pages-input.d.ts +8 -0
- package/dist/interfaces/ps-cursor-pages-result.d.ts +7 -0
- package/dist/interfaces/ps-draft-state-options.d.ts +3 -0
- package/dist/interfaces/ps-draft-state-result.d.ts +7 -0
- package/dist/interfaces/ps-optimistic-failure.d.ts +1 -1
- package/dist/interfaces/ps-optimistic-save-input.d.ts +1 -1
- package/dist/interfaces/ps-remote-read-input.d.ts +5 -0
- package/dist/interfaces/ps-remote-read-result.d.ts +5 -0
- package/dist/models/ps-cursor-pages-state.d.ts +8 -0
- package/dist/models/ps-draft-state-data.d.ts +4 -0
- package/dist/models/ps-image-state-data.d.ts +5 -0
- package/dist/models/ps-image-state-data.js +2 -0
- package/dist/models/ps-remote-read-state.d.ts +6 -0
- package/dist/models/ps-remote-read-state.js +2 -0
- package/dist/models/ps-remote-settled-data.d.ts +4 -0
- package/dist/models/ps-remote-settled-data.js +2 -0
- package/dist/models/ps-text-param-data.d.ts +5 -0
- package/dist/models/ps-text-param-data.js +2 -0
- package/dist/models/ps-text-param-options.d.ts +5 -0
- package/dist/models/ps-text-param-options.js +2 -0
- package/dist/services/ps-cursor-pages-service.d.ts +6 -0
- package/dist/services/ps-cursor-pages-service.js +18 -0
- package/dist/services/ps-draft-state-service.d.ts +6 -0
- package/dist/services/ps-draft-state-service.js +15 -0
- package/dist/services/ps-image-service.d.ts +6 -0
- package/dist/services/ps-image-service.js +15 -0
- package/dist/services/ps-remote-read-service.d.ts +8 -0
- package/dist/services/ps-remote-read-service.js +23 -0
- package/dist/services/ps-signed-value-service.d.ts +5 -0
- package/dist/services/ps-signed-value-service.js +17 -0
- package/package.json +2 -2
- package/dist/constants/ps-optimistic-config.d.ts +0 -5
- package/dist/constants/ps-optimistic-config.js +0 -8
- package/dist/esm/constants/ps-optimistic-config.js +0 -5
- package/dist/esm/hooks/use-ps-change-queue.js +0 -36
- package/dist/esm/hooks/use-ps-debounced-value.js +0 -11
- package/dist/esm/hooks/use-ps-optimistic-rows.js +0 -29
- package/dist/esm/services/ps-deep-equal-service.js +0 -31
- package/dist/esm/services/ps-optimistic-fetcher-service.js +0 -12
- package/dist/esm/services/ps-optimistic-release-service.js +0 -38
- package/dist/esm/services/ps-optimistic-save-service.js +0 -64
- package/dist/hooks/use-ps-change-queue.d.ts +0 -3
- package/dist/hooks/use-ps-change-queue.js +0 -40
- package/dist/hooks/use-ps-debounced-value.d.ts +0 -1
- package/dist/hooks/use-ps-debounced-value.js +0 -15
- package/dist/hooks/use-ps-optimistic-rows.d.ts +0 -3
- package/dist/hooks/use-ps-optimistic-rows.js +0 -33
- package/dist/interfaces/ps-change-queue-input.d.ts +0 -5
- package/dist/interfaces/ps-change-queue-result.d.ts +0 -3
- package/dist/interfaces/ps-optimistic-changes.d.ts +0 -7
- package/dist/interfaces/ps-optimistic-failure-reason.d.ts +0 -1
- package/dist/interfaces/ps-optimistic-outcome.d.ts +0 -5
- package/dist/interfaces/ps-optimistic-rows-input.d.ts +0 -6
- package/dist/interfaces/ps-optimistic-rows-result.d.ts +0 -6
- package/dist/interfaces/ps-optimistic-save-spec.d.ts +0 -11
- package/dist/services/ps-deep-equal-service.d.ts +0 -5
- package/dist/services/ps-deep-equal-service.js +0 -35
- package/dist/services/ps-optimistic-fetcher-service.d.ts +0 -6
- package/dist/services/ps-optimistic-fetcher-service.js +0 -16
- package/dist/services/ps-optimistic-release-service.d.ts +0 -5
- package/dist/services/ps-optimistic-release-service.js +0 -42
- package/dist/services/ps-optimistic-save-service.d.ts +0 -11
- package/dist/services/ps-optimistic-save-service.js +0 -68
- /package/dist/esm/interfaces/{ps-change-queue-input.js → ps-cursor-pages-input.js} +0 -0
- /package/dist/esm/interfaces/{ps-change-queue-result.js → ps-cursor-pages-result.js} +0 -0
- /package/dist/esm/interfaces/{ps-optimistic-changes.js → ps-draft-state-options.js} +0 -0
- /package/dist/esm/interfaces/{ps-optimistic-failure-reason.js → ps-draft-state-result.js} +0 -0
- /package/dist/esm/interfaces/{ps-optimistic-outcome.js → ps-remote-read-input.js} +0 -0
- /package/dist/esm/interfaces/{ps-optimistic-rows-input.js → ps-remote-read-result.js} +0 -0
- /package/dist/esm/{interfaces/ps-optimistic-rows-result.js → models/ps-cursor-pages-state.js} +0 -0
- /package/dist/esm/{interfaces/ps-optimistic-save-spec.js → models/ps-draft-state-data.js} +0 -0
- /package/dist/interfaces/{ps-change-queue-input.js → ps-cursor-pages-input.js} +0 -0
- /package/dist/interfaces/{ps-change-queue-result.js → ps-cursor-pages-result.js} +0 -0
- /package/dist/interfaces/{ps-optimistic-changes.js → ps-draft-state-options.js} +0 -0
- /package/dist/interfaces/{ps-optimistic-failure-reason.js → ps-draft-state-result.js} +0 -0
- /package/dist/interfaces/{ps-optimistic-outcome.js → ps-remote-read-input.js} +0 -0
- /package/dist/interfaces/{ps-optimistic-rows-input.js → ps-remote-read-result.js} +0 -0
- /package/dist/{interfaces/ps-optimistic-rows-result.js → models/ps-cursor-pages-state.js} +0 -0
- /package/dist/{interfaces/ps-optimistic-save-spec.js → models/ps-draft-state-data.js} +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PsOptimisticReleaseService = void 0;
|
|
4
|
-
const ps_deep_equal_service_1 = require("./ps-deep-equal-service");
|
|
5
|
-
class PsOptimisticReleaseService {
|
|
6
|
-
static empty(rows) {
|
|
7
|
-
return { base: rows, changes: [], drainBase: null, wasActive: false, wasHolding: false };
|
|
8
|
-
}
|
|
9
|
-
static next(remembered, rows, isActive, isHolding, apply) {
|
|
10
|
-
if (isActive) {
|
|
11
|
-
const wasHolding = remembered.wasHolding || isHolding;
|
|
12
|
-
if (remembered.wasActive &&
|
|
13
|
-
remembered.drainBase === null &&
|
|
14
|
-
remembered.wasHolding === wasHolding)
|
|
15
|
-
return remembered;
|
|
16
|
-
return { ...remembered, drainBase: null, wasActive: true, wasHolding };
|
|
17
|
-
}
|
|
18
|
-
if (remembered.changes.length === 0) {
|
|
19
|
-
if (remembered.base === rows && !remembered.wasActive)
|
|
20
|
-
return remembered;
|
|
21
|
-
return PsOptimisticReleaseService.empty(rows);
|
|
22
|
-
}
|
|
23
|
-
if (remembered.wasActive) {
|
|
24
|
-
if (remembered.wasHolding && rows !== remembered.base) {
|
|
25
|
-
return PsOptimisticReleaseService.empty(rows);
|
|
26
|
-
}
|
|
27
|
-
if (!ps_deep_equal_service_1.PsDeepEqualService.isEqual(rows, remembered.base)) {
|
|
28
|
-
return PsOptimisticReleaseService.empty(rows);
|
|
29
|
-
}
|
|
30
|
-
return { ...remembered, drainBase: rows, wasActive: false, wasHolding: false };
|
|
31
|
-
}
|
|
32
|
-
const reference = remembered.drainBase === null ? remembered.base : remembered.drainBase;
|
|
33
|
-
if (!ps_deep_equal_service_1.PsDeepEqualService.isEqual(rows, reference)) {
|
|
34
|
-
return PsOptimisticReleaseService.empty(rows);
|
|
35
|
-
}
|
|
36
|
-
if (ps_deep_equal_service_1.PsDeepEqualService.isEqual(apply(rows, remembered.changes), rows)) {
|
|
37
|
-
return PsOptimisticReleaseService.empty(rows);
|
|
38
|
-
}
|
|
39
|
-
return remembered;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.PsOptimisticReleaseService = PsOptimisticReleaseService;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PsOptimisticSaveSpec } from '../interfaces/ps-optimistic-save-spec';
|
|
2
|
-
export declare class PsOptimisticSaveService {
|
|
3
|
-
static isPending(id: string): boolean;
|
|
4
|
-
static pendingId(): string;
|
|
5
|
-
static saveValues<Row, Values>(spec: PsOptimisticSaveSpec<Row, Values>, values: Values, existingId: string, scopeId: string): Record<string, string>;
|
|
6
|
-
static removeValues<Row, Values>(spec: PsOptimisticSaveSpec<Row, Values>, ids: string[]): Record<string, string>;
|
|
7
|
-
static apply<Row, Values>(rows: Row[], changes: Record<string, string>[], spec: PsOptimisticSaveSpec<Row, Values>): Row[];
|
|
8
|
-
private static read;
|
|
9
|
-
private static saved;
|
|
10
|
-
private static removed;
|
|
11
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PsOptimisticSaveService = void 0;
|
|
4
|
-
const ps_optimistic_config_1 = require("../constants/ps-optimistic-config");
|
|
5
|
-
class PsOptimisticSaveService {
|
|
6
|
-
static isPending(id) {
|
|
7
|
-
return id.startsWith(ps_optimistic_config_1.PsOptimisticConfig.pendingPrefix);
|
|
8
|
-
}
|
|
9
|
-
static pendingId() {
|
|
10
|
-
return `${ps_optimistic_config_1.PsOptimisticConfig.pendingPrefix}${crypto.randomUUID()}`;
|
|
11
|
-
}
|
|
12
|
-
static saveValues(spec, values, existingId, scopeId) {
|
|
13
|
-
const fields = spec.isFlat
|
|
14
|
-
? Object.fromEntries(Object.entries(values).map(([key, value]) => [key, String(value)]))
|
|
15
|
-
: { values: JSON.stringify(values) };
|
|
16
|
-
return {
|
|
17
|
-
...fields,
|
|
18
|
-
[spec.idField]: existingId,
|
|
19
|
-
intent: spec.intent,
|
|
20
|
-
pendingId: PsOptimisticSaveService.pendingId(),
|
|
21
|
-
scopeId,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
static removeValues(spec, ids) {
|
|
25
|
-
return spec.remove === undefined
|
|
26
|
-
? {}
|
|
27
|
-
: { [spec.remove.idsField]: JSON.stringify(ids), intent: spec.remove.intent };
|
|
28
|
-
}
|
|
29
|
-
static apply(rows, changes, spec) {
|
|
30
|
-
return changes.reduce((current, change) => {
|
|
31
|
-
if (change.intent === spec.intent)
|
|
32
|
-
return PsOptimisticSaveService.saved(current, change, spec);
|
|
33
|
-
if (spec.remove !== undefined && change.intent === spec.remove.intent)
|
|
34
|
-
return PsOptimisticSaveService.removed(current, change, spec, spec.remove.idsField);
|
|
35
|
-
return current;
|
|
36
|
-
}, rows);
|
|
37
|
-
}
|
|
38
|
-
static read(raw) {
|
|
39
|
-
if (raw === undefined)
|
|
40
|
-
return null;
|
|
41
|
-
try {
|
|
42
|
-
return JSON.parse(raw);
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
static saved(rows, change, spec) {
|
|
49
|
-
const parsed = spec.isFlat ? change : PsOptimisticSaveService.read(change.values);
|
|
50
|
-
if (parsed === null || typeof parsed !== 'object')
|
|
51
|
-
return rows;
|
|
52
|
-
const existingId = change[spec.idField];
|
|
53
|
-
const id = existingId === '' ? change.pendingId : existingId;
|
|
54
|
-
const previous = rows.find((row) => spec.getId(row) === existingId);
|
|
55
|
-
const built = spec.build(parsed, id, previous === undefined ? null : previous, change.scopeId);
|
|
56
|
-
if (built === null)
|
|
57
|
-
return rows;
|
|
58
|
-
return previous === undefined
|
|
59
|
-
? [...rows, built]
|
|
60
|
-
: rows.map((row) => (spec.getId(row) === existingId ? built : row));
|
|
61
|
-
}
|
|
62
|
-
static removed(rows, change, spec, idsField) {
|
|
63
|
-
const parsed = PsOptimisticSaveService.read(change[idsField]);
|
|
64
|
-
const ids = new Set(Array.isArray(parsed) ? parsed : []);
|
|
65
|
-
return rows.filter((row) => !ids.has(spec.getId(row)));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.PsOptimisticSaveService = PsOptimisticSaveService;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/esm/{interfaces/ps-optimistic-rows-result.js → models/ps-cursor-pages-state.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|