@pallasoft/ps-table-components 1.17.1 → 1.18.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.
@@ -0,0 +1,5 @@
1
+ export interface PsTableExportButtonProps {
2
+ label: string;
3
+ onExport: () => void;
4
+ }
5
+ export declare const PsTableExportButton: ({ label, onExport }: PsTableExportButtonProps) => import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableExportButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ps_icons_1 = require("@pallasoft/ps-icons");
6
+ const PsTableExportButton = ({ label, onExport }) => ((0, jsx_runtime_1.jsxs)("button", { className: 'ps-focus-ring ps-liquid ps-liquid-control inline-flex min-h-10 min-w-10 items-center justify-center gap-2 rounded-full px-3 text-sm font-semibold text-ink transition-colors hover:border-primary/40 sm:px-4', onClick: onExport, type: 'button', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Download }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: label })] }));
7
+ exports.PsTableExportButton = PsTableExportButton;
@@ -0,0 +1,4 @@
1
+ export declare const PsTableDownloadConfig: {
2
+ csvExtension: string;
3
+ csvMimeType: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableDownloadConfig = void 0;
4
+ exports.PsTableDownloadConfig = {
5
+ csvExtension: '.csv',
6
+ csvMimeType: 'text/csv;charset=utf-8',
7
+ };
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PsIcon, PsIconKey } from '@pallasoft/ps-icons';
3
+ export const PsTableExportButton = ({ label, onExport }) => (_jsxs("button", { className: 'ps-focus-ring ps-liquid ps-liquid-control inline-flex min-h-10 min-w-10 items-center justify-center gap-2 rounded-full px-3 text-sm font-semibold text-ink transition-colors hover:border-primary/40 sm:px-4', onClick: onExport, type: 'button', children: [_jsx(PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: PsIconKey.Download }), _jsx("span", { className: 'sr-only sm:not-sr-only', children: label })] }));
@@ -0,0 +1,4 @@
1
+ export const PsTableDownloadConfig = {
2
+ csvExtension: '.csv',
3
+ csvMimeType: 'text/csv;charset=utf-8',
4
+ };
package/dist/esm/index.js CHANGED
@@ -26,3 +26,6 @@ export * from './services/ps-table-group-service';
26
26
  export * from './services/ps-table-query-service';
27
27
  export * from './services/ps-table-search-service';
28
28
  export * from './services/ps-table-stream-service';
29
+ export * from './components/ps-table-export-button';
30
+ export * from './constants/ps-table-download-config';
31
+ export * from './services/ps-table-download-service';
@@ -0,0 +1,12 @@
1
+ import { PsTableDownloadConfig } from '../constants/ps-table-download-config';
2
+ export class PsTableDownloadService {
3
+ static downloadCsv(fileName, content) {
4
+ const blob = new Blob([content], { type: PsTableDownloadConfig.csvMimeType });
5
+ const url = URL.createObjectURL(blob);
6
+ const link = document.createElement('a');
7
+ link.href = url;
8
+ link.download = `${fileName}${PsTableDownloadConfig.csvExtension}`;
9
+ link.click();
10
+ URL.revokeObjectURL(url);
11
+ }
12
+ }
package/dist/index.d.ts CHANGED
@@ -26,3 +26,6 @@ export * from './services/ps-table-group-service';
26
26
  export * from './services/ps-table-query-service';
27
27
  export * from './services/ps-table-search-service';
28
28
  export * from './services/ps-table-stream-service';
29
+ export * from './components/ps-table-export-button';
30
+ export * from './constants/ps-table-download-config';
31
+ export * from './services/ps-table-download-service';
package/dist/index.js CHANGED
@@ -42,3 +42,6 @@ __exportStar(require("./services/ps-table-group-service"), exports);
42
42
  __exportStar(require("./services/ps-table-query-service"), exports);
43
43
  __exportStar(require("./services/ps-table-search-service"), exports);
44
44
  __exportStar(require("./services/ps-table-stream-service"), exports);
45
+ __exportStar(require("./components/ps-table-export-button"), exports);
46
+ __exportStar(require("./constants/ps-table-download-config"), exports);
47
+ __exportStar(require("./services/ps-table-download-service"), exports);
@@ -0,0 +1,3 @@
1
+ export declare class PsTableDownloadService {
2
+ static downloadCsv(fileName: string, content: string): void;
3
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableDownloadService = void 0;
4
+ const ps_table_download_config_1 = require("../constants/ps-table-download-config");
5
+ class PsTableDownloadService {
6
+ static downloadCsv(fileName, content) {
7
+ const blob = new Blob([content], { type: ps_table_download_config_1.PsTableDownloadConfig.csvMimeType });
8
+ const url = URL.createObjectURL(blob);
9
+ const link = document.createElement('a');
10
+ link.href = url;
11
+ link.download = `${fileName}${ps_table_download_config_1.PsTableDownloadConfig.csvExtension}`;
12
+ link.click();
13
+ URL.revokeObjectURL(url);
14
+ }
15
+ }
16
+ exports.PsTableDownloadService = PsTableDownloadService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-table-components",
3
- "version": "1.17.1",
3
+ "version": "1.18.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",