@pallasoft/ps-table-components 1.13.2 → 1.14.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-table.js +6 -2
- package/dist/components/ps-table-toolbar.js +1 -1
- package/dist/constants/table-column-size.d.ts +11 -0
- package/dist/constants/table-column-size.js +21 -0
- package/dist/esm/components/ps-data-table.js +6 -2
- package/dist/esm/components/ps-table-toolbar.js +1 -1
- package/dist/esm/constants/table-column-size.js +18 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/services/ps-table-column-size-service.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces/table-column.d.ts +2 -0
- package/dist/services/ps-table-column-size-service.d.ts +6 -0
- package/dist/services/ps-table-column-size-service.js +21 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
|
8
8
|
const ps_input_components_1 = require("@pallasoft/ps-input-components");
|
|
9
9
|
const ps_motion_components_1 = require("@pallasoft/ps-motion-components");
|
|
10
10
|
const table_config_1 = require("../constants/table-config");
|
|
11
|
+
const ps_table_column_size_service_1 = require("../services/ps-table-column-size-service");
|
|
11
12
|
const ps_table_group_service_1 = require("../services/ps-table-group-service");
|
|
12
13
|
const ps_table_query_service_1 = require("../services/ps-table-query-service");
|
|
13
14
|
const ps_table_bulk_bar_1 = require("./ps-table-bulk-bar");
|
|
@@ -27,7 +28,10 @@ const densityClassNames = {
|
|
|
27
28
|
head: 'px-5 py-3.5',
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
|
-
const columnStyle = (column) =>
|
|
31
|
+
const columnStyle = (column) => ({
|
|
32
|
+
minWidth: ps_table_column_size_service_1.PsTableColumnSizeService.minWidthOf(column),
|
|
33
|
+
width: column.width,
|
|
34
|
+
});
|
|
31
35
|
const alignClassNames = {
|
|
32
36
|
center: 'text-center',
|
|
33
37
|
left: 'text-left',
|
|
@@ -184,7 +188,7 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
|
|
|
184
188
|
? grouping.renderGroupSummary(group.rows)
|
|
185
189
|
: undefined }), (0, jsx_runtime_1.jsx)(ps_motion_components_1.PsCollapse, { isOpen: isExpanded && !closingGroupKeys.includes(group.key), children: renderCardList(group.rows, null) })] }, `group-${group.key}`));
|
|
186
190
|
})
|
|
187
|
-
: renderCardList(visibleRows, visibleRows.length === 0 && isQueried ? ((0, jsx_runtime_1.jsxs)("div", { className: 'px-4 py-10 text-center', children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring mt-2 rounded-full px-3 py-1.5 text-sm font-semibold text-primary', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null) })) : null, (0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto', mobileLayout === 'cards' ? 'hidden sm:block' : ''), children: (0, jsx_runtime_1.jsxs)("table", { className: ps_design_system_1.PallasoftClassNameService.merge('w-full border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? (0, jsx_runtime_1.jsx)("caption", { className: 'sr-only', children: caption }) : null, (0, jsx_runtime_1.jsx)("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: (0, jsx_runtime_1.jsxs)("tr", { children: [isSelectable ? ((0, jsx_runtime_1.jsx)("th", { className: 'w-10 pl-4 pr-0', scope: 'col', children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIds.includes(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column) => {
|
|
191
|
+
: renderCardList(visibleRows, visibleRows.length === 0 && isQueried ? ((0, jsx_runtime_1.jsxs)("div", { className: 'px-4 py-10 text-center', children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring mt-2 rounded-full px-3 py-1.5 text-sm font-semibold text-primary', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null) })) : null, (0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto overflow-y-hidden', mobileLayout === 'cards' ? 'hidden sm:block' : ''), children: (0, jsx_runtime_1.jsxs)("table", { className: ps_design_system_1.PallasoftClassNameService.merge('w-full min-w-max border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? (0, jsx_runtime_1.jsx)("caption", { className: 'sr-only', children: caption }) : null, (0, jsx_runtime_1.jsx)("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: (0, jsx_runtime_1.jsxs)("tr", { children: [isSelectable ? ((0, jsx_runtime_1.jsx)("th", { className: 'w-10 pl-4 pr-0', scope: 'col', children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIds.includes(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column) => {
|
|
188
192
|
const align = column.align !== null && column.align !== undefined ? column.align : 'left';
|
|
189
193
|
const isSorted = sort !== null && sort.columnId === column.id;
|
|
190
194
|
return ((0, jsx_runtime_1.jsx)("th", { "aria-sort": isSorted
|
|
@@ -13,6 +13,6 @@ const PsTableToolbar = ({ actions, columns, filters, isSearchable, onClearFilter
|
|
|
13
13
|
const filterableColumns = columns.filter((column) => column.filter);
|
|
14
14
|
const zIndex = (0, ps_core_components_1.usePsLayerZIndex)(ps_design_system_1.PallasoftZIndex.Dropdown);
|
|
15
15
|
const activeCount = filterableColumns.filter((column) => ps_table_query_service_1.PsTableQueryService.isActive(filters[column.id])).length;
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? ((0, jsx_runtime_1.jsxs)("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [(0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: searchPlaceholder }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: ps_icons_1.PsIconKey.Search }), (0, jsx_runtime_1.jsx)("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 items-center gap-2 overflow-x-auto sm:w-auto
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? ((0, jsx_runtime_1.jsxs)("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [(0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: searchPlaceholder }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: ps_icons_1.PsIconKey.Search }), (0, jsx_runtime_1.jsx)("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 flex-1 items-center gap-2 overflow-x-auto sm:w-auto', children: [filterableColumns.length > 0 ? ((0, jsx_runtime_1.jsxs)(react_aria_components_1.DialogTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: toolbarButtonClassName, children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Filter }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: "Filters" }), activeCount > 0 ? ((0, jsx_runtime_1.jsx)("span", { className: 'inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-[color:var(--ps-color-primary-contrast)]', children: activeCount })) : null] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: 'ps-floating-panel ps-scrollbar-hidden max-h-[min(34rem,80vh)] w-[min(22rem,calc(100vw-2rem))] overflow-y-auto outline-none', offset: 6, placement: 'bottom start', style: { zIndex }, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": 'Filters', className: 'flex flex-col gap-4 p-4 outline-none', children: (0, jsx_runtime_1.jsxs)(ps_core_components_1.PsLayer, { zIndex: zIndex, children: [filterableColumns.map((column) => ((0, jsx_runtime_1.jsx)(ps_table_filter_field_1.PsTableFilterField, { kind: column.filter ? column.filter.kind : 'text', label: column.label, onChange: (value) => onFilterChange(column.id, value), options: ps_table_query_service_1.PsTableQueryService.options(rows, column), value: filters[column.id] ? filters[column.id] : {} }, column.id))), (0, jsx_runtime_1.jsx)("div", { className: 'flex justify-end border-t border-line pt-3', children: (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring rounded-lg px-2 py-1 text-sm font-semibold text-ink/65 hover:text-ink disabled:opacity-40', disabled: activeCount === 0, onClick: onClearFilters, type: 'button', children: "Clear all" }) })] }) }) })] })) : null, activeCount > 0 ? ((0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring rounded-full px-3 py-2 text-sm font-semibold text-ink/65 hover:text-ink'), onClick: onClearFilters, type: 'button', children: "Clear filters" })) : null, actions ? (0, jsx_runtime_1.jsx)("div", { className: 'ml-auto flex shrink-0 items-center gap-2', children: actions }) : null] })] }));
|
|
17
17
|
};
|
|
18
18
|
exports.PsTableToolbar = PsTableToolbar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PsTableColumnSize: {
|
|
2
|
+
readonly amount: "amount";
|
|
3
|
+
readonly compact: "compact";
|
|
4
|
+
readonly date: "date";
|
|
5
|
+
readonly identifier: "identifier";
|
|
6
|
+
readonly status: "status";
|
|
7
|
+
readonly text: "text";
|
|
8
|
+
readonly wide: "wide";
|
|
9
|
+
};
|
|
10
|
+
export type PsTableColumnSize = (typeof PsTableColumnSize)[keyof typeof PsTableColumnSize];
|
|
11
|
+
export declare const PsTableColumnWidths: Record<PsTableColumnSize, string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsTableColumnWidths = exports.PsTableColumnSize = void 0;
|
|
4
|
+
exports.PsTableColumnSize = {
|
|
5
|
+
amount: 'amount',
|
|
6
|
+
compact: 'compact',
|
|
7
|
+
date: 'date',
|
|
8
|
+
identifier: 'identifier',
|
|
9
|
+
status: 'status',
|
|
10
|
+
text: 'text',
|
|
11
|
+
wide: 'wide',
|
|
12
|
+
};
|
|
13
|
+
exports.PsTableColumnWidths = {
|
|
14
|
+
amount: '8.5rem',
|
|
15
|
+
compact: '6rem',
|
|
16
|
+
date: '7.5rem',
|
|
17
|
+
identifier: '9rem',
|
|
18
|
+
status: '8rem',
|
|
19
|
+
text: '12rem',
|
|
20
|
+
wide: '18rem',
|
|
21
|
+
};
|
|
@@ -5,6 +5,7 @@ import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
|
5
5
|
import { PsCheckbox } from '@pallasoft/ps-input-components';
|
|
6
6
|
import { PsCollapse } from '@pallasoft/ps-motion-components';
|
|
7
7
|
import { PsTableConfig } from '../constants/table-config';
|
|
8
|
+
import { PsTableColumnSizeService } from '../services/ps-table-column-size-service';
|
|
8
9
|
import { PsTableGroupService } from '../services/ps-table-group-service';
|
|
9
10
|
import { PsTableQueryService } from '../services/ps-table-query-service';
|
|
10
11
|
import { PsTableBulkBar } from './ps-table-bulk-bar';
|
|
@@ -24,7 +25,10 @@ const densityClassNames = {
|
|
|
24
25
|
head: 'px-5 py-3.5',
|
|
25
26
|
},
|
|
26
27
|
};
|
|
27
|
-
const columnStyle = (column) =>
|
|
28
|
+
const columnStyle = (column) => ({
|
|
29
|
+
minWidth: PsTableColumnSizeService.minWidthOf(column),
|
|
30
|
+
width: column.width,
|
|
31
|
+
});
|
|
28
32
|
const alignClassNames = {
|
|
29
33
|
center: 'text-center',
|
|
30
34
|
left: 'text-left',
|
|
@@ -181,7 +185,7 @@ export const PsDataTable = ({ caption, className, columns, defaultSort, density
|
|
|
181
185
|
? grouping.renderGroupSummary(group.rows)
|
|
182
186
|
: undefined }), _jsx(PsCollapse, { isOpen: isExpanded && !closingGroupKeys.includes(group.key), children: renderCardList(group.rows, null) })] }, `group-${group.key}`));
|
|
183
187
|
})
|
|
184
|
-
: renderCardList(visibleRows, visibleRows.length === 0 && isQueried ? (_jsxs("div", { className: 'px-4 py-10 text-center', children: [_jsx("p", { className: 'text-sm font-semibold text-ink', children: PsTableConfig.noMatchesTitle }), _jsx("button", { className: 'ps-focus-ring mt-2 rounded-full px-3 py-1.5 text-sm font-semibold text-primary', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null) })) : null, _jsx("div", { className: PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto', mobileLayout === 'cards' ? 'hidden sm:block' : ''), children: _jsxs("table", { className: PallasoftClassNameService.merge('w-full border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? _jsx("caption", { className: 'sr-only', children: caption }) : null, _jsx("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: _jsxs("tr", { children: [isSelectable ? (_jsx("th", { className: 'w-10 pl-4 pr-0', scope: 'col', children: _jsx(PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIds.includes(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column) => {
|
|
188
|
+
: renderCardList(visibleRows, visibleRows.length === 0 && isQueried ? (_jsxs("div", { className: 'px-4 py-10 text-center', children: [_jsx("p", { className: 'text-sm font-semibold text-ink', children: PsTableConfig.noMatchesTitle }), _jsx("button", { className: 'ps-focus-ring mt-2 rounded-full px-3 py-1.5 text-sm font-semibold text-primary', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null) })) : null, _jsx("div", { className: PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto overflow-y-hidden', mobileLayout === 'cards' ? 'hidden sm:block' : ''), children: _jsxs("table", { className: PallasoftClassNameService.merge('w-full min-w-max border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? _jsx("caption", { className: 'sr-only', children: caption }) : null, _jsx("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: _jsxs("tr", { children: [isSelectable ? (_jsx("th", { className: 'w-10 pl-4 pr-0', scope: 'col', children: _jsx(PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIds.includes(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column) => {
|
|
185
189
|
const align = column.align !== null && column.align !== undefined ? column.align : 'left';
|
|
186
190
|
const isSorted = sort !== null && sort.columnId === column.id;
|
|
187
191
|
return (_jsx("th", { "aria-sort": isSorted
|
|
@@ -10,5 +10,5 @@ export const PsTableToolbar = ({ actions, columns, filters, isSearchable, onClea
|
|
|
10
10
|
const filterableColumns = columns.filter((column) => column.filter);
|
|
11
11
|
const zIndex = usePsLayerZIndex(PallasoftZIndex.Dropdown);
|
|
12
12
|
const activeCount = filterableColumns.filter((column) => PsTableQueryService.isActive(filters[column.id])).length;
|
|
13
|
-
return (_jsxs("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? (_jsxs("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [_jsx("span", { className: 'sr-only', children: searchPlaceholder }), _jsx(PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: PsIconKey.Search }), _jsx("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, _jsxs("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 items-center gap-2 overflow-x-auto sm:w-auto
|
|
13
|
+
return (_jsxs("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? (_jsxs("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [_jsx("span", { className: 'sr-only', children: searchPlaceholder }), _jsx(PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: PsIconKey.Search }), _jsx("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, _jsxs("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 flex-1 items-center gap-2 overflow-x-auto sm:w-auto', children: [filterableColumns.length > 0 ? (_jsxs(DialogTrigger, { children: [_jsxs(Button, { className: toolbarButtonClassName, children: [_jsx(PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: PsIconKey.Filter }), _jsx("span", { className: 'sr-only sm:not-sr-only', children: "Filters" }), activeCount > 0 ? (_jsx("span", { className: 'inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-[color:var(--ps-color-primary-contrast)]', children: activeCount })) : null] }), _jsx(Popover, { className: 'ps-floating-panel ps-scrollbar-hidden max-h-[min(34rem,80vh)] w-[min(22rem,calc(100vw-2rem))] overflow-y-auto outline-none', offset: 6, placement: 'bottom start', style: { zIndex }, children: _jsx(Dialog, { "aria-label": 'Filters', className: 'flex flex-col gap-4 p-4 outline-none', children: _jsxs(PsLayer, { zIndex: zIndex, children: [filterableColumns.map((column) => (_jsx(PsTableFilterField, { kind: column.filter ? column.filter.kind : 'text', label: column.label, onChange: (value) => onFilterChange(column.id, value), options: PsTableQueryService.options(rows, column), value: filters[column.id] ? filters[column.id] : {} }, column.id))), _jsx("div", { className: 'flex justify-end border-t border-line pt-3', children: _jsx("button", { className: 'ps-focus-ring rounded-lg px-2 py-1 text-sm font-semibold text-ink/65 hover:text-ink disabled:opacity-40', disabled: activeCount === 0, onClick: onClearFilters, type: 'button', children: "Clear all" }) })] }) }) })] })) : null, activeCount > 0 ? (_jsx("button", { className: PallasoftClassNameService.merge('ps-focus-ring rounded-full px-3 py-2 text-sm font-semibold text-ink/65 hover:text-ink'), onClick: onClearFilters, type: 'button', children: "Clear filters" })) : null, actions ? _jsx("div", { className: 'ml-auto flex shrink-0 items-center gap-2', children: actions }) : null] })] }));
|
|
14
14
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const PsTableColumnSize = {
|
|
2
|
+
amount: 'amount',
|
|
3
|
+
compact: 'compact',
|
|
4
|
+
date: 'date',
|
|
5
|
+
identifier: 'identifier',
|
|
6
|
+
status: 'status',
|
|
7
|
+
text: 'text',
|
|
8
|
+
wide: 'wide',
|
|
9
|
+
};
|
|
10
|
+
export const PsTableColumnWidths = {
|
|
11
|
+
amount: '8.5rem',
|
|
12
|
+
compact: '6rem',
|
|
13
|
+
date: '7.5rem',
|
|
14
|
+
identifier: '9rem',
|
|
15
|
+
status: '8rem',
|
|
16
|
+
text: '12rem',
|
|
17
|
+
wide: '18rem',
|
|
18
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './components/ps-data-table';
|
|
|
2
2
|
export * from './components/ps-table-group-header';
|
|
3
3
|
export * from './components/ps-table-pagination';
|
|
4
4
|
export * from './constants/table-card-role';
|
|
5
|
+
export * from './constants/table-column-size';
|
|
5
6
|
export * from './constants/table-filter-kind';
|
|
6
7
|
export * from './interfaces/table-column';
|
|
7
8
|
export * from './interfaces/table-column-filter';
|
|
@@ -12,6 +13,7 @@ export * from './interfaces/table-query';
|
|
|
12
13
|
export * from './interfaces/table-row-action';
|
|
13
14
|
export * from './interfaces/table-row-group';
|
|
14
15
|
export * from './interfaces/table-sort';
|
|
16
|
+
export * from './services/ps-table-column-size-service';
|
|
15
17
|
export * from './services/ps-table-group-service';
|
|
16
18
|
export * from './services/ps-table-query-service';
|
|
17
19
|
export * from './services/ps-table-search-service';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PsTableColumnSize, PsTableColumnWidths } from '../constants/table-column-size';
|
|
2
|
+
export class PsTableColumnSizeService {
|
|
3
|
+
static sizeOf(column) {
|
|
4
|
+
if (column.size !== undefined)
|
|
5
|
+
return column.size;
|
|
6
|
+
if (column.align === 'right')
|
|
7
|
+
return PsTableColumnSize.amount;
|
|
8
|
+
if (column.align === 'center')
|
|
9
|
+
return PsTableColumnSize.status;
|
|
10
|
+
return PsTableColumnSize.text;
|
|
11
|
+
}
|
|
12
|
+
static minWidthOf(column) {
|
|
13
|
+
if (column.minWidth !== undefined)
|
|
14
|
+
return column.minWidth;
|
|
15
|
+
return PsTableColumnWidths[PsTableColumnSizeService.sizeOf(column)];
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './components/ps-data-table';
|
|
|
2
2
|
export * from './components/ps-table-group-header';
|
|
3
3
|
export * from './components/ps-table-pagination';
|
|
4
4
|
export * from './constants/table-card-role';
|
|
5
|
+
export * from './constants/table-column-size';
|
|
5
6
|
export * from './constants/table-filter-kind';
|
|
6
7
|
export * from './interfaces/table-column';
|
|
7
8
|
export * from './interfaces/table-column-filter';
|
|
@@ -12,6 +13,7 @@ export * from './interfaces/table-query';
|
|
|
12
13
|
export * from './interfaces/table-row-action';
|
|
13
14
|
export * from './interfaces/table-row-group';
|
|
14
15
|
export * from './interfaces/table-sort';
|
|
16
|
+
export * from './services/ps-table-column-size-service';
|
|
15
17
|
export * from './services/ps-table-group-service';
|
|
16
18
|
export * from './services/ps-table-query-service';
|
|
17
19
|
export * from './services/ps-table-search-service';
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./components/ps-data-table"), exports);
|
|
|
18
18
|
__exportStar(require("./components/ps-table-group-header"), exports);
|
|
19
19
|
__exportStar(require("./components/ps-table-pagination"), exports);
|
|
20
20
|
__exportStar(require("./constants/table-card-role"), exports);
|
|
21
|
+
__exportStar(require("./constants/table-column-size"), exports);
|
|
21
22
|
__exportStar(require("./constants/table-filter-kind"), exports);
|
|
22
23
|
__exportStar(require("./interfaces/table-column"), exports);
|
|
23
24
|
__exportStar(require("./interfaces/table-column-filter"), exports);
|
|
@@ -28,6 +29,7 @@ __exportStar(require("./interfaces/table-query"), exports);
|
|
|
28
29
|
__exportStar(require("./interfaces/table-row-action"), exports);
|
|
29
30
|
__exportStar(require("./interfaces/table-row-group"), exports);
|
|
30
31
|
__exportStar(require("./interfaces/table-sort"), exports);
|
|
32
|
+
__exportStar(require("./services/ps-table-column-size-service"), exports);
|
|
31
33
|
__exportStar(require("./services/ps-table-group-service"), exports);
|
|
32
34
|
__exportStar(require("./services/ps-table-query-service"), exports);
|
|
33
35
|
__exportStar(require("./services/ps-table-search-service"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { PsTableCardRole } from '../constants/table-card-role';
|
|
3
|
+
import type { PsTableColumnSize } from '../constants/table-column-size';
|
|
3
4
|
import type { PsTableColumnFilter } from './table-column-filter';
|
|
4
5
|
export interface PsTableColumn<RowData> {
|
|
5
6
|
align?: 'center' | 'left' | 'right';
|
|
@@ -13,6 +14,7 @@ export interface PsTableColumn<RowData> {
|
|
|
13
14
|
label: string;
|
|
14
15
|
minWidth?: string;
|
|
15
16
|
render: (row: RowData) => ReactNode;
|
|
17
|
+
size?: PsTableColumnSize;
|
|
16
18
|
sortValue?: (row: RowData) => string | number | null;
|
|
17
19
|
width?: string;
|
|
18
20
|
wrap?: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PsTableColumnSize } from '../constants/table-column-size';
|
|
2
|
+
import type { PsTableColumn } from '../interfaces/table-column';
|
|
3
|
+
export declare class PsTableColumnSizeService {
|
|
4
|
+
static sizeOf<RowData>(column: PsTableColumn<RowData>): PsTableColumnSize;
|
|
5
|
+
static minWidthOf<RowData>(column: PsTableColumn<RowData>): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsTableColumnSizeService = void 0;
|
|
4
|
+
const table_column_size_1 = require("../constants/table-column-size");
|
|
5
|
+
class PsTableColumnSizeService {
|
|
6
|
+
static sizeOf(column) {
|
|
7
|
+
if (column.size !== undefined)
|
|
8
|
+
return column.size;
|
|
9
|
+
if (column.align === 'right')
|
|
10
|
+
return table_column_size_1.PsTableColumnSize.amount;
|
|
11
|
+
if (column.align === 'center')
|
|
12
|
+
return table_column_size_1.PsTableColumnSize.status;
|
|
13
|
+
return table_column_size_1.PsTableColumnSize.text;
|
|
14
|
+
}
|
|
15
|
+
static minWidthOf(column) {
|
|
16
|
+
if (column.minWidth !== undefined)
|
|
17
|
+
return column.minWidth;
|
|
18
|
+
return table_column_size_1.PsTableColumnWidths[PsTableColumnSizeService.sizeOf(column)];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.PsTableColumnSizeService = PsTableColumnSizeService;
|