@pallasoft/ps-core-components 2.47.0 → 2.48.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-form-page-skeleton.d.ts +5 -1
- package/dist/components/ps-form-page-skeleton.js +1 -1
- package/dist/components/ps-metric-grid-skeleton.js +5 -1
- package/dist/components/ps-page-header.d.ts +2 -1
- package/dist/components/ps-page-header.js +1 -1
- package/dist/components/ps-page-skeleton.d.ts +2 -1
- package/dist/components/ps-page-skeleton.js +4 -1
- package/dist/components/ps-section-header.js +1 -1
- package/dist/components/ps-section-panel-skeleton.d.ts +2 -1
- package/dist/components/ps-section-panel-skeleton.js +4 -1
- package/dist/esm/components/ps-form-page-skeleton.js +1 -1
- package/dist/esm/components/ps-metric-grid-skeleton.js +5 -1
- package/dist/esm/components/ps-page-header.js +1 -1
- package/dist/esm/components/ps-page-skeleton.js +4 -1
- package/dist/esm/components/ps-section-header.js +1 -1
- package/dist/esm/components/ps-section-panel-skeleton.js +4 -1
- 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-text-param.js +1 -1
- package/dist/esm/index.js +2 -12
- package/dist/esm/services/ps-draft-state-service.js +1 -1
- 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-text-param.js +2 -2
- package/dist/index.d.ts +2 -12
- package/dist/index.js +9 -12
- package/dist/interfaces/ps-optimistic-failure.d.ts +1 -1
- package/dist/interfaces/ps-optimistic-save-input.d.ts +1 -1
- package/dist/services/ps-draft-state-service.js +2 -2
- 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/interfaces/ps-change-queue-input.js +0 -1
- package/dist/esm/interfaces/ps-change-queue-result.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-changes.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-failure-reason.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-outcome.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-rows-input.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-rows-result.js +0 -1
- package/dist/esm/interfaces/ps-optimistic-save-spec.js +0 -1
- 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-input.js +0 -2
- package/dist/interfaces/ps-change-queue-result.d.ts +0 -3
- package/dist/interfaces/ps-change-queue-result.js +0 -2
- package/dist/interfaces/ps-optimistic-changes.d.ts +0 -7
- package/dist/interfaces/ps-optimistic-changes.js +0 -2
- package/dist/interfaces/ps-optimistic-failure-reason.d.ts +0 -1
- package/dist/interfaces/ps-optimistic-failure-reason.js +0 -2
- package/dist/interfaces/ps-optimistic-outcome.d.ts +0 -5
- package/dist/interfaces/ps-optimistic-outcome.js +0 -2
- package/dist/interfaces/ps-optimistic-rows-input.d.ts +0 -6
- package/dist/interfaces/ps-optimistic-rows-input.js +0 -2
- package/dist/interfaces/ps-optimistic-rows-result.d.ts +0 -6
- package/dist/interfaces/ps-optimistic-rows-result.js +0 -2
- package/dist/interfaces/ps-optimistic-save-spec.d.ts +0 -11
- package/dist/interfaces/ps-optimistic-save-spec.js +0 -2
- 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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export interface PsFormPageSkeletonProps {
|
|
2
|
+
hasActions?: boolean;
|
|
3
|
+
hasBackLink?: boolean;
|
|
4
|
+
isNarrow?: boolean;
|
|
2
5
|
loadingLabel: string;
|
|
3
6
|
title?: string;
|
|
7
|
+
variant?: 'bordered' | 'card' | 'plain';
|
|
4
8
|
}
|
|
5
|
-
export declare const PsFormPageSkeleton: ({ loadingLabel, title }: PsFormPageSkeletonProps) => import("react").JSX.Element;
|
|
9
|
+
export declare const PsFormPageSkeleton: ({ hasActions, hasBackLink, isNarrow, loadingLabel, title, variant, }: PsFormPageSkeletonProps) => import("react").JSX.Element;
|
|
@@ -6,5 +6,5 @@ const ps_page_skeleton_config_1 = require("../constants/ps-page-skeleton-config"
|
|
|
6
6
|
const ps_form_fields_skeleton_1 = require("./ps-form-fields-skeleton");
|
|
7
7
|
const ps_page_skeleton_1 = require("./ps-page-skeleton");
|
|
8
8
|
const ps_section_panel_skeleton_1 = require("./ps-section-panel-skeleton");
|
|
9
|
-
const PsFormPageSkeleton = ({ loadingLabel, title }) => ((0, jsx_runtime_1.jsx)(ps_page_skeleton_1.PsPageSkeleton, { hasActions:
|
|
9
|
+
const PsFormPageSkeleton = ({ hasActions = true, hasBackLink = false, isNarrow = false, loadingLabel, title, variant = 'plain', }) => ((0, jsx_runtime_1.jsx)(ps_page_skeleton_1.PsPageSkeleton, { hasActions: hasActions, hasBackLink: hasBackLink, isNarrow: isNarrow, loadingLabel: loadingLabel, title: title, children: ps_page_skeleton_config_1.PsPageSkeletonConfig.formSections.map((section) => ((0, jsx_runtime_1.jsx)(ps_section_panel_skeleton_1.PsSectionPanelSkeleton, { variant: variant, children: (0, jsx_runtime_1.jsx)(ps_form_fields_skeleton_1.PsFormFieldsSkeleton, {}) }, section))) }));
|
|
10
10
|
exports.PsFormPageSkeleton = PsFormPageSkeleton;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsMetricGridSkeleton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_metric_grid_config_1 = require("../constants/ps-metric-grid-config");
|
|
5
6
|
const ps_metric_card_1 = require("./ps-metric-card");
|
|
6
|
-
const PsMetricGridSkeleton = ({ count }) =>
|
|
7
|
+
const PsMetricGridSkeleton = ({ count }) => {
|
|
8
|
+
const columns = ps_metric_grid_config_1.PsMetricGridColumns[Math.min(count, ps_metric_grid_config_1.PsMetricGridConfig.maxColumns)];
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `grid grid-cols-1 gap-3 ${columns === undefined ? ps_metric_grid_config_1.PsMetricGridColumns[ps_metric_grid_config_1.PsMetricGridConfig.defaultColumns] : columns}`, children: Array.from({ length: count }, (_, index) => ((0, jsx_runtime_1.jsx)(ps_metric_card_1.PsMetricCard, { isLoading: true, label: '', value: '' }, index))) }));
|
|
10
|
+
};
|
|
7
11
|
exports.PsMetricGridSkeleton = PsMetricGridSkeleton;
|
|
@@ -3,6 +3,7 @@ import { type PsBackLinkProps } from './ps-back-link';
|
|
|
3
3
|
export interface PsPageHeaderProps {
|
|
4
4
|
actions?: ReactNode;
|
|
5
5
|
backLink?: PsBackLinkProps;
|
|
6
|
+
leading?: ReactNode;
|
|
6
7
|
title: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const PsPageHeader: ({ actions, backLink, title }: PsPageHeaderProps) => import("react").JSX.Element;
|
|
9
|
+
export declare const PsPageHeader: ({ actions, backLink, leading, title }: PsPageHeaderProps) => import("react").JSX.Element;
|
|
@@ -4,5 +4,5 @@ exports.PsPageHeader = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ps_back_link_1 = require("./ps-back-link");
|
|
6
6
|
const ps_section_header_1 = require("./ps-section-header");
|
|
7
|
-
const PsPageHeader = ({ actions, backLink, title }) => ((0, jsx_runtime_1.jsx)(ps_section_header_1.PsSectionHeader, { leading: backLink ? (0, jsx_runtime_1.jsx)(ps_back_link_1.PsBackLink, { ...backLink }) :
|
|
7
|
+
const PsPageHeader = ({ actions, backLink, leading, title }) => ((0, jsx_runtime_1.jsx)(ps_section_header_1.PsSectionHeader, { leading: backLink ? (0, jsx_runtime_1.jsx)(ps_back_link_1.PsBackLink, { ...backLink }) : leading, title: title, trailing: actions ? ((0, jsx_runtime_1.jsx)("div", { className: 'flex flex-wrap items-center justify-end gap-2', children: actions })) : undefined }));
|
|
8
8
|
exports.PsPageHeader = PsPageHeader;
|
|
@@ -3,8 +3,9 @@ export interface PsPageSkeletonProps {
|
|
|
3
3
|
actions?: ReactNode;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
hasActions?: boolean;
|
|
6
|
+
hasBackLink?: boolean;
|
|
6
7
|
isNarrow?: boolean;
|
|
7
8
|
loadingLabel: string;
|
|
8
9
|
title?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare const PsPageSkeleton: ({ actions, children, hasActions, isNarrow, loadingLabel, title, }: PsPageSkeletonProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const PsPageSkeleton: ({ actions, children, hasActions, hasBackLink, isNarrow, loadingLabel, title, }: PsPageSkeletonProps) => import("react").JSX.Element;
|
|
@@ -8,5 +8,8 @@ const ps_page_layout_1 = require("./ps-page-layout");
|
|
|
8
8
|
const ps_page_stack_1 = require("./ps-page-stack");
|
|
9
9
|
const ps_section_header_1 = require("./ps-section-header");
|
|
10
10
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
11
|
-
const PsPageSkeleton = ({ actions, children, hasActions = false,
|
|
11
|
+
const PsPageSkeleton = ({ actions, children, hasActions = false, hasBackLink = false, isNarrow = false, loadingLabel, title, }) => {
|
|
12
|
+
const backLink = hasBackLink ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-5 w-32' }) : undefined;
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(ps_page_layout_1.PsPageLayout, { isNarrow: isNarrow, children: (0, jsx_runtime_1.jsxs)(ps_page_stack_1.PsPageStack, { children: [title === undefined ? ((0, jsx_runtime_1.jsx)(ps_section_header_1.PsSectionHeader, { isLoading: true, leading: backLink, title: loadingLabel, trailing: hasActions })) : ((0, jsx_runtime_1.jsx)(ps_page_header_1.PsPageHeader, { actions: actions !== undefined ? (actions) : hasActions ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { shape: ps_skeleton_shape_1.PsSkeletonShape.Button })) : undefined, leading: backLink, title: title })), children] }) }));
|
|
14
|
+
};
|
|
12
15
|
exports.PsPageSkeleton = PsPageSkeleton;
|
|
@@ -5,5 +5,5 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const ps_skeleton_shape_1 = require("../constants/ps-skeleton-shape");
|
|
6
6
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
7
7
|
const ps_skeleton_group_1 = require("./ps-skeleton-group");
|
|
8
|
-
const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? ((0, jsx_runtime_1.jsxs)(ps_skeleton_group_1.PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-2.5 w-24' }) : null, (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-6 w-52' }), description ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { shape: ps_skeleton_shape_1.PsSkeletonShape.Button }) : null] })) : ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? ((0, jsx_runtime_1.jsx)("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, (0, jsx_runtime_1.jsx)("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? ((0, jsx_runtime_1.jsx)("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? ((0, jsx_runtime_1.jsx)("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
8
|
+
const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? ((0, jsx_runtime_1.jsxs)(ps_skeleton_group_1.PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-2.5 w-24' }) : null, (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-6 w-52' }), description ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? (0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { shape: ps_skeleton_shape_1.PsSkeletonShape.Button }) : null] })) : ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? ((0, jsx_runtime_1.jsx)("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, (0, jsx_runtime_1.jsx)("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? ((0, jsx_runtime_1.jsx)("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? ((0, jsx_runtime_1.jsx)("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
9
9
|
exports.PsSectionHeader = PsSectionHeader;
|
|
@@ -2,5 +2,6 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
export interface PsSectionPanelSkeletonProps {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
title?: string;
|
|
5
|
+
variant?: 'bordered' | 'card' | 'plain';
|
|
5
6
|
}
|
|
6
|
-
export declare const PsSectionPanelSkeleton: ({ children, title }: PsSectionPanelSkeletonProps) => import("react").JSX.Element;
|
|
7
|
+
export declare const PsSectionPanelSkeleton: ({ children, title, variant, }: PsSectionPanelSkeletonProps) => import("react").JSX.Element;
|
|
@@ -3,5 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PsSectionPanelSkeleton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ps_skeleton_1 = require("./ps-skeleton");
|
|
6
|
-
const PsSectionPanelSkeleton = ({ children, title
|
|
6
|
+
const PsSectionPanelSkeleton = ({ children, title, variant = 'plain', }) => {
|
|
7
|
+
const heading = title === undefined ? ((0, jsx_runtime_1.jsx)(ps_skeleton_1.PsSkeleton, { className: 'h-4 w-44' })) : ((0, jsx_runtime_1.jsx)("h2", { className: 'text-base font-semibold text-ink', children: title }));
|
|
8
|
+
return variant === 'bordered' ? ((0, jsx_runtime_1.jsxs)("section", { className: 'rounded-ps-panel border border-line bg-surface', children: [(0, jsx_runtime_1.jsx)("header", { className: 'flex min-h-14 items-center justify-between gap-3 border-b border-line px-5 py-3', children: (0, jsx_runtime_1.jsx)("div", { className: 'flex min-w-0 flex-col', children: heading }) }), (0, jsx_runtime_1.jsx)("div", { className: 'flex flex-col gap-4 p-5', children: children })] })) : variant === 'card' ? ((0, jsx_runtime_1.jsxs)("section", { className: 'rounded-ps-panel border border-line bg-surface p-5', children: [(0, jsx_runtime_1.jsx)("div", { className: 'mb-3', children: heading }), children] })) : ((0, jsx_runtime_1.jsxs)("section", { className: 'ps-section', children: [(0, jsx_runtime_1.jsx)("div", { className: 'flex min-h-10 items-center', children: heading }), (0, jsx_runtime_1.jsx)("div", { className: 'flex min-w-0 flex-col gap-4', children: children })] }));
|
|
9
|
+
};
|
|
7
10
|
exports.PsSectionPanelSkeleton = PsSectionPanelSkeleton;
|
|
@@ -3,4 +3,4 @@ import { PsPageSkeletonConfig } from '../constants/ps-page-skeleton-config.js';
|
|
|
3
3
|
import { PsFormFieldsSkeleton } from './ps-form-fields-skeleton.js';
|
|
4
4
|
import { PsPageSkeleton } from './ps-page-skeleton.js';
|
|
5
5
|
import { PsSectionPanelSkeleton } from './ps-section-panel-skeleton.js';
|
|
6
|
-
export const PsFormPageSkeleton = ({ loadingLabel, title }) => (_jsx(PsPageSkeleton, { hasActions:
|
|
6
|
+
export const PsFormPageSkeleton = ({ hasActions = true, hasBackLink = false, isNarrow = false, loadingLabel, title, variant = 'plain', }) => (_jsx(PsPageSkeleton, { hasActions: hasActions, hasBackLink: hasBackLink, isNarrow: isNarrow, loadingLabel: loadingLabel, title: title, children: PsPageSkeletonConfig.formSections.map((section) => (_jsx(PsSectionPanelSkeleton, { variant: variant, children: _jsx(PsFormFieldsSkeleton, {}) }, section))) }));
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PsMetricGridColumns, PsMetricGridConfig } from '../constants/ps-metric-grid-config.js';
|
|
2
3
|
import { PsMetricCard } from './ps-metric-card.js';
|
|
3
|
-
export const PsMetricGridSkeleton = ({ count }) =>
|
|
4
|
+
export const PsMetricGridSkeleton = ({ count }) => {
|
|
5
|
+
const columns = PsMetricGridColumns[Math.min(count, PsMetricGridConfig.maxColumns)];
|
|
6
|
+
return (_jsx("div", { className: `grid grid-cols-1 gap-3 ${columns === undefined ? PsMetricGridColumns[PsMetricGridConfig.defaultColumns] : columns}`, children: Array.from({ length: count }, (_, index) => (_jsx(PsMetricCard, { isLoading: true, label: '', value: '' }, index))) }));
|
|
7
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PsBackLink } from './ps-back-link.js';
|
|
3
3
|
import { PsSectionHeader } from './ps-section-header.js';
|
|
4
|
-
export const PsPageHeader = ({ actions, backLink, title }) => (_jsx(PsSectionHeader, { leading: backLink ? _jsx(PsBackLink, { ...backLink }) :
|
|
4
|
+
export const PsPageHeader = ({ actions, backLink, leading, title }) => (_jsx(PsSectionHeader, { leading: backLink ? _jsx(PsBackLink, { ...backLink }) : leading, title: title, trailing: actions ? (_jsx("div", { className: 'flex flex-wrap items-center justify-end gap-2', children: actions })) : undefined }));
|
|
@@ -5,4 +5,7 @@ import { PsPageLayout } from './ps-page-layout.js';
|
|
|
5
5
|
import { PsPageStack } from './ps-page-stack.js';
|
|
6
6
|
import { PsSectionHeader } from './ps-section-header.js';
|
|
7
7
|
import { PsSkeleton } from './ps-skeleton.js';
|
|
8
|
-
export const PsPageSkeleton = ({ actions, children, hasActions = false,
|
|
8
|
+
export const PsPageSkeleton = ({ actions, children, hasActions = false, hasBackLink = false, isNarrow = false, loadingLabel, title, }) => {
|
|
9
|
+
const backLink = hasBackLink ? _jsx(PsSkeleton, { className: 'h-5 w-32' }) : undefined;
|
|
10
|
+
return (_jsx(PsPageLayout, { isNarrow: isNarrow, children: _jsxs(PsPageStack, { children: [title === undefined ? (_jsx(PsSectionHeader, { isLoading: true, leading: backLink, title: loadingLabel, trailing: hasActions })) : (_jsx(PsPageHeader, { actions: actions !== undefined ? (actions) : hasActions ? (_jsx(PsSkeleton, { shape: PsSkeletonShape.Button })) : undefined, leading: backLink, title: title })), children] }) }));
|
|
11
|
+
};
|
|
@@ -2,4 +2,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { PsSkeletonShape } from '../constants/ps-skeleton-shape.js';
|
|
3
3
|
import { PsSkeleton } from './ps-skeleton.js';
|
|
4
4
|
import { PsSkeletonGroup } from './ps-skeleton-group.js';
|
|
5
|
-
export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { shape: PsSkeletonShape.Button }) : null] })) : (_jsxs("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (_jsx("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, _jsx("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? (_jsx("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? (_jsx("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
5
|
+
export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { shape: PsSkeletonShape.Button }) : null] })) : (_jsxs("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (_jsx("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, _jsx("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? (_jsx("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? (_jsx("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PsSkeleton } from './ps-skeleton.js';
|
|
3
|
-
export const PsSectionPanelSkeleton = ({ children, title
|
|
3
|
+
export const PsSectionPanelSkeleton = ({ children, title, variant = 'plain', }) => {
|
|
4
|
+
const heading = title === undefined ? (_jsx(PsSkeleton, { className: 'h-4 w-44' })) : (_jsx("h2", { className: 'text-base font-semibold text-ink', children: title }));
|
|
5
|
+
return variant === 'bordered' ? (_jsxs("section", { className: 'rounded-ps-panel border border-line bg-surface', children: [_jsx("header", { className: 'flex min-h-14 items-center justify-between gap-3 border-b border-line px-5 py-3', children: _jsx("div", { className: 'flex min-w-0 flex-col', children: heading }) }), _jsx("div", { className: 'flex flex-col gap-4 p-5', children: children })] })) : variant === 'card' ? (_jsxs("section", { className: 'rounded-ps-panel border border-line bg-surface p-5', children: [_jsx("div", { className: 'mb-3', children: heading }), children] })) : (_jsxs("section", { className: 'ps-section', children: [_jsx("div", { className: 'flex min-h-10 items-center', children: heading }), _jsx("div", { className: 'flex min-w-0 flex-col gap-4', children: children })] }));
|
|
6
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { PsOptimisticConfig } from '
|
|
3
|
-
import {
|
|
4
|
-
import { usePsChangeQueue } from './use-ps-change-queue.js';
|
|
5
|
-
import { usePsOptimisticRows } from './use-ps-optimistic-rows.js';
|
|
2
|
+
import { PsOptimisticConfig, PsOptimisticFetcherService, } from '@pallasoft/ps-utilities';
|
|
3
|
+
import { usePsChangeQueue, usePsOptimisticRows } from '@pallasoft/ps-utilities/react';
|
|
6
4
|
export const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess, merge, onError, revalidator, rows, }) => {
|
|
7
5
|
const [isUnsettled, setIsUnsettled] = useState(false);
|
|
8
6
|
const submitted = useRef(0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { PsOptimisticSaveService } from '
|
|
2
|
+
import { PsOptimisticSaveService } from '@pallasoft/ps-utilities';
|
|
3
3
|
import { usePsOptimisticFetcher } from './use-ps-optimistic-fetcher.js';
|
|
4
4
|
export const usePsOptimisticSave = ({ fetcher, isSuccess, onError, revalidator, rows, scopeId, spec, }) => {
|
|
5
5
|
const apply = useCallback((base, changes) => PsOptimisticSaveService.apply(base, changes, spec), [spec]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { usePsDebouncedValue } from '@pallasoft/ps-utilities/react';
|
|
2
3
|
import { PsQueryParamConfig } from '../constants/ps-query-param-config.js';
|
|
3
4
|
import { PsQueryParamService } from '../services/ps-query-param-service.js';
|
|
4
|
-
import { usePsDebouncedValue } from './use-ps-debounced-value.js';
|
|
5
5
|
export const usePsTextParam = ([searchParams, setSearchParams], { debounceMs, name, resetParams }) => {
|
|
6
6
|
const raw = searchParams.get(name);
|
|
7
7
|
const committed = raw === null ? '' : raw;
|
package/dist/esm/index.js
CHANGED
|
@@ -90,21 +90,13 @@ export * from './interfaces/ps-component-props.js';
|
|
|
90
90
|
export * from './models/ps-element-size.js';
|
|
91
91
|
export * from './models/ps-voice-orb.js';
|
|
92
92
|
export * from './models/ps-navigation-progress.js';
|
|
93
|
-
export * from './hooks/use-ps-debounced-value.js';
|
|
94
|
-
export * from './hooks/use-ps-change-queue.js';
|
|
95
|
-
export * from './interfaces/ps-change-queue-input.js';
|
|
96
|
-
export * from './interfaces/ps-change-queue-result.js';
|
|
97
93
|
export * from './hooks/use-ps-live.js';
|
|
98
94
|
export * from './hooks/use-ps-debounced-revalidate.js';
|
|
99
|
-
export * from './hooks/use-ps-optimistic-rows.js';
|
|
100
95
|
export * from './hooks/use-ps-optimistic-fetcher.js';
|
|
101
96
|
export * from './hooks/use-ps-optimistic-save.js';
|
|
102
|
-
export * from './constants/ps-optimistic-config.js';
|
|
103
97
|
export * from './interfaces/ps-optimistic-save-input.js';
|
|
104
98
|
export * from './interfaces/ps-optimistic-save-result.js';
|
|
105
|
-
export * from './interfaces/ps-optimistic-save-spec.js';
|
|
106
99
|
export * from './interfaces/ps-revalidation-args.js';
|
|
107
|
-
export * from './services/ps-optimistic-save-service.js';
|
|
108
100
|
export * from './services/ps-client-param-revalidation-service.js';
|
|
109
101
|
export * from './interfaces/ps-fetcher-like.js';
|
|
110
102
|
export * from './interfaces/ps-fetcher-submit-options.js';
|
|
@@ -114,10 +106,7 @@ export * from './interfaces/ps-live-open-options.js';
|
|
|
114
106
|
export * from './interfaces/ps-optimistic-fetcher-input.js';
|
|
115
107
|
export * from './interfaces/ps-optimistic-fetcher-result.js';
|
|
116
108
|
export * from './interfaces/ps-optimistic-failure.js';
|
|
117
|
-
export * from './interfaces/ps-optimistic-failure-reason.js';
|
|
118
109
|
export * from './interfaces/ps-revalidator-like.js';
|
|
119
|
-
export * from './interfaces/ps-optimistic-rows-input.js';
|
|
120
|
-
export * from './interfaces/ps-optimistic-rows-result.js';
|
|
121
110
|
export * from './hooks/use-ps-navigation-progress.js';
|
|
122
111
|
export * from './models/ps-draggable-grid.js';
|
|
123
112
|
export * from './constants/ps-draggable-grid.js';
|
|
@@ -132,7 +121,6 @@ export * from './constants/ps-data-boundary-variant.js';
|
|
|
132
121
|
export * from './hooks/use-ps-retained-promise.js';
|
|
133
122
|
export * from './hooks/use-ps-promise-value.js';
|
|
134
123
|
export * from './interfaces/ps-retained-promise-data.js';
|
|
135
|
-
export * from './services/ps-deep-equal-service.js';
|
|
136
124
|
export * from './components/ps-faq-answer.js';
|
|
137
125
|
export * from './components/ps-feature-grid.js';
|
|
138
126
|
export * from './components/ps-feature-card.js';
|
|
@@ -258,3 +246,5 @@ export * from './constants/ps-image-config.js';
|
|
|
258
246
|
export * from './models/ps-image-state-data.js';
|
|
259
247
|
export * from './services/ps-image-service.js';
|
|
260
248
|
export * from './components/ps-image.js';
|
|
249
|
+
export { PsDeepEqualService, PsOptimisticConfig, PsOptimisticSaveService, } from '@pallasoft/ps-utilities';
|
|
250
|
+
export { usePsChangeQueue, usePsDebouncedValue, usePsOptimisticRows, } from '@pallasoft/ps-utilities/react';
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePsOptimisticFetcher = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const use_ps_change_queue_1 = require("./use-ps-change-queue");
|
|
8
|
-
const use_ps_optimistic_rows_1 = require("./use-ps-optimistic-rows");
|
|
5
|
+
const ps_utilities_1 = require("@pallasoft/ps-utilities");
|
|
6
|
+
const react_2 = require("@pallasoft/ps-utilities/react");
|
|
9
7
|
const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess, merge, onError, revalidator, rows, }) => {
|
|
10
8
|
const [isUnsettled, setIsUnsettled] = (0, react_1.useState)(false);
|
|
11
9
|
const submitted = (0, react_1.useRef)(0);
|
|
@@ -14,7 +12,7 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
14
12
|
const dataBefore = (0, react_1.useRef)(fetcher.data);
|
|
15
13
|
const dataSeen = (0, react_1.useRef)(fetcher.data);
|
|
16
14
|
const failure = (0, react_1.useRef)(null);
|
|
17
|
-
const { forgetLast, remember, rows: shown, } = (0,
|
|
15
|
+
const { forgetLast, remember, rows: shown, } = (0, react_2.usePsOptimisticRows)({
|
|
18
16
|
apply,
|
|
19
17
|
isHolding,
|
|
20
18
|
isSaving: isUnsettled || fetcher.state !== 'idle' || revalidator.state !== 'idle',
|
|
@@ -33,7 +31,7 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
33
31
|
const done = settle.current;
|
|
34
32
|
settle.current = null;
|
|
35
33
|
sawBusy.current = false;
|
|
36
|
-
done(
|
|
34
|
+
done(ps_utilities_1.PsOptimisticFetcherService.outcome(fetcher.data, dataBefore.current));
|
|
37
35
|
}, [fetcher.data, fetcher.state]);
|
|
38
36
|
(0, react_1.useEffect)(() => () => {
|
|
39
37
|
if (settle.current === null)
|
|
@@ -49,7 +47,7 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
49
47
|
settle.current = null;
|
|
50
48
|
resolve(outcome);
|
|
51
49
|
};
|
|
52
|
-
const timer = setTimeout(() => finish({ data: undefined, reason: 'timeout' }),
|
|
50
|
+
const timer = setTimeout(() => finish({ data: undefined, reason: 'timeout' }), ps_utilities_1.PsOptimisticConfig.submitTimeoutMs);
|
|
53
51
|
settle.current = finish;
|
|
54
52
|
sawBusy.current = false;
|
|
55
53
|
dataBefore.current = dataSeen.current;
|
|
@@ -64,7 +62,7 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
64
62
|
failure.current = null;
|
|
65
63
|
for (const submission of merge === undefined ? queued : merge(queued)) {
|
|
66
64
|
const outcome = await submitOne(submission);
|
|
67
|
-
const reason =
|
|
65
|
+
const reason = ps_utilities_1.PsOptimisticFetcherService.failureReason(outcome, isSuccess);
|
|
68
66
|
if (reason !== null) {
|
|
69
67
|
failure.current = { data: outcome.data, reason };
|
|
70
68
|
throw new Error(reason);
|
|
@@ -94,7 +92,7 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
94
92
|
}
|
|
95
93
|
onError({ ...cause, changes: [...failed, ...dropped] });
|
|
96
94
|
}, [forgetLast, onError]);
|
|
97
|
-
const queue = (0,
|
|
95
|
+
const queue = (0, react_2.usePsChangeQueue)({
|
|
98
96
|
onDrained: revalidate,
|
|
99
97
|
onFailed: forgetFailed,
|
|
100
98
|
send,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePsOptimisticSave = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const ps_utilities_1 = require("@pallasoft/ps-utilities");
|
|
6
6
|
const use_ps_optimistic_fetcher_1 = require("./use-ps-optimistic-fetcher");
|
|
7
7
|
const usePsOptimisticSave = ({ fetcher, isSuccess, onError, revalidator, rows, scopeId, spec, }) => {
|
|
8
|
-
const apply = (0, react_1.useCallback)((base, changes) =>
|
|
8
|
+
const apply = (0, react_1.useCallback)((base, changes) => ps_utilities_1.PsOptimisticSaveService.apply(base, changes, spec), [spec]);
|
|
9
9
|
const optimistic = (0, use_ps_optimistic_fetcher_1.usePsOptimisticFetcher)({
|
|
10
10
|
apply,
|
|
11
11
|
fetcher,
|
|
@@ -15,8 +15,8 @@ const usePsOptimisticSave = ({ fetcher, isSuccess, onError, revalidator, rows, s
|
|
|
15
15
|
rows,
|
|
16
16
|
});
|
|
17
17
|
const { submit } = optimistic;
|
|
18
|
-
const save = (0, react_1.useCallback)((values, existingId) => submit(
|
|
19
|
-
const remove = (0, react_1.useCallback)((ids) => submit(
|
|
18
|
+
const save = (0, react_1.useCallback)((values, existingId) => submit(ps_utilities_1.PsOptimisticSaveService.saveValues(spec, values, existingId, scopeId)), [scopeId, spec, submit]);
|
|
19
|
+
const remove = (0, react_1.useCallback)((ids) => submit(ps_utilities_1.PsOptimisticSaveService.removeValues(spec, ids)), [spec, submit]);
|
|
20
20
|
return { remove, rows: optimistic.rows, save };
|
|
21
21
|
};
|
|
22
22
|
exports.usePsOptimisticSave = usePsOptimisticSave;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePsTextParam = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const react_2 = require("@pallasoft/ps-utilities/react");
|
|
5
6
|
const ps_query_param_config_1 = require("../constants/ps-query-param-config");
|
|
6
7
|
const ps_query_param_service_1 = require("../services/ps-query-param-service");
|
|
7
|
-
const use_ps_debounced_value_1 = require("./use-ps-debounced-value");
|
|
8
8
|
const usePsTextParam = ([searchParams, setSearchParams], { debounceMs, name, resetParams }) => {
|
|
9
9
|
const raw = searchParams.get(name);
|
|
10
10
|
const committed = raw === null ? '' : raw;
|
|
11
11
|
const [value, setValue] = (0, react_1.useState)(committed);
|
|
12
|
-
const settled = (0,
|
|
12
|
+
const settled = (0, react_2.usePsDebouncedValue)(value, debounceMs);
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
14
14
|
if (settled === committed)
|
|
15
15
|
return;
|
package/dist/index.d.ts
CHANGED
|
@@ -90,21 +90,13 @@ export * from './interfaces/ps-component-props';
|
|
|
90
90
|
export * from './models/ps-element-size';
|
|
91
91
|
export * from './models/ps-voice-orb';
|
|
92
92
|
export * from './models/ps-navigation-progress';
|
|
93
|
-
export * from './hooks/use-ps-debounced-value';
|
|
94
|
-
export * from './hooks/use-ps-change-queue';
|
|
95
|
-
export * from './interfaces/ps-change-queue-input';
|
|
96
|
-
export * from './interfaces/ps-change-queue-result';
|
|
97
93
|
export * from './hooks/use-ps-live';
|
|
98
94
|
export * from './hooks/use-ps-debounced-revalidate';
|
|
99
|
-
export * from './hooks/use-ps-optimistic-rows';
|
|
100
95
|
export * from './hooks/use-ps-optimistic-fetcher';
|
|
101
96
|
export * from './hooks/use-ps-optimistic-save';
|
|
102
|
-
export * from './constants/ps-optimistic-config';
|
|
103
97
|
export * from './interfaces/ps-optimistic-save-input';
|
|
104
98
|
export * from './interfaces/ps-optimistic-save-result';
|
|
105
|
-
export * from './interfaces/ps-optimistic-save-spec';
|
|
106
99
|
export * from './interfaces/ps-revalidation-args';
|
|
107
|
-
export * from './services/ps-optimistic-save-service';
|
|
108
100
|
export * from './services/ps-client-param-revalidation-service';
|
|
109
101
|
export * from './interfaces/ps-fetcher-like';
|
|
110
102
|
export * from './interfaces/ps-fetcher-submit-options';
|
|
@@ -114,10 +106,7 @@ export * from './interfaces/ps-live-open-options';
|
|
|
114
106
|
export * from './interfaces/ps-optimistic-fetcher-input';
|
|
115
107
|
export * from './interfaces/ps-optimistic-fetcher-result';
|
|
116
108
|
export * from './interfaces/ps-optimistic-failure';
|
|
117
|
-
export * from './interfaces/ps-optimistic-failure-reason';
|
|
118
109
|
export * from './interfaces/ps-revalidator-like';
|
|
119
|
-
export * from './interfaces/ps-optimistic-rows-input';
|
|
120
|
-
export * from './interfaces/ps-optimistic-rows-result';
|
|
121
110
|
export * from './hooks/use-ps-navigation-progress';
|
|
122
111
|
export * from './models/ps-draggable-grid';
|
|
123
112
|
export * from './constants/ps-draggable-grid';
|
|
@@ -132,7 +121,6 @@ export * from './constants/ps-data-boundary-variant';
|
|
|
132
121
|
export * from './hooks/use-ps-retained-promise';
|
|
133
122
|
export * from './hooks/use-ps-promise-value';
|
|
134
123
|
export * from './interfaces/ps-retained-promise-data';
|
|
135
|
-
export * from './services/ps-deep-equal-service';
|
|
136
124
|
export * from './components/ps-faq-answer';
|
|
137
125
|
export * from './components/ps-feature-grid';
|
|
138
126
|
export * from './components/ps-feature-card';
|
|
@@ -258,3 +246,5 @@ export * from './constants/ps-image-config';
|
|
|
258
246
|
export * from './models/ps-image-state-data';
|
|
259
247
|
export * from './services/ps-image-service';
|
|
260
248
|
export * from './components/ps-image';
|
|
249
|
+
export { PsDeepEqualService, PsOptimisticConfig, PsOptimisticSaveService, type PsOptimisticFailureReason, type PsOptimisticSaveSpec, } from '@pallasoft/ps-utilities';
|
|
250
|
+
export { usePsChangeQueue, usePsDebouncedValue, usePsOptimisticRows, type PsChangeQueueInput, type PsChangeQueueResult, type PsOptimisticRowsInput, type PsOptimisticRowsResult, } from '@pallasoft/ps-utilities/react';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.usePsOptimisticRows = exports.usePsDebouncedValue = exports.usePsChangeQueue = exports.PsOptimisticSaveService = exports.PsOptimisticConfig = exports.PsDeepEqualService = void 0;
|
|
17
18
|
__exportStar(require("./components/ps-layer"), exports);
|
|
18
19
|
__exportStar(require("./components/ps-accordion"), exports);
|
|
19
20
|
__exportStar(require("./components/ps-action-tile"), exports);
|
|
@@ -106,21 +107,13 @@ __exportStar(require("./interfaces/ps-component-props"), exports);
|
|
|
106
107
|
__exportStar(require("./models/ps-element-size"), exports);
|
|
107
108
|
__exportStar(require("./models/ps-voice-orb"), exports);
|
|
108
109
|
__exportStar(require("./models/ps-navigation-progress"), exports);
|
|
109
|
-
__exportStar(require("./hooks/use-ps-debounced-value"), exports);
|
|
110
|
-
__exportStar(require("./hooks/use-ps-change-queue"), exports);
|
|
111
|
-
__exportStar(require("./interfaces/ps-change-queue-input"), exports);
|
|
112
|
-
__exportStar(require("./interfaces/ps-change-queue-result"), exports);
|
|
113
110
|
__exportStar(require("./hooks/use-ps-live"), exports);
|
|
114
111
|
__exportStar(require("./hooks/use-ps-debounced-revalidate"), exports);
|
|
115
|
-
__exportStar(require("./hooks/use-ps-optimistic-rows"), exports);
|
|
116
112
|
__exportStar(require("./hooks/use-ps-optimistic-fetcher"), exports);
|
|
117
113
|
__exportStar(require("./hooks/use-ps-optimistic-save"), exports);
|
|
118
|
-
__exportStar(require("./constants/ps-optimistic-config"), exports);
|
|
119
114
|
__exportStar(require("./interfaces/ps-optimistic-save-input"), exports);
|
|
120
115
|
__exportStar(require("./interfaces/ps-optimistic-save-result"), exports);
|
|
121
|
-
__exportStar(require("./interfaces/ps-optimistic-save-spec"), exports);
|
|
122
116
|
__exportStar(require("./interfaces/ps-revalidation-args"), exports);
|
|
123
|
-
__exportStar(require("./services/ps-optimistic-save-service"), exports);
|
|
124
117
|
__exportStar(require("./services/ps-client-param-revalidation-service"), exports);
|
|
125
118
|
__exportStar(require("./interfaces/ps-fetcher-like"), exports);
|
|
126
119
|
__exportStar(require("./interfaces/ps-fetcher-submit-options"), exports);
|
|
@@ -130,10 +123,7 @@ __exportStar(require("./interfaces/ps-live-open-options"), exports);
|
|
|
130
123
|
__exportStar(require("./interfaces/ps-optimistic-fetcher-input"), exports);
|
|
131
124
|
__exportStar(require("./interfaces/ps-optimistic-fetcher-result"), exports);
|
|
132
125
|
__exportStar(require("./interfaces/ps-optimistic-failure"), exports);
|
|
133
|
-
__exportStar(require("./interfaces/ps-optimistic-failure-reason"), exports);
|
|
134
126
|
__exportStar(require("./interfaces/ps-revalidator-like"), exports);
|
|
135
|
-
__exportStar(require("./interfaces/ps-optimistic-rows-input"), exports);
|
|
136
|
-
__exportStar(require("./interfaces/ps-optimistic-rows-result"), exports);
|
|
137
127
|
__exportStar(require("./hooks/use-ps-navigation-progress"), exports);
|
|
138
128
|
__exportStar(require("./models/ps-draggable-grid"), exports);
|
|
139
129
|
__exportStar(require("./constants/ps-draggable-grid"), exports);
|
|
@@ -148,7 +138,6 @@ __exportStar(require("./constants/ps-data-boundary-variant"), exports);
|
|
|
148
138
|
__exportStar(require("./hooks/use-ps-retained-promise"), exports);
|
|
149
139
|
__exportStar(require("./hooks/use-ps-promise-value"), exports);
|
|
150
140
|
__exportStar(require("./interfaces/ps-retained-promise-data"), exports);
|
|
151
|
-
__exportStar(require("./services/ps-deep-equal-service"), exports);
|
|
152
141
|
__exportStar(require("./components/ps-faq-answer"), exports);
|
|
153
142
|
__exportStar(require("./components/ps-feature-grid"), exports);
|
|
154
143
|
__exportStar(require("./components/ps-feature-card"), exports);
|
|
@@ -274,3 +263,11 @@ __exportStar(require("./constants/ps-image-config"), exports);
|
|
|
274
263
|
__exportStar(require("./models/ps-image-state-data"), exports);
|
|
275
264
|
__exportStar(require("./services/ps-image-service"), exports);
|
|
276
265
|
__exportStar(require("./components/ps-image"), exports);
|
|
266
|
+
var ps_utilities_1 = require("@pallasoft/ps-utilities");
|
|
267
|
+
Object.defineProperty(exports, "PsDeepEqualService", { enumerable: true, get: function () { return ps_utilities_1.PsDeepEqualService; } });
|
|
268
|
+
Object.defineProperty(exports, "PsOptimisticConfig", { enumerable: true, get: function () { return ps_utilities_1.PsOptimisticConfig; } });
|
|
269
|
+
Object.defineProperty(exports, "PsOptimisticSaveService", { enumerable: true, get: function () { return ps_utilities_1.PsOptimisticSaveService; } });
|
|
270
|
+
var react_1 = require("@pallasoft/ps-utilities/react");
|
|
271
|
+
Object.defineProperty(exports, "usePsChangeQueue", { enumerable: true, get: function () { return react_1.usePsChangeQueue; } });
|
|
272
|
+
Object.defineProperty(exports, "usePsDebouncedValue", { enumerable: true, get: function () { return react_1.usePsDebouncedValue; } });
|
|
273
|
+
Object.defineProperty(exports, "usePsOptimisticRows", { enumerable: true, get: function () { return react_1.usePsOptimisticRows; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { PsOptimisticSaveSpec } from '@pallasoft/ps-utilities';
|
|
1
2
|
import type { PsFetcherLike } from './ps-fetcher-like';
|
|
2
3
|
import type { PsOptimisticFailure } from './ps-optimistic-failure';
|
|
3
|
-
import type { PsOptimisticSaveSpec } from './ps-optimistic-save-spec';
|
|
4
4
|
import type { PsRevalidatorLike } from './ps-revalidator-like';
|
|
5
5
|
export interface PsOptimisticSaveInput<Row, Values, Data> {
|
|
6
6
|
fetcher: PsFetcherLike<Data>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PsDraftStateService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ps_utilities_1 = require("@pallasoft/ps-utilities");
|
|
5
5
|
class PsDraftStateService {
|
|
6
6
|
static fresh(initial) {
|
|
7
7
|
return { baseline: initial, value: structuredClone(initial) };
|
|
@@ -9,7 +9,7 @@ class PsDraftStateService {
|
|
|
9
9
|
static isEqual(left, right, options) {
|
|
10
10
|
if (options !== undefined && options.isEqual !== undefined)
|
|
11
11
|
return options.isEqual(left, right);
|
|
12
|
-
return
|
|
12
|
+
return ps_utilities_1.PsDeepEqualService.isEqual(left, right);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.PsDraftStateService = PsDraftStateService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pallasoft/ps-core-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.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.
|
|
51
|
+
"@pallasoft/ps-utilities": "^2.29.0",
|
|
52
52
|
"@portabletext/react": "^3.2.4",
|
|
53
53
|
"@portabletext/types": "^2.0.13",
|
|
54
54
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
-
export const usePsChangeQueue = ({ onDrained, onFailed, send, }) => {
|
|
3
|
-
const pending = useRef([]);
|
|
4
|
-
const isRunning = useRef(false);
|
|
5
|
-
const latest = useRef({ onDrained, onFailed, send });
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
latest.current = { onDrained, onFailed, send };
|
|
8
|
-
}, [onDrained, onFailed, send]);
|
|
9
|
-
const run = useCallback(async () => {
|
|
10
|
-
if (isRunning.current)
|
|
11
|
-
return;
|
|
12
|
-
isRunning.current = true;
|
|
13
|
-
await Promise.resolve();
|
|
14
|
-
while (pending.current.length > 0) {
|
|
15
|
-
const batch = pending.current;
|
|
16
|
-
pending.current = [];
|
|
17
|
-
await new Promise((resolve) => resolve(latest.current.send(batch))).catch(() => {
|
|
18
|
-
const dropped = pending.current;
|
|
19
|
-
pending.current = [];
|
|
20
|
-
try {
|
|
21
|
-
latest.current.onFailed(batch, dropped);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
isRunning.current = false;
|
|
29
|
-
latest.current.onDrained();
|
|
30
|
-
}, []);
|
|
31
|
-
const enqueue = useCallback((change) => {
|
|
32
|
-
pending.current = [...pending.current, change];
|
|
33
|
-
void run();
|
|
34
|
-
}, [run]);
|
|
35
|
-
return { enqueue };
|
|
36
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Client } from '@pallasoft/ps-utilities';
|
|
3
|
-
export const usePsDebouncedValue = (value, waitMs) => {
|
|
4
|
-
const [settled, setSettled] = useState(value);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const debounced = Client.DebounceService.create((next) => setSettled(next), waitMs);
|
|
7
|
-
debounced.run(value);
|
|
8
|
-
return debounced.cancel;
|
|
9
|
-
}, [value, waitMs]);
|
|
10
|
-
return settled;
|
|
11
|
-
};
|