Adding psecial link type

This commit is contained in:
2023-03-06 20:19:40 +01:00
parent 62bbe706ca
commit 02e2685c50
5 changed files with 72 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@angular/animations": "^15.0.0", "@angular/animations": "^15.0.0",
"@angular/cdk": "^15.2.1",
"@angular/common": "^15.0.0", "@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0", "@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0", "@angular/core": "^15.0.0",
@@ -408,6 +409,46 @@
"@angular/core": "15.1.3" "@angular/core": "15.1.3"
} }
}, },
"node_modules/@angular/cdk": {
"version": "15.2.1",
"resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-15.2.1.tgz",
"integrity": "sha512-kRwG0ujimOPhqDwQYcQ+pk7hpTr0yvaPkxAx5r1ytA6aQIvHJ1XaPzhtthsr5/PhpwzlH8k723xpejrLKcuR+w==",
"dependencies": {
"tslib": "^2.3.0"
},
"optionalDependencies": {
"parse5": "^7.1.2"
},
"peerDependencies": {
"@angular/common": "^15.0.0 || ^16.0.0",
"@angular/core": "^15.0.0 || ^16.0.0",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/cdk/node_modules/entities": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
"optional": true,
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@angular/cdk/node_modules/parse5": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
"integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==",
"optional": true,
"dependencies": {
"entities": "^4.4.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/@angular/cli": { "node_modules/@angular/cli": {
"version": "15.0.5", "version": "15.0.5",
"resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.0.5.tgz", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.0.5.tgz",

View File

@@ -11,6 +11,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^15.0.0", "@angular/animations": "^15.0.0",
"@angular/cdk": "^15.2.1",
"@angular/common": "^15.0.0", "@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0", "@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0", "@angular/core": "^15.0.0",
@@ -23,8 +24,8 @@
"@ngx-formly/core": "^6.0.0", "@ngx-formly/core": "^6.0.0",
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"@tinymce/tinymce-angular": "^7.0.0", "@tinymce/tinymce-angular": "^7.0.0",
"fabric": "^5.3.0",
"@types/fabric": "^5.3.0", "@types/fabric": "^5.3.0",
"fabric": "^5.3.0",
"ngx-bootstrap-icons": "^1.9.1", "ngx-bootstrap-icons": "^1.9.1",
"ngx-wig": "^15.1.4", "ngx-wig": "^15.1.4",
"rxjs": "~7.5.0", "rxjs": "~7.5.0",

View File

@@ -53,6 +53,8 @@ export class CrudFormlyJsonschemaOptions implements FormlyJsonschemaOptions {
} else if (schema.type == "string" && schema.hasOwnProperty('props') } else if (schema.type == "string" && schema.hasOwnProperty('props')
&& schema.props.hasOwnProperty("richtext") && schema.props.richtext) { && schema.props.hasOwnProperty("richtext") && schema.props.richtext) {
field.type = "richtext"; field.type = "richtext";
} else if (schema.type == "string" && schema.format == "signature-link") {
field.type = "signature-link";
} }
if (schema.hasOwnProperty('props')) { if (schema.hasOwnProperty('props')) {

View File

@@ -26,6 +26,8 @@ import { HiddenTypeComponent } from "./types/hidden.type";
import { DictionaryTypeComponent } from "./types/dictionary.type"; import { DictionaryTypeComponent } from "./types/dictionary.type";
import { DictionaryService } from "./types/dictionary.service"; import { DictionaryService } from "./types/dictionary.service";
import { RichtextTypeComponent } from "./types/richtext.type"; import { RichtextTypeComponent } from "./types/richtext.type";
import { SignatureLinkTypeComponent } from "@common/crud/types/signature-link.type";
import { ClipboardModule } from '@angular/cdk/clipboard';
@NgModule({ @NgModule({
@@ -40,7 +42,8 @@ import { RichtextTypeComponent } from "./types/richtext.type";
ForeignkeyTypeComponent, ForeignkeyTypeComponent,
HiddenTypeComponent, HiddenTypeComponent,
DictionaryTypeComponent, DictionaryTypeComponent,
RichtextTypeComponent RichtextTypeComponent,
SignatureLinkTypeComponent
], ],
providers: [ providers: [
JsonschemasService, JsonschemasService,
@@ -68,10 +71,12 @@ import { RichtextTypeComponent } from "./types/richtext.type";
{ name: 'hidden', component: HiddenTypeComponent }, { name: 'hidden', component: HiddenTypeComponent },
{ name: 'dictionary', component: DictionaryTypeComponent }, { name: 'dictionary', component: DictionaryTypeComponent },
{ name: 'richtext', component: RichtextTypeComponent }, { name: 'richtext', component: RichtextTypeComponent },
{ name: 'signature-link', component: SignatureLinkTypeComponent },
] ]
}), }),
FormlyBootstrapModule, FormlyBootstrapModule,
EditorModule EditorModule,
ClipboardModule
], ],
exports: [ exports: [
CardComponent, CardComponent,

View File

@@ -0,0 +1,20 @@
import {Component, OnInit} from "@angular/core";
import { FieldType, FieldTypeConfig } from "@ngx-formly/core";
@Component({
selector: 'app-form-signature-link-type',
template: `
<div class="input-group mb-12">
<input class="form-control" type="text" readonly disabled="" value="{{ this.signature_url }}"/>
<button type="button" class="btn btn-light" [cdkCopyToClipboard]="this.signature_url"><i-bs name="text-paragraph"/></button>
</div>
`,
})
export class SignatureLinkTypeComponent extends FieldType<FieldTypeConfig> implements OnInit{
base_path = "/contracts/signature/"
signature_url = ""
ngOnInit() {
this.signature_url = location.origin + this.base_path + this.formControl.value
}
}