🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@isoftdata/svelte-report-job-modal

Package Overview
Dependencies
Maintainers
12
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/svelte-report-job-modal

This component is a modal for selecting a report, and printing, emailing, and previewing said report.

latest
npmnpm
Version
2.1.2
Version published
Weekly downloads
86
-7.53%
Maintainers
12
Weekly downloads
 
Created
Source

Svelte ReportJobModal

This component is a modal for selecting a report, and printing, emailing, and previewing said report.

A screenshot of the modal

You should use it by calling the component's open or prompt method with a print job or array of print jobs, and any options that may apply.

Screenshot of the attachment component

Install

pnpm i @isoftdata/svelte-report-job-modal

Breaking changes

2.0.0

  • Require Svelte 5
  • Events -> Callbacks

Props

NameTypeDescriptionDefault Value
favoriteReportNamesArray<string>Array of favorite report names. Clicking on the star icon in the modal will add to/subtract from this list.[]
showPrintbooleanWhether to show the print optiontrue
showEmailbooleanWhether to show the email optiontrue
showPreviewbooleanWhether to show the preview optiontrue
showFavoriteButtonbooleanWhether to show the favorite report buttontrue
loadReports(reportType: string) => Promise<Array<Report>>Function to load reports based on the report type. Returns a Promise that resolves to a ReportRequired
loadPrinters(reportType: string) => Promise<Array<Printer>>Function to load printers based on the report type. Returns a Promise that resolves to a PrinterRequired
loadDefaultPrinter(reportType: string) => Promise<string>Function to load the default printer name based on the report typeRequired
generatePdfPreview(args: { id: number; name: string; type: string; parameters: Record<string, string> }) => Promise<{ data: string; mimeType: string; }>Function to generate a PDF preview for a reportRequired
saveReportJobs(printJobs: Array<ReportJob>) => Promise<void>Function to save report jobs. Takes an array of ReportJobs as input.Required
savePrinterPreference(printerName: string, reportType: string) => Promise<void>Function to save the printer preference for a report typeRequired

Callbacks

  • confirm - Called when "Print" or "Email" is clicked
    • single argument is the action that was taken - either EMAIL or PRINT
  • close - Called when either "Cancel" or "x" is clicked

Methods

  • open - Opens the modal with a print job or array of print jobs, and any options that may apply. Takes the following arguments:
    • printJobOrJobs - A ReportJob or array of ReportJobs to print/email/preview
    • options - An object with the following optional properties:
export type OpenOptions = {
	emails?: Array<string>
	disablePrintQuantity?: boolean
	showPrint?: boolean
	showEmail?: boolean
	showPreview?: boolean
	showFavoriteButton?: boolean
}
  • prompt(...args: Parameters<typeof open>) => Promise<boolean> - Accepts the exact same arguments as the open method. This method opens the modal and returns a promise that resolves once the user has completed their work. Return is true if the Print/Download/Email button is clicked, or false if the modal is closed/cancelled.

Types

There's some types you might need to use. They're declared at the top of ReportJobModal.svelte

Report

export type Report = {
	id: number
	type: string
	name: string
}

Printer

export type Printer = {
	name: string
	displayName?: string | null
	reportType?: string | null
}

ReportJob

export type ReportJob = {
	reportId?: number
	type: string
	name: string
	quantity: number
	sourceType: 'CRYSTAL' | 'QUERY'
	destinationType: 'DIRECTORY' | 'EMAIL' | 'EMAILCSV' | 'PRINTER'
	destination: string
	parameters: Record<string, string>
	// email
	title?: string
	emailBcc?: string
	emailSubject?: string
	emailBody?: string
	emailFrom?: string
}

Example

<script lang="ts">
	import ReportJobModal from '@isoftdata/svelte-report-job-modal'

	let reportJobModal: ReportJobModal

	function print() {
		reportJobModal.open({
			type: 'Work Order',
			parameters: {
				workorderid: '29760',
			},
		})
	}
</script>

<Button
	class="w-100"
	iconClass="print"
	on:click={() => print()}>Print</Button
>

<ReportJobModal
	loadReports={reportType => Promise.resolve(reports.filter(report => report.type === reportType))}
	loadPrinters={() => Promise.resolve(printers)}
	loadDefaultPrinter={() => Promise.resolve(printers[0].name)}
	saveReportJobs={() => Promise.resolve()}
	savePrinterPreference={() => Promise.resolve()}
	{generatePdfPreview}
	bind:favoriteReportNames
	bind:this={reportJobModal}
	close={() => console.log('close')}
	confirm={type => console.log(type)}
></ReportJobModal>

FAQs

Package last updated on 14 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts