{ "version": 3, "sources": ["external-global:@serenity-is/corelib/q", "external-global:@serenity-is/corelib", "../Modules/index.ts", "../Modules/ServerTypes/Extensions/UserPreferenceRow.ts", "../Modules/ServerTypes/Extensions/UserPreferenceService.ts", "../Modules/BulkActions/BasicProgressDialog.ts", "../Modules/BulkActions/BulkServiceAction.ts", "../Modules/ExportImport/ExcelExportHelper.ts", "../Modules/ExportImport/PdfExportHelper.ts", "../Modules/Formatters/EnumSelectFormatter.ts", "../Modules/Formatters/SingleLineTextFormatter.ts", "../Modules/GridEditor/GridEditorBase.ts", "../Modules/GridEditor/GridEditorDialog.ts", "../Modules/Reporting/ReportDialog.ts", "../Modules/Reporting/ReportHelper.ts", "../Modules/Reporting/ReportPage.ts", "../Modules/UserPreference/UserPreferenceStorage.ts", "../Modules/Widgets/DialogUtils.ts", "../Modules/Widgets/PromptDialog.ts", "../Modules/Widgets/SelectableEntityGrid.ts", "../Modules/Widgets/ServiceEditorBase.ts", "../Modules/Widgets/StaticTextBlock.ts"], "sourcesContent": ["module.exports = Q;", "module.exports = Serenity;", "export * from \"./ServerTypes/Extensions\";\nexport * from \"./ServerTypes/Reporting\";\nexport * from \"./BulkActions/BasicProgressDialog\";\nexport * from \"./BulkActions/BulkServiceAction\";\nexport * from \"./ExportImport/ExcelExportHelper\";\nexport * from \"./ExportImport/JsPdfAutoTable\";\nexport * from \"./ExportImport/PdfExportHelper\";\nexport * from \"./Formatters/EnumSelectFormatter\";\nexport * from \"./Formatters/SingleLineTextFormatter\";\nexport * from \"./GridEditor/GridEditorBase\";\nexport * from \"./GridEditor/GridEditorDialog\";\nexport * from \"./Reporting/ReportDialog\";\nexport * from \"./Reporting/ReportHelper\";\nexport * from \"./Reporting/ReportPage\";\nexport * from \"./UserPreference/UserPreferenceStorage\";\nexport * from \"./Widgets/DialogUtils\";\nexport * from \"./Widgets/PromptDialog\";\nexport * from \"./Widgets/SelectableEntityGrid\";\nexport * from \"./Widgets/ServiceEditorBase\";\nexport * from \"./Widgets/StaticTextBlock\";", "\uFEFFimport { fieldsProxy } from \"@serenity-is/corelib/q\";\r\n\r\nexport interface UserPreferenceRow {\r\n UserPreferenceId?: number;\r\n UserId?: number;\r\n PreferenceType?: string;\r\n Name?: string;\r\n Value?: string;\r\n}\r\n\r\nexport abstract class UserPreferenceRow {\r\n static readonly idProperty = 'UserPreferenceId';\r\n static readonly nameProperty = 'Name';\r\n static readonly localTextPrefix = 'Common.UserPreference';\r\n static readonly deletePermission = '';\r\n static readonly insertPermission = '';\r\n static readonly readPermission = '';\r\n static readonly updatePermission = '';\r\n\r\n static readonly Fields = fieldsProxy();\r\n}\r\n", "\uFEFFimport { UserPreferenceUpdateRequest } from \"./UserPreferenceUpdateRequest\";\nimport { ServiceResponse, ServiceOptions, serviceRequest } from \"@serenity-is/corelib/q\";\nimport { UserPreferenceRetrieveRequest } from \"./UserPreferenceRetrieveRequest\";\nimport { UserPreferenceRetrieveResponse } from \"./UserPreferenceRetrieveResponse\";\n\nexport namespace UserPreferenceService {\n export const baseUrl = 'Extensions/UserPreference';\n\n export declare function Update(request: UserPreferenceUpdateRequest, onSuccess?: (response: ServiceResponse) => void, opt?: ServiceOptions): JQueryXHR;\n export declare function Retrieve(request: UserPreferenceRetrieveRequest, onSuccess?: (response: UserPreferenceRetrieveResponse) => void, opt?: ServiceOptions): JQueryXHR;\n\n export const Methods = {\n Update: \"Extensions/UserPreference/Update\",\n Retrieve: \"Extensions/UserPreference/Retrieve\"\n } as const;\n\n [\n 'Update', \n 'Retrieve'\n ].forEach(x => {\n (UserPreferenceService)[x] = function (r, s, o) {\n return serviceRequest(baseUrl + '/' + x, r, s, o);\n };\n });\n}", "import { Decorators, TemplatedDialog } from \"@serenity-is/corelib\";\nimport { localText, trimToNull } from \"@serenity-is/corelib/q\";\n\n@Decorators.registerClass(\"Serenity.Extensions.BasicProgressDialog\")\nexport class BasicProgressDialog extends TemplatedDialog {\n\n constructor() {\n super();\n\n this.dialogTitle = localText('Site.BasicProgressDialog.PleaseWait');\n }\n\n public cancelled: boolean;\n\n public get max(): number {\n return parseInt(this.byId('ProgressBar').attr('aria-valuemax'), 10);\n }\n\n public set max(value: number) {\n this.byId('ProgressBar').attr('aria-valuemax', (value || 100).toString());\n }\n\n public get value(): number {\n return parseInt(this.byId('ProgressBar').attr('aria-valuenow'), 10);\n }\n\n public set value(value: number) {\n this.byId('ProgressBar').attr('aria-valuenow', (value || 0).toString())\n .css('width', (((value || 0) / (this.max || 100)) * 100) + '%')\n .text(value + ' / ' + this.max);\n }\n\n public get title(): string {\n return this.dialogTitle;\n }\n\n public set title(value: string) {\n this.dialogTitle = value;\n }\n\n public cancelTitle: string;\n\n getDialogButtons() {\n return [{\n text: localText('Dialogs.CancelButton'),\n class: 'btn btn-danger',\n click: () => {\n this.cancelled = true;\n this.element.closest('.ui-dialog')\n .find('.ui-dialog-buttonpane .ui-button')\n .attr('disabled', 'disabled')\n .css('opacity', '0.5');\n\n this.element.dialog('option', 'title', trimToNull(this.cancelTitle) ||\n localText('Site.BasicProgressDialog.CancelTitle'));\n }\n }];\n }\n\n getDialogOptions() {\n var opt = super.getDialogOptions();\n opt.width = 600;\n return opt;\n }\n\n initDialog() {\n super.initDialog();\n this.element.closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();\n }\n\n getTemplate() {\n return (\n `
\n
\n
\n
\n
\n
`);\n }\n}", "\uFEFFimport { confirmDialog, Dictionary, format, notifyError, notifySuccess, notifyWarning, ServiceError, localText } from \"@serenity-is/corelib/q\";\nimport { BasicProgressDialog } from \"./BasicProgressDialog\";\n\nexport class BulkServiceAction {\n\n protected keys: string[];\n protected queue: string[];\n protected queueIndex: number;\n protected progressDialog: BasicProgressDialog;\n protected pendingRequests: number;\n protected completedRequests: number;\n protected errorByKey: Dictionary;\n private successCount;\n private errorCount;\n public done: () => void;\n\n protected createProgressDialog() {\n this.progressDialog = new BasicProgressDialog();\n this.progressDialog.dialogOpen();\n this.progressDialog.max = this.keys.length;\n this.progressDialog.value = 0;\n }\n\n protected getConfirmationFormat() {\n return localText('Site.BulkServiceAction.ConfirmationFormat');\n }\n\n protected getConfirmationMessage(targetCount) {\n return format(this.getConfirmationFormat(), targetCount);\n }\n\n protected confirm(targetCount, action) {\n confirmDialog(this.getConfirmationMessage(targetCount), action);\n }\n\n protected getNothingToProcessMessage() {\n return localText('Site.BulkServiceAction.NothingToProcess');\n }\n\n protected nothingToProcess() {\n notifyError(this.getNothingToProcessMessage());\n }\n\n protected getParallelRequests() {\n return 1;\n }\n\n protected getBatchSize() {\n return 1;\n }\n\n protected startParallelExecution() {\n this.createProgressDialog();\n this.successCount = 0;\n this.errorCount = 0;\n this.pendingRequests = 0;\n this.completedRequests = 0;\n this.errorCount = 0;\n this.errorByKey = {};\n this.queue = this.keys.slice();\n this.queueIndex = 0;\n var parallelRequests = this.getParallelRequests();\n while (parallelRequests-- > 0) {\n this.executeNextBatch();\n }\n }\n\n protected serviceCallCleanup() {\n this.pendingRequests--;\n this.completedRequests++;\n\n var title = localText((this.progressDialog.cancelled ?\n 'Site.BasicProgressDialog.CancelTitle' : 'Site.BasicProgressDialog.PleaseWait'));\n\n title += ' (';\n if (this.successCount > 0) {\n title += format(localText('Site.BulkServiceAction.SuccessCount'), this.successCount);\n }\n\n if (this.errorCount > 0) {\n if (this.successCount > 0) {\n title += ', ';\n }\n\n title += format(localText('Site.BulkServiceAction.ErrorCount'), this.errorCount);\n }\n\n this.progressDialog.title = title + ')';\n this.progressDialog.value = this.successCount + this.errorCount;\n if (!this.progressDialog.cancelled && this.progressDialog.value < this.keys.length) {\n this.executeNextBatch();\n }\n\n else if (this.pendingRequests === 0) {\n this.progressDialog.dialogClose();\n this.showResults();\n if (this.done) {\n this.done();\n this.done = null;\n }\n }\n }\n\n protected executeForBatch(batch: string[]) {\n }\n\n protected executeNextBatch() {\n var batchSize = this.getBatchSize();\n var batch = [];\n while (true) {\n if (batch.length >= batchSize) {\n break;\n }\n\n if (this.queueIndex >= this.queue.length) {\n break;\n }\n\n batch.push(this.queue[this.queueIndex++]);\n }\n\n if (batch.length > 0) {\n this.pendingRequests++;\n this.executeForBatch(batch);\n }\n }\n\n protected getAllHadErrorsFormat() {\n return localText('Site.BulkServiceAction.AllHadErrorsFormat');\n }\n\n protected showAllHadErrors() {\n notifyError(format(this.getAllHadErrorsFormat(), this.errorCount));\n }\n\n protected getSomeHadErrorsFormat() {\n return localText('Site.BulkServiceAction.SomeHadErrorsFormat');\n }\n\n protected showSomeHadErrors() {\n notifyWarning(format(this.getSomeHadErrorsFormat(), this.successCount, this.errorCount));\n }\n\n protected getAllSuccessFormat() {\n return localText('Site.BulkServiceAction.AllSuccessFormat');\n }\n\n protected showAllSuccess() {\n notifySuccess(format(this.getAllSuccessFormat(), this.successCount));\n }\n\n protected showResults() {\n if (this.errorCount === 0 && this.successCount === 0) {\n this.nothingToProcess();\n return;\n }\n\n if (this.errorCount > 0 && this.successCount === 0) {\n this.showAllHadErrors();\n return;\n }\n\n if (this.errorCount > 0) {\n this.showSomeHadErrors();\n return;\n }\n\n this.showAllSuccess();\n }\n\n public execute(keys: string[]) {\n this.keys = keys;\n if (this.keys.length === 0) {\n this.nothingToProcess();\n return;\n }\n this.confirm(this.keys.length, () => this.startParallelExecution());\n }\n\n get_successCount() {\n return this.successCount;\n }\n\n set_successCount(value: number) {\n this.successCount = value;\n }\n\n get_errorCount() {\n return this.errorCount;\n }\n\n set_errorCount(value: number) {\n this.errorCount = value;\n }\n}", "import { DataGrid, ToolButton } from \"@serenity-is/corelib\";\nimport { coalesce, deepClone, ListRequest, postToService } from \"@serenity-is/corelib/q\";\n\nexport interface ExcelExportOptions {\n grid: DataGrid;\n service: string;\n onViewSubmit: () => boolean;\n editRequest?: (request: ListRequest) => ListRequest;\n title?: string;\n hint?: string;\n separator?: boolean;\n}\n\nexport namespace ExcelExportHelper {\n\n export function createToolButton(options: ExcelExportOptions): ToolButton {\n\n return {\n hint: coalesce(options.hint, 'Excel'),\n title: coalesce(options.title, ''),\n cssClass: 'export-xlsx-button',\n icon: 'fa-file-excel-o',\n onClick: function () {\n if (!options.onViewSubmit()) {\n return;\n }\n\n let grid = options.grid;\n\n var request = deepClone(grid.getView().params) as ListRequest;\n request.Take = 0;\n request.Skip = 0;\n var sortBy = grid.getView().sortBy;\n if (sortBy) {\n request.Sort = sortBy;\n }\n\n request.ExportColumns = [];\n let columns = grid.getGrid().getColumns();\n for (let column of columns) {\n request.ExportColumns.push(column.id || column.field);\n }\n\n if (options.editRequest)\n request = options.editRequest(request);\n\n postToService({ service: options.service, request: request, target: '_blank' });\n },\n separator: options.separator\n };\n }\n}", "import { DataGrid, ToolButton } from \"@serenity-is/corelib\";\nimport { deepClone, format, formatDate, ListRequest, ListResponse, resolveUrl, serviceCall } from \"@serenity-is/corelib/q\";\nimport { Column, Grid } from \"@serenity-is/sleekgrid\";\n\nexport interface PdfExportOptions {\n grid: DataGrid;\n onViewSubmit: () => boolean;\n title?: string;\n hint?: string;\n separator?: boolean;\n reportTitle?: string;\n titleTop?: number;\n titleFontSize?: number;\n fileName?: string;\n pageNumbers?: boolean;\n columnTitles?: { [key: string]: string };\n tableOptions?: jsPDF.AutoTableOptions;\n output?: string;\n autoPrint?: boolean;\n printDateTimeHeader?: boolean;\n}\n\nexport namespace PdfExportHelper {\n\n function toAutoTableColumns(srcColumns: Column[], columnStyles: { [dataKey: string]: jsPDF.AutoTableStyles; },\n columnTitles: { [key: string]: string }) {\n return srcColumns.map(src => {\n let col: jsPDF.AutoTableColumn = {\n dataKey: src.id || src.field,\n title: src.name || ''\n };\n\n if (columnTitles && columnTitles[col.dataKey] != null)\n col.title = columnTitles[col.dataKey];\n\n let style: jsPDF.AutoTableStyles = {};\n if ((src.cssClass || '').indexOf(\"align-right\") >= 0)\n style.halign = 'right';\n else if ((src.cssClass || '').indexOf(\"align-center\") >= 0)\n style.halign = 'center';\n\n columnStyles[col.dataKey] = style;\n\n return col;\n });\n }\n\n function toAutoTableData(slickGrid: Grid, entities: any[], keys: string[], srcColumns: Column[]) {\n let el = document.createElement('span');\n let row = 0;\n return entities.map(item => {\n let dst = [];\n for (let cell = 0; cell < srcColumns.length; cell++) {\n var col = srcColumns[cell];\n var format = slickGrid.getFormatter(row, col);\n var ctx = slickGrid.getFormatterContext(row, cell);\n ctx.item = item;\n ctx.value = item[col.field];\n let html: string = format ? format(ctx) : '';\n if (!html || (html.indexOf('<') < 0 && html.indexOf('&') < 0))\n dst.push(html);\n else {\n el.innerHTML = html;\n if (el.children.length == 1 &&\n $(el.children[0]).is(\"select\")) {\n dst.push($(el.children[0]).children(\"[selected]\").text());\n }\n else if (el.children.length == 1 &&\n $(el.children[0]).is(\":input\")) {\n dst.push($(el.children[0]).val());\n }\n else if (el.children.length == 1 &&\n $(el.children).is('.check-box')) {\n dst.push($(el.children).hasClass(\"checked\") ? \"X\" : \"\")\n }\n else\n dst.push(el.textContent || '');\n }\n }\n row++;\n return dst;\n });\n }\n\n export function exportToPdf(options: PdfExportOptions): void {\n\n var g = options.grid;\n\n if (!options.onViewSubmit())\n return;\n\n includeAutoTable();\n\n var request = deepClone(g.view.params) as ListRequest;\n request.Take = 0;\n request.Skip = 0;\n\n var sortBy = g.view.sortBy;\n if (sortBy != null)\n request.Sort = sortBy;\n\n var gridColumns = g.slickGrid.getColumns();\n gridColumns = gridColumns.filter(x => x.id !== \"__select__\");\n\n request.IncludeColumns = [];\n for (var column of gridColumns)\n request.IncludeColumns.push(column.id || column.field);\n\n serviceCall({\n url: g.view.url,\n request: request,\n onSuccess: response => {\n // @ts-ignore\n let doc = new jsPDF('l', 'pt');\n let srcColumns = gridColumns;\n let columnStyles: { [dataKey: string]: jsPDF.AutoTableStyles; } = {};\n let columns = toAutoTableColumns(srcColumns, columnStyles, options.columnTitles);\n var keys = columns.map(x => x.dataKey);\n let entities = (>response).Entities || [];\n let data = toAutoTableData(g.slickGrid, entities, keys, srcColumns);\n\n doc.setFontSize(options.titleFontSize || 10);\n doc.setFont('helvetica', 'bold');\n let reportTitle = options.reportTitle || g.getTitle() || \"Report\";\n\n doc.autoTableText(reportTitle, doc.internal.pageSize.width / 2,\n options.titleTop || 25, { halign: 'center' });\n\n var totalPagesExp = \"{{T}}\";\n\n let pageNumbers = options.pageNumbers == null || options.pageNumbers;\n var autoOptions = $.extend({\n margin: { top: 25, left: 25, right: 25, bottom: pageNumbers ? 25 : 30 },\n startY: 60,\n styles: {\n fontSize: 8,\n overflow: 'linebreak',\n cellPadding: 2,\n valign: 'middle'\n },\n columnStyles: columnStyles\n }, options.tableOptions);\n\n var footer: (data: any) => void;\n var header: (data: any) => void;\n if (pageNumbers) {\n footer = function (data) {\n var str = data.pageCount;\n // Total page number plugin only available in jspdf v1.0+\n if (typeof doc.putTotalPages === 'function') {\n str = str + \" / \" + totalPagesExp;\n }\n doc.autoTableText(str, doc.internal.pageSize.width / 2,\n doc.internal.pageSize.height - autoOptions.margin.bottom, {\n halign: 'center'\n });\n };\n }\n\n // Print header of page\n if (options.printDateTimeHeader == null || options.printDateTimeHeader) {\n header = function (data) {\n doc.setFont('helvetica', 'normal');\n doc.setFontSize(8);\n\n // Date and time of the report\n doc.autoTableText(formatDate(new Date(), \"dd-MM-yyyy HH:mm\"),\n doc.internal.pageSize.width - autoOptions.margin.right, 13,\n {\n halign: 'right'\n });\n };\n }\n\n autoOptions.didDrawPage = (data) => {\n if (!!header) header(data);\n if (!!footer) footer(data);\n };\n\n autoOptions.head = [columns];\n autoOptions.body = data;\n\n doc.autoTable(autoOptions);\n\n if (typeof doc.putTotalPages === 'function') {\n doc.putTotalPages(totalPagesExp);\n }\n\n\n if (!options.output || options.output == \"file\") {\n var fileName = options.fileName || options.reportTitle || \"{0}_{1}.pdf\";\n fileName = format(fileName, g.getTitle() || \"report\",\n formatDate(new Date(), \"yyyyMMdd_HHmm\"));\n doc.save(fileName);\n return;\n }\n\n if (options.autoPrint)\n doc.autoPrint();\n\n var output = options.output;\n if (output == 'newwindow' || '_blank')\n output = 'dataurlnewwindow';\n else if (output == 'window')\n output = 'datauri';\n\n doc.output(output);\n }\n });\n }\n\n export function createToolButton(options: PdfExportOptions) {\n\n return {\n title: options.title || '',\n hint: options.hint || 'PDF',\n cssClass: 'export-pdf-button',\n onClick: () => exportToPdf(options),\n separator: options.separator\n };\n }\n\n function includeJsPDF() {\n // @ts-ignore\n if (typeof jsPDF !== \"undefined\")\n return;\n\n var script = $(\"jsPDFScript\");\n if (script.length > 0)\n return;\n\n $(\"