@ajf/material 18.5.0 → 18.5.2

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.
@@ -36,6 +36,9 @@ class AjfNodeIcon extends AjfNodeIcon$1 {
36
36
  if (node.nodeType === AjfNodeType.AjfRepeatingSlide) {
37
37
  return 'create_new_folder';
38
38
  }
39
+ if (node.nodeType === AjfNodeType.AjfNodeGroup) {
40
+ return 'view_agenda';
41
+ }
39
42
  if (node.nodeType !== AjfNodeType.AjfField) {
40
43
  return 'broken_image';
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ajf-material-node-icon.mjs","sources":["../../../projects/material/node-icon/src/node-icon.ts","../../../projects/material/node-icon/src/node-icon.html","../../../projects/material/node-icon/src/node-icon-module.ts","../../../projects/material/node-icon/src/public_api.ts","../../../projects/material/node-icon/src/ajf-material-node-icon.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfField, AjfFieldType, AjfNode, AjfNodeType} from '@ajf/core/forms';\nimport {AjfNodeIcon as CoreNodeIcon} from '@ajf/core/node-icon';\nimport {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';\n\n@Component({\n selector: 'ajf-node-icon',\n templateUrl: 'node-icon.html',\n styleUrls: ['node-icon.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AjfNodeIcon extends CoreNodeIcon {\n matIcon(node: AjfNode): string {\n if (node.nodeType === AjfNodeType.AjfSlide) {\n return 'folder';\n }\n if (node.nodeType === AjfNodeType.AjfRepeatingSlide) {\n return 'create_new_folder';\n }\n if (node.nodeType !== AjfNodeType.AjfField) {\n return 'broken_image';\n }\n switch ((node as AjfField).fieldType as AjfFieldType) {\n case AjfFieldType.String:\n case AjfFieldType.Text:\n return 'abc';\n case AjfFieldType.Number:\n case AjfFieldType.Range:\n return 'pin';\n case AjfFieldType.Boolean:\n return 'toggle_off';\n case AjfFieldType.SingleChoice:\n return 'format_list_bulleted';\n case AjfFieldType.MultipleChoice:\n return 'format_list_numbered';\n case AjfFieldType.Formula:\n return 'code';\n case AjfFieldType.Empty:\n return 'html';\n case AjfFieldType.DateRange:\n case AjfFieldType.DateInput:\n return 'calendar_month';\n case AjfFieldType.Time:\n return 'access_time';\n case AjfFieldType.Table:\n return 'grid_on';\n case AjfFieldType.Geolocation:\n return 'location_on';\n case AjfFieldType.Barcode:\n return 'qr_code_2';\n case AjfFieldType.File:\n return 'attach_file';\n case AjfFieldType.Image:\n return 'image';\n case AjfFieldType.VideoUrl:\n return 'videocam';\n case AjfFieldType.Signature:\n return 'draw';\n default:\n return 'broken_image';\n }\n }\n}\n","<ng-template [ngIf]=\"node\">\n <mat-icon>{{matIcon(node)}}</mat-icon>\n</ng-template>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatIconModule} from '@angular/material/icon';\n\nimport {AjfNodeIcon} from './node-icon';\n\n@NgModule({\n imports: [CommonModule, MatIconModule],\n declarations: [AjfNodeIcon],\n exports: [AjfNodeIcon],\n})\nexport class AjfNodeIconModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './node-icon-module';\nexport * from './node-icon';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["CoreNodeIcon"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAaG,MAAO,WAAY,SAAQA,aAAY,CAAA;AAC3C,IAAA,OAAO,CAAC,IAAa,EAAA;QACnB,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,EAAE;AAC1C,YAAA,OAAO,QAAQ;;QAEjB,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,iBAAiB,EAAE;AACnD,YAAA,OAAO,mBAAmB;;QAE5B,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,EAAE;AAC1C,YAAA,OAAO,cAAc;;AAEvB,QAAA,QAAS,IAAiB,CAAC,SAAyB;YAClD,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CAAA;gHAEV,iBAAiB,EAAA,OAAA,EAAA,CAJlB,YAAY,EAAE,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAI1B,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;oBACtC,YAAY,EAAE,CAAC,WAAW,CAAC;oBAC3B,OAAO,EAAE,CAAC,WAAW,CAAC;AACvB,iBAAA;;;AChCD;;;;;;;;;;;;;;;;;;;;AAoBG;;ACpBH;;AAEG;;;;"}
1
+ {"version":3,"file":"ajf-material-node-icon.mjs","sources":["../../../projects/material/node-icon/src/node-icon.ts","../../../projects/material/node-icon/src/node-icon.html","../../../projects/material/node-icon/src/node-icon-module.ts","../../../projects/material/node-icon/src/public_api.ts","../../../projects/material/node-icon/src/ajf-material-node-icon.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfField, AjfFieldType, AjfNode, AjfNodeType} from '@ajf/core/forms';\nimport {AjfNodeIcon as CoreNodeIcon} from '@ajf/core/node-icon';\nimport {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';\n\n@Component({\n selector: 'ajf-node-icon',\n templateUrl: 'node-icon.html',\n styleUrls: ['node-icon.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AjfNodeIcon extends CoreNodeIcon {\n matIcon(node: AjfNode): string {\n if (node.nodeType === AjfNodeType.AjfSlide) {\n return 'folder';\n }\n if (node.nodeType === AjfNodeType.AjfRepeatingSlide) {\n return 'create_new_folder';\n }\n if (node.nodeType === AjfNodeType.AjfNodeGroup) {\n return 'view_agenda';\n }\n if (node.nodeType !== AjfNodeType.AjfField) {\n return 'broken_image';\n }\n switch ((node as AjfField).fieldType as AjfFieldType) {\n case AjfFieldType.String:\n case AjfFieldType.Text:\n return 'abc';\n case AjfFieldType.Number:\n case AjfFieldType.Range:\n return 'pin';\n case AjfFieldType.Boolean:\n return 'toggle_off';\n case AjfFieldType.SingleChoice:\n return 'format_list_bulleted';\n case AjfFieldType.MultipleChoice:\n return 'format_list_numbered';\n case AjfFieldType.Formula:\n return 'code';\n case AjfFieldType.Empty:\n return 'html';\n case AjfFieldType.DateRange:\n case AjfFieldType.DateInput:\n return 'calendar_month';\n case AjfFieldType.Time:\n return 'access_time';\n case AjfFieldType.Table:\n return 'grid_on';\n case AjfFieldType.Geolocation:\n return 'location_on';\n case AjfFieldType.Barcode:\n return 'qr_code_2';\n case AjfFieldType.File:\n return 'attach_file';\n case AjfFieldType.Image:\n return 'image';\n case AjfFieldType.VideoUrl:\n return 'videocam';\n case AjfFieldType.Signature:\n return 'draw';\n default:\n return 'broken_image';\n }\n }\n}\n","<ng-template [ngIf]=\"node\">\n <mat-icon>{{matIcon(node)}}</mat-icon>\n</ng-template>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatIconModule} from '@angular/material/icon';\n\nimport {AjfNodeIcon} from './node-icon';\n\n@NgModule({\n imports: [CommonModule, MatIconModule],\n declarations: [AjfNodeIcon],\n exports: [AjfNodeIcon],\n})\nexport class AjfNodeIconModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './node-icon-module';\nexport * from './node-icon';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["CoreNodeIcon"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAaG,MAAO,WAAY,SAAQA,aAAY,CAAA;AAC3C,IAAA,OAAO,CAAC,IAAa,EAAA;QACnB,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,EAAE;AAC1C,YAAA,OAAO,QAAQ;;QAEjB,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,iBAAiB,EAAE;AACnD,YAAA,OAAO,mBAAmB;;QAE5B,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,YAAY,EAAE;AAC9C,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EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,iBAHb,WAAW,CAAA,EAAA,OAAA,EAAA,CADhB,YAAY,EAAE,aAAa,aAE3B,WAAW,CAAA,EAAA,CAAA,CAAA;gHAEV,iBAAiB,EAAA,OAAA,EAAA,CAJlB,YAAY,EAAE,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAI1B,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;oBACtC,YAAY,EAAE,CAAC,WAAW,CAAC;oBAC3B,OAAO,EAAE,CAAC,WAAW,CAAC;AACvB,iBAAA;;;AChCD;;;;;;;;;;;;;;;;;;;;AAoBG;;ACpBH;;AAEG;;;;"}
@@ -106,11 +106,11 @@ class AjfSignatureComponent extends AjfSignature {
106
106
  return;
107
107
  }
108
108
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AjfSignatureComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AjfSignatureComponent, selector: "ajf-signature", providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR], usesInheritance: true, ngImport: i0, template: "<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n", styles: ["ajf-signature{display:block}ajf-signature .ajf-signature-container{display:flex;flex-wrap:wrap;align-items:center;gap:12px;width:100%}ajf-signature .ajf-signature-pad{position:relative;display:flex;align-items:center;justify-content:center;border:1px dashed var(--ajf-border-strong, #d5cfc6);border-radius:var(--ajf-radius, 4px);background:var(--ajf-surface, #fff)}ajf-signature .ajf-signature-canvas{display:block;touch-action:none}ajf-signature .ajf-signature-text{position:absolute;color:var(--ajf-text-faint, #a49c92);font-family:var(--ajf-font-mono, monospace);font-size:13px;pointer-events:none}ajf-signature .ajf-signature-actions{display:flex;align-items:center;gap:12px}ajf-signature .ajf-signature-accept{display:inline-flex;align-items:center;gap:8px;min-height:var(--ajf-control-h, 44px);padding:0 16px;border:1px solid var(--ajf-accent, #0f4c5c);border-radius:var(--ajf-radius, 4px);background:var(--ajf-accent, #0f4c5c);color:var(--ajf-accent-fg, #fff);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-accept:disabled{border-color:var(--ajf-border-strong, #d5cfc6);background:var(--ajf-band, #faf8f5);color:var(--ajf-text-faint, #a49c92);cursor:default}ajf-signature .ajf-signature-kbd{padding:1px 5px;border-radius:3px;background:var(--ajf-kbd-bg, rgba(255, 255, 255, .22));font-family:var(--ajf-font-mono, monospace);font-size:10px}ajf-signature .ajf-signature-clear{padding:0 4px;border:0;background:none;color:var(--ajf-text-muted, #7a736a);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-clear:hover{text-decoration:underline}ajf-signature .ajf-signature-preview{max-width:200px;max-height:100px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
109
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AjfSignatureComponent, selector: "ajf-signature", providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR], usesInheritance: true, ngImport: i0, template: "<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n", styles: ["ajf-signature{display:block}ajf-signature .ajf-signature-container{display:flex;flex-wrap:wrap;align-items:center;gap:12px;width:100%}ajf-signature .ajf-signature-pad{position:relative;display:flex;align-items:center;justify-content:center;border:1px dashed var(--ajf-border-strong, #d5cfc6);border-radius:var(--ajf-radius, 4px);background:#fff}ajf-signature .ajf-signature-canvas{display:block;touch-action:none}ajf-signature .ajf-signature-text{position:absolute;color:var(--ajf-text-faint, #a49c92);font-family:var(--ajf-font-mono, monospace);font-size:13px;pointer-events:none}ajf-signature .ajf-signature-actions{display:flex;align-items:center;gap:12px}ajf-signature .ajf-signature-accept{display:inline-flex;align-items:center;gap:8px;min-height:var(--ajf-control-h, 44px);padding:0 16px;border:1px solid var(--ajf-accent, #0f4c5c);border-radius:var(--ajf-radius, 4px);background:var(--ajf-accent, #0f4c5c);color:var(--ajf-accent-fg, #fff);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-accept:disabled{border-color:var(--ajf-border-strong, #d5cfc6);background:var(--ajf-band, #faf8f5);color:var(--ajf-text-faint, #a49c92);cursor:default}ajf-signature .ajf-signature-kbd{padding:1px 5px;border-radius:3px;background:var(--ajf-kbd-bg, rgba(255, 255, 255, .22));font-family:var(--ajf-font-mono, monospace);font-size:10px}ajf-signature .ajf-signature-clear{padding:0 4px;border:0;background:none;color:var(--ajf-text-muted, #7a736a);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-clear:hover{text-decoration:underline}ajf-signature .ajf-signature-preview{background:#fff;max-width:200px;max-height:100px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i3.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
110
110
  }
111
111
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AjfSignatureComponent, decorators: [{
112
112
  type: Component,
113
- args: [{ selector: 'ajf-signature', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR], template: "<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n", styles: ["ajf-signature{display:block}ajf-signature .ajf-signature-container{display:flex;flex-wrap:wrap;align-items:center;gap:12px;width:100%}ajf-signature .ajf-signature-pad{position:relative;display:flex;align-items:center;justify-content:center;border:1px dashed var(--ajf-border-strong, #d5cfc6);border-radius:var(--ajf-radius, 4px);background:var(--ajf-surface, #fff)}ajf-signature .ajf-signature-canvas{display:block;touch-action:none}ajf-signature .ajf-signature-text{position:absolute;color:var(--ajf-text-faint, #a49c92);font-family:var(--ajf-font-mono, monospace);font-size:13px;pointer-events:none}ajf-signature .ajf-signature-actions{display:flex;align-items:center;gap:12px}ajf-signature .ajf-signature-accept{display:inline-flex;align-items:center;gap:8px;min-height:var(--ajf-control-h, 44px);padding:0 16px;border:1px solid var(--ajf-accent, #0f4c5c);border-radius:var(--ajf-radius, 4px);background:var(--ajf-accent, #0f4c5c);color:var(--ajf-accent-fg, #fff);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-accept:disabled{border-color:var(--ajf-border-strong, #d5cfc6);background:var(--ajf-band, #faf8f5);color:var(--ajf-text-faint, #a49c92);cursor:default}ajf-signature .ajf-signature-kbd{padding:1px 5px;border-radius:3px;background:var(--ajf-kbd-bg, rgba(255, 255, 255, .22));font-family:var(--ajf-font-mono, monospace);font-size:10px}ajf-signature .ajf-signature-clear{padding:0 4px;border:0;background:none;color:var(--ajf-text-muted, #7a736a);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-clear:hover{text-decoration:underline}ajf-signature .ajf-signature-preview{max-width:200px;max-height:100px}\n"] }]
113
+ args: [{ selector: 'ajf-signature', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR], template: "<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n", styles: ["ajf-signature{display:block}ajf-signature .ajf-signature-container{display:flex;flex-wrap:wrap;align-items:center;gap:12px;width:100%}ajf-signature .ajf-signature-pad{position:relative;display:flex;align-items:center;justify-content:center;border:1px dashed var(--ajf-border-strong, #d5cfc6);border-radius:var(--ajf-radius, 4px);background:#fff}ajf-signature .ajf-signature-canvas{display:block;touch-action:none}ajf-signature .ajf-signature-text{position:absolute;color:var(--ajf-text-faint, #a49c92);font-family:var(--ajf-font-mono, monospace);font-size:13px;pointer-events:none}ajf-signature .ajf-signature-actions{display:flex;align-items:center;gap:12px}ajf-signature .ajf-signature-accept{display:inline-flex;align-items:center;gap:8px;min-height:var(--ajf-control-h, 44px);padding:0 16px;border:1px solid var(--ajf-accent, #0f4c5c);border-radius:var(--ajf-radius, 4px);background:var(--ajf-accent, #0f4c5c);color:var(--ajf-accent-fg, #fff);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-accept:disabled{border-color:var(--ajf-border-strong, #d5cfc6);background:var(--ajf-band, #faf8f5);color:var(--ajf-text-faint, #a49c92);cursor:default}ajf-signature .ajf-signature-kbd{padding:1px 5px;border-radius:3px;background:var(--ajf-kbd-bg, rgba(255, 255, 255, .22));font-family:var(--ajf-font-mono, monospace);font-size:10px}ajf-signature .ajf-signature-clear{padding:0 4px;border:0;background:none;color:var(--ajf-text-muted, #7a736a);font-family:inherit;font-size:14px;cursor:pointer}ajf-signature .ajf-signature-clear:hover{text-decoration:underline}ajf-signature .ajf-signature-preview{background:#fff;max-width:200px;max-height:100px}\n"] }]
114
114
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i1.DomSanitizer }] });
115
115
 
