diff --git a/src/app/showcase/doc/button/badgedoc.ts b/src/app/showcase/doc/button/badgedoc.ts
index 4cef3224f3e..b9cabeca489 100644
--- a/src/app/showcase/doc/button/badgedoc.ts
+++ b/src/app/showcase/doc/button/badgedoc.ts
@@ -8,8 +8,8 @@ import { Code } from '@domain/code';
`,
diff --git a/src/app/showcase/doc/fileupload/templatedoc.ts b/src/app/showcase/doc/fileupload/templatedoc.ts
index 97e918e1670..b9ee610d24d 100644
--- a/src/app/showcase/doc/fileupload/templatedoc.ts
+++ b/src/app/showcase/doc/fileupload/templatedoc.ts
@@ -1,4 +1,4 @@
-import { Component, inject } from '@angular/core';
+import { Component } from '@angular/core';
import { Code } from '@domain/code';
import { PrimeNGConfig } from 'primeng/api';
@@ -67,7 +67,7 @@ import { PrimeNGConfig } from 'primeng/api';
`
})
export class TemplateDoc {
- config = inject(PrimeNGConfig);
+ constructor(private config: PrimeNGConfig) {}
choose(event, callback) {
callback();
@@ -97,38 +97,149 @@ export class TemplateDoc {
code: Code = {
basic: `
+ html: `
-
- Upload 3 Files
+
+
+
+
100 }">
+ {{ totalSize }}B / 1Mb
+
+
-
- Custom UI to display a file
+
+ 0">
+
Pending
+
+
+
+
+
+
{{ file.name }}
+
{{ formatSize(file.size) }}
+
+
+
+
+ 0">
+
Completed
+
+
+
+
+
+
{{ file.name }}
+
{{ formatSize(file.size) }}
+
+
+
+
+
-
- Additional content.
+
+
+
+
Drag and drop files to here to upload.
+
`,
- typescript: `
-import { Component, Input } from '@angular/core';
-
+ typescript: `import { Component } from '@angular/core';
+import { PrimeNGConfig} from 'primeng/api';
+import { FileUploadModule } from 'primeng/fileupload';
+import { ButtonModule } from 'primeng/button';
+import { CommonModule } from '@angular/common';
+import { BadgeModule } from 'primeng/badge';
+import { HttpClientModule } from '@angular/common/http';
+import { ProgressBarModule } from 'primeng/progressbar';
+
@Component({
selector: 'file-upload-template-demo',
templateUrl: './file-upload-template-demo.html',
+ standalone: true,
+ imports: [FileUploadModule, ButtonModule, BadgeModule, ProgressBarModule, HttpClientModule, CommonModule]
})
-export class FileUploadTemplateDemo {}`
+export class FileUploadTemplateDemo {
+ constructor(private config: PrimeNGConfig) {}
+
+ choose(event, callback) {
+ callback();
+ }
+
+ onRemoveTemplatingFile(event, file, removeFileCallback, index) {
+ removeFileCallback(event, index);
+ }
+
+ uploadEvent(callback) {
+ callback();
+ }
+
+ formatSize(bytes) {
+ const k = 1024;
+ const dm = 3;
+ const sizes = this.config.translation.fileSizeTypes;
+ if (bytes === 0) {
+ return \`0 \${sizes[0]}\`;
+ }
+
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm));
+
+ return \`\${formattedSize} \${sizes[i]}\`;
+ }
+}`
};
}
diff --git a/src/app/showcase/doc/splitbutton/templatedoc.ts b/src/app/showcase/doc/splitbutton/templatedoc.ts
index d33f6ecee92..53337fc1a66 100644
--- a/src/app/showcase/doc/splitbutton/templatedoc.ts
+++ b/src/app/showcase/doc/splitbutton/templatedoc.ts
@@ -10,7 +10,7 @@ import { Code } from '@domain/code';
-
+
@@ -24,6 +24,8 @@ import { Code } from '@domain/code';
providers: [MessageService]
})
export class TemplateDoc {
+ items: MenuItem[];
+
constructor(private messageService: MessageService) {
this.items = [
{
@@ -44,8 +46,6 @@ export class TemplateDoc {
];
}
- items: MenuItem[];
-
save(severity: string) {
this.messageService.add({ severity: severity, summary: 'Success', detail: 'Data Saved' });
}
@@ -62,14 +62,36 @@ export class TemplateDoc {
basic: ``,
+ severity="contrast"
+ [model]="items">
+
+
+
+ PrimeNG
+
+
+`,
html: `
+ severity="contrast"
+ [model]="items">
+
+
+
+ PrimeNG
+
+
+
`,
typescript: `import { Component } from '@angular/core';
@@ -86,7 +108,7 @@ import { ToastModule } from 'primeng/toast';
})
export class SplitButtonTemplateDemo {
items: MenuItem[];
-
+
constructor(private messageService: MessageService) {
this.items = [
{