116
116
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ajf-material-signature.mjs","sources":["../../../projects/material/signature/src/signature.ts","../../../projects/material/signature/src/signature.html","../../../projects/material/signature/src/signature-module.ts","../../../projects/material/signature/src/public_api.ts","../../../projects/material/signature/src/ajf-material-signature.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfSignature, canvasToIndexedPngDataUrl} from '@ajf/core/signature';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n OnDestroy,\n Renderer2,\n ViewEncapsulation,\n} from '@angular/core';\nimport {NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {DomSanitizer, SafeUrl} from '@angular/platform-browser';\n\nexport const SIGNATURE_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AjfSignatureComponent),\n multi: true,\n};\n\n/**\n * Ajf signature component.\n */\n@Component({\n selector: 'ajf-signature',\n templateUrl: 'signature.html',\n styleUrls: ['signature.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR],\n})\nexport class AjfSignatureComponent extends AjfSignature implements OnDestroy, AfterViewInit {\n constructor(cdr: ChangeDetectorRef, renderer: Renderer2, private _sanitizer: DomSanitizer) {\n super(cdr, renderer);\n }\n\n ngAfterViewInit(): void {\n this.sigPadElement = this.sigPad.nativeElement;\n this.context = this.sigPadElement?.getContext('2d') ?? null;\n }\n\n /**\n * Clears the signature value and preview (keeps the old url to delete old signature from storage)\n */\n clear() {\n if (this.context != null && this.sigPadElement != null) {\n this.context.clearRect(0, 0, this.sigPadElement.width, this.sigPadElement.height);\n this.context.beginPath();\n }\n this.isDrawn = false;\n this.value = {\n name: 'signature.png',\n type: 'image/png',\n signature: true,\n size: undefined,\n content: undefined,\n url: this.value?.url ?? undefined,\n deleteUrl: true,\n };\n }\n\n /**\n * Accepts the new signature from the canvas and sets it as field value (keeps the old url to delete old signature from storage)\n */\n accept() {\n if (this.sigPadElement != null) {\n // const signatureDataUrl = this.sigPadElement.toDataURL('image/png');\n const signatureDataUrl = canvasToIndexedPngDataUrl(this.sigPadElement);\n\n const head = 'data:image/png;base64,';\n const imgFileSize = Math.round(((signatureDataUrl.length - head.length) * 3) / 4);\n\n this.value = {\n name: 'signature.png',\n type: 'image/png',\n signature: true,\n size: imgFileSize,\n content: signatureDataUrl,\n url: this.value?.url ?? undefined,\n deleteUrl: false,\n };\n }\n }\n\n /**\n * Sanitizes signature image url\n */\n get safeImageSrc(): SafeUrl | string | null {\n if (!this.value) return null;\n if (!this.value.content && this.value.deleteUrl) return null;\n\n const rawUrl =\n this.value.content && this.value.content.length ? this.value.content : this.value.url;\n if (!rawUrl) return null;\n\n const sanitizedUrl = this._sanitizer.bypassSecurityTrustUrl(rawUrl);\n return sanitizedUrl;\n }\n\n ngOnDestroy(): void {\n return;\n }\n}\n","<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCommonModule} from '@ajf/core/common';\nimport {AjfTranslocoModule} from '@ajf/core/transloco';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatIconModule} from '@angular/material/icon';\n\nimport {AjfSignatureComponent} from './signature';\nimport {FormsModule} from '@angular/forms';\n\n@NgModule({\n imports: [\n AjfCommonModule,\n AjfTranslocoModule,\n CommonModule,\n FormsModule,\n MatButtonModule,\n MatIconModule,\n ],\n declarations: [AjfSignatureComponent],\n exports: [AjfSignatureComponent],\n})\nexport class AjfSignatureModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './signature';\n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;+GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAlB,kBAAkB,EAAA,YAAA,EAAA,CAHd,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAPlC,eAAe;YACf,kBAAkB;YAClB,YAAY;YACZ,WAAW;YACX,eAAe;AACf,YAAA,aAAa,aAGL,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAEpB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAV3B,eAAe;YACf,kBAAkB;YAClB,YAAY;YACZ,WAAW;YACX,eAAe;YACf,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAKJ,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAZ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,eAAe;wBACf,kBAAkB;wBAClB,YAAY;wBACZ,WAAW;wBACX,eAAe;wBACf,aAAa;AACd,qBAAA;oBACD,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AACjC,iBAAA;;;AC3CD;;;;;;;;;;;;;;;;;;;;AAoBG;;ACpBH;;AAEG;;;;"}
1
+ {"version":3,"file":"ajf-material-signature.mjs","sources":["../../../projects/material/signature/src/signature.ts","../../../projects/material/signature/src/signature.html","../../../projects/material/signature/src/signature-module.ts","../../../projects/material/signature/src/public_api.ts","../../../projects/material/signature/src/ajf-material-signature.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfSignature, canvasToIndexedPngDataUrl} from '@ajf/core/signature';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n OnDestroy,\n Renderer2,\n ViewEncapsulation,\n} from '@angular/core';\nimport {NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {DomSanitizer, SafeUrl} from '@angular/platform-browser';\n\nexport const SIGNATURE_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AjfSignatureComponent),\n multi: true,\n};\n\n/**\n * Ajf signature component.\n */\n@Component({\n selector: 'ajf-signature',\n templateUrl: 'signature.html',\n styleUrls: ['signature.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [SIGNATURE_CONTROL_VALUE_ACCESSOR],\n})\nexport class AjfSignatureComponent extends AjfSignature implements OnDestroy, AfterViewInit {\n constructor(cdr: ChangeDetectorRef, renderer: Renderer2, private _sanitizer: DomSanitizer) {\n super(cdr, renderer);\n }\n\n ngAfterViewInit(): void {\n this.sigPadElement = this.sigPad.nativeElement;\n this.context = this.sigPadElement?.getContext('2d') ?? null;\n }\n\n /**\n * Clears the signature value and preview (keeps the old url to delete old signature from storage)\n */\n clear() {\n if (this.context != null && this.sigPadElement != null) {\n this.context.clearRect(0, 0, this.sigPadElement.width, this.sigPadElement.height);\n this.context.beginPath();\n }\n this.isDrawn = false;\n this.value = {\n name: 'signature.png',\n type: 'image/png',\n signature: true,\n size: undefined,\n content: undefined,\n url: this.value?.url ?? undefined,\n deleteUrl: true,\n };\n }\n\n /**\n * Accepts the new signature from the canvas and sets it as field value (keeps the old url to delete old signature from storage)\n */\n accept() {\n if (this.sigPadElement != null) {\n // const signatureDataUrl = this.sigPadElement.toDataURL('image/png');\n const signatureDataUrl = canvasToIndexedPngDataUrl(this.sigPadElement);\n\n const head = 'data:image/png;base64,';\n const imgFileSize = Math.round(((signatureDataUrl.length - head.length) * 3) / 4);\n\n this.value = {\n name: 'signature.png',\n type: 'image/png',\n signature: true,\n size: imgFileSize,\n content: signatureDataUrl,\n url: this.value?.url ?? undefined,\n deleteUrl: false,\n };\n }\n }\n\n /**\n * Sanitizes signature image url\n */\n get safeImageSrc(): SafeUrl | string | null {\n if (!this.value) return null;\n if (!this.value.content && this.value.deleteUrl) return null;\n\n const rawUrl =\n this.value.content && this.value.content.length ? this.value.content : this.value.url;\n if (!rawUrl) return null;\n\n const sanitizedUrl = this._sanitizer.bypassSecurityTrustUrl(rawUrl);\n return sanitizedUrl;\n }\n\n ngOnDestroy(): void {\n return;\n }\n}\n","<div class=\"ajf-signature-container\">\n <div class=\"ajf-signature-pad\">\n <canvas\n class=\"ajf-signature-canvas\"\n #sigPad\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (touchstart)=\"onMouseDown($event)\"\n (touchmove)=\"onMouseMove($event)\"\n ></canvas>\n <span class=\"ajf-signature-text\" *ngIf=\"!isDrawn && !safeImageSrc\">{{\n 'Sign here to continue' | transloco\n }}</span>\n </div>\n\n <div class=\"ajf-signature-actions\">\n <button\n type=\"button\"\n class=\"ajf-signature-accept\"\n (click)=\"accept()\"\n [disabled]=\"!isDrawn\"\n >\n {{ 'Approve signature' | transloco }}\n <span class=\"ajf-signature-kbd\" aria-hidden=\"true\">&#8984;&crarr;</span>\n </button>\n <button type=\"button\" class=\"ajf-signature-clear\" (click)=\"clear()\">\n {{ 'Clear' | transloco }}\n </button>\n </div>\n\n <img class=\"ajf-signature-preview\" *ngIf=\"safeImageSrc\" [src]=\"safeImageSrc\" alt=\"\" />\n</div>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCommonModule} from '@ajf/core/common';\nimport {AjfTranslocoModule} from '@ajf/core/transloco';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatIconModule} from '@angular/material/icon';\n\nimport {AjfSignatureComponent} from './signature';\nimport {FormsModule} from '@angular/forms';\n\n@NgModule({\n imports: [\n AjfCommonModule,\n AjfTranslocoModule,\n CommonModule,\n FormsModule,\n MatButtonModule,\n MatIconModule,\n ],\n declarations: [AjfSignatureComponent],\n exports: [AjfSignatureComponent],\n})\nexport class AjfSignatureModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './signature';\nexport * from './signature-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAgBU,MAAA,gCAAgC,GAAQ;AACnD,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,qBAAqB,CAAC;AACpD,IAAA,KAAK,EAAE,IAAI;;AAGb;;AAEG;AASG,MAAO,qBAAsB,SAAQ,YAAY,CAAA;AACrD,IAAA,WAAA,CAAY,GAAsB,EAAE,QAAmB,EAAU,UAAwB,EAAA;AACvF,QAAA,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC;QAD2C,IAAU,CAAA,UAAA,GAAV,UAAU;;IAI3E,eAAe,GAAA;QACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI;;AAG7D;;AAEG;IACH,KAAK,GAAA;AACH,QAAA,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;YACtD,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;AACjF,YAAA,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;;AAE1B,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK;QACpB,IAAI,CAAC,KAAK,GAAG;AACX,YAAA,IAAI,EAAE,eAAe;AACrB,YAAA,IAAI,EAAE,WAAW;AACjB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE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/C;;;;;;;;;;;;;;;;;;;;AAoBG;MAwBU,kBAAkB,CAAA;+GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAlB,kBAAkB,EAAA,YAAA,EAAA,CAHd,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAPlC,eAAe;YACf,kBAAkB;YAClB,YAAY;YACZ,WAAW;YACX,eAAe;AACf,YAAA,aAAa,aAGL,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAEpB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAV3B,eAAe;YACf,kBAAkB;YAClB,YAAY;YACZ,WAAW;YACX,eAAe;YACf,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAKJ,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAZ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,eAAe;wBACf,kBAAkB;wBAClB,YAAY;wBACZ,WAAW;wBACX,eAAe;wBACf,aAAa;AACd,qBAAA;oBACD,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AACjC,iBAAA;;;AC3CD;;;;;;;;;;;;;;;;;;;;AAoBG;;ACpBH;;AAEG;;;;"}
@@ -89,6 +89,16 @@ export interface AjfFormBuilderMoveEvent {
89
89
  }
90
90
  export type AjfFormBuilderNode = AjfFormBuilderNodeEntry | AjfFormBuilderEmptySlot;
91
91
  export type AjfContainerNode = AjfSlide | AjfRepeatingSlide | AjfNodeGroup;
92
+ /**
93
+ * True when the palette entry creates a node group. Groups can be dropped
94
+ * into a slide or a repeating slide, never into another group.
95
+ */
96
+ export declare function isGroupNodeType(nodeType: AjfFormBuilderNodeTypeEntry): boolean;
97
+ /**
98
+ * True when the node can be placed among the content of the container: a slide
99
+ * holds fields and groups, a group holds fields only.
100
+ */
101
+ export declare function canContainNode(container: AjfNode, node: AjfNode): boolean;
92
102
  /**
93
103
  * Take the defaultValue from the ajf form defaultValue prop (non formula)
94
104
  * and return the value to be shown in the properties box
@@ -193,6 +203,7 @@ export declare class AjfFormBuilderService {
193
203
  */
194
204
  private _emptyFieldCounter;
195
205
  private _emptySlideCounter;
206
+ private _emptyGroupCounter;
196
207
  constructor();
197
208
  /**
198
209
  * Sets the current edited form
@@ -231,6 +242,14 @@ export declare class AjfFormBuilderService {
231
242
  * @param nodeEntry The node to be moved.
232
243
  */
233
244
  moveNodeEntry(nodeEntry: AjfFormBuilderNodeEntry, from: number, to: number): void;
245
+ /**
246
+ * Moves a node into another container, e.g. a field from a slide into a
247
+ * group, or out of it.
248
+ * @param nodeEntry The node to be moved.
249
+ * @param container The container the node is moved into.
250
+ * @param toIndex The position of the node among the content of the container.
251
+ */
252
+ moveNodeEntryToContainer(nodeEntry: AjfFormBuilderNodeEntry, container: AjfContainerNode, toIndex: number): void;
234
253
  getCurrentForm(): Observable<AjfForm>;
235
254
  editChoicesOrigin(choicesOrigin: AjfChoicesOrigin<any>): void;
236
255
  createChoicesOrigin(): void;
@@ -291,6 +310,10 @@ export declare class AjfFormBuilderService {
291
310
  /**
292
311
  * Adds the id of a dropList to be connected with the FormBuilder source list.
293
312
  * @param listId The id of the list to connect.
313
+ * @param first True to put the list before the others. The list of a group
314
+ * lies inside the list of its slide, and the CDK moves a dragged item into
315
+ * the first connected list under the pointer: the inner list has to come
316
+ * first, or it could never receive anything.
294
317
  */
295
318
  private _connectDropList;
296
319
  private _findMaxNodeId;
@@ -19,6 +19,7 @@
19
19
  * If not, see http://www.gnu.org/licenses/.
20
20
  *
21
21
  */
22
+ import { AjfNode } from '@ajf/core/forms';
22
23
  import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
23
24
  import { AjfFormBuilderNode, AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntry, AjfFormBuilderService } from './form-builder-service';
24
25
  /**
@@ -29,6 +30,13 @@ import { AjfFormBuilderNode, AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntr
29
30
  * @param content True if the current nodeEntry contains other nodeEntries.
30
31
  */
31
32
  export declare function onDropProcess(event: CdkDragDrop<AjfFormBuilderNodeEntry> | CdkDragDrop<AjfFormBuilderNodeTypeEntry>, fbService: AjfFormBuilderService, nodeEntry: AjfFormBuilderNode | null, content?: boolean): void;
33
+ /**
34
+ * Tells whether the dragged item can be dropped among the content of the
35
+ * container: a slide takes fields and groups, a group takes fields only.
36
+ * @param item The dragged item, either a palette entry or a node of the form.
37
+ * @param container The container node owning the drop list.
38
+ */
39
+ export declare function canDropInContainer(item: CdkDrag<AjfFormBuilderNodeTypeEntry | AjfFormBuilderNodeEntry>, container: AjfNode): boolean;
32
40
  /**
33
41
  * Disables the drag&drop of Slide items.
34
42
  * @param item The dragged item.
@@ -63,6 +63,11 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
63
63
  set firstBranchColor(firstBranchColor: string);
64
64
  private _currentEditedNode;
65
65
  get currentEditedNode(): Observable<AjfFormBuilderNodeEntry | null>;
66
+ /**
67
+ * The ids of the drop lists an item dragged from the content of this node can
68
+ * be moved into, the lists of the groups first.
69
+ */
70
+ get connectedDropLists(): Observable<string[]>;
66
71
  private _branchLinesSubscription;
67
72
  private _childEntriesSubscription;
68
73
  constructor(_service: AjfFormBuilderService);
@@ -86,6 +91,11 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
86
91
  * @param empty True if the list is marked as empty.
87
92
  */
88
93
  assignId(empty?: boolean): string;
94
+ /**
95
+ * The enter predicate of the drop lists holding the content of this node.
96
+ * An arrow function, since the CDK calls it with no `this`.
97
+ */
98
+ contentDropPredicate: (item: CdkDrag) => boolean;
89
99
  disableSlideDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
90
100
  disableFieldDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
91
101
  emptyAreaDropPredicate(): (item: CdkDrag, _drop: CdkDropList) => boolean;
@@ -77,7 +77,11 @@ export declare class AjfFbNodeProperties implements OnDestroy, OnInit {
77
77
  get nextSlideCondition(): string | undefined;
78
78
  private _triggerConditions;
79
79
  get triggerConditions(): string[];
80
- isRepeatingContainerNode: (nodeEntry: AjfFormBuilderNodeEntry | null) => boolean;
80
+ /**
81
+ * True for a repeating slide. A group is a repeating container node too, but
82
+ * the renderer never repeats it, so it gets no repetitions to edit.
83
+ */
84
+ isRepeatingSlide: (nodeEntry: AjfFormBuilderNodeEntry | null) => boolean;
81
85
  private _visibilityOptSub;
82
86
  private _visibilitySub;
83
87
  private _conditionalBranchesSub;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajf/material",
3
- "version": "18.5.0",
3
+ "version": "18.5.2",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "homepage": "https://github.com/gnucoop/ajf#readme",
15
15
  "peerDependencies": {
16
- "@ajf/core": "18.5.0",
16
+ "@ajf/core": "18.5.2",
17
17
  "@angular/animations": "^18.2.13",
18
18
  "@angular/cdk": "^18.2.14",
19
19
  "@angular/common": "^18.2.13",