@ng-formworks/core 17.2.7 → 17.3.0
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.
- package/LICENSE +21 -0
- package/README.md +833 -0
- package/esm2022/lib/framework-library/framework-library.service.mjs +175 -0
- package/esm2022/lib/framework-library/framework.mjs +15 -0
- package/esm2022/lib/framework-library/no-framework.component.mjs +18 -0
- package/esm2022/lib/framework-library/no-framework.module.mjs +27 -0
- package/esm2022/lib/framework-library/no.framework.mjs +19 -0
- package/esm2022/lib/json-schema-form.component.mjs +765 -0
- package/esm2022/lib/json-schema-form.module.mjs +26 -0
- package/esm2022/lib/json-schema-form.service.mjs +676 -0
- package/esm2022/lib/locale/de-validation-messages.mjs +60 -0
- package/esm2022/lib/locale/en-validation-messages.mjs +60 -0
- package/esm2022/lib/locale/es-validation-messages.mjs +57 -0
- package/esm2022/lib/locale/fr-validation-messages.mjs +60 -0
- package/esm2022/lib/locale/index.mjs +8 -0
- package/esm2022/lib/locale/it-validation-messages.mjs +60 -0
- package/esm2022/lib/locale/pt-validation-messages.mjs +60 -0
- package/esm2022/lib/locale/zh-validation-messages.mjs +60 -0
- package/esm2022/lib/shared/convert-schema-to-draft6.function.mjs +300 -0
- package/esm2022/lib/shared/form-group.functions.mjs +442 -0
- package/esm2022/lib/shared/format-regex.constants.mjs +54 -0
- package/esm2022/lib/shared/index.mjs +12 -0
- package/esm2022/lib/shared/json-schema.functions.mjs +784 -0
- package/esm2022/lib/shared/json.validators.mjs +884 -0
- package/esm2022/lib/shared/jsonpointer.functions.mjs +1026 -0
- package/esm2022/lib/shared/layout.functions.mjs +1154 -0
- package/esm2022/lib/shared/merge-schemas.function.mjs +345 -0
- package/esm2022/lib/shared/utility.functions.mjs +380 -0
- package/esm2022/lib/shared/validator.functions.mjs +584 -0
- package/esm2022/lib/widget-library/add-reference.component.mjs +61 -0
- package/esm2022/lib/widget-library/button.component.mjs +72 -0
- package/esm2022/lib/widget-library/checkbox.component.mjs +105 -0
- package/esm2022/lib/widget-library/checkboxes.component.mjs +147 -0
- package/esm2022/lib/widget-library/file.component.mjs +35 -0
- package/esm2022/lib/widget-library/hidden.component.mjs +54 -0
- package/esm2022/lib/widget-library/index.mjs +55 -0
- package/esm2022/lib/widget-library/input.component.mjs +119 -0
- package/esm2022/lib/widget-library/message.component.mjs +38 -0
- package/esm2022/lib/widget-library/none.component.mjs +21 -0
- package/esm2022/lib/widget-library/number.component.mjs +123 -0
- package/esm2022/lib/widget-library/one-of.component.mjs +35 -0
- package/esm2022/lib/widget-library/orderable.directive.mjs +123 -0
- package/esm2022/lib/widget-library/radios.component.mjs +153 -0
- package/esm2022/lib/widget-library/root.component.mjs +79 -0
- package/esm2022/lib/widget-library/section.component.mjs +199 -0
- package/esm2022/lib/widget-library/select-framework.component.mjs +51 -0
- package/esm2022/lib/widget-library/select-widget.component.mjs +46 -0
- package/esm2022/lib/widget-library/select.component.mjs +150 -0
- package/esm2022/lib/widget-library/submit.component.mjs +82 -0
- package/esm2022/lib/widget-library/tab.component.mjs +41 -0
- package/esm2022/lib/widget-library/tabs.component.mjs +108 -0
- package/esm2022/lib/widget-library/template.component.mjs +46 -0
- package/esm2022/lib/widget-library/textarea.component.mjs +104 -0
- package/esm2022/lib/widget-library/widget-library.module.mjs +42 -0
- package/esm2022/lib/widget-library/widget-library.service.mjs +226 -0
- package/esm2022/ng-formworks-core.mjs +5 -0
- package/esm2022/public_api.mjs +13 -0
- package/fesm2022/ng-formworks-core.mjs +10147 -0
- package/fesm2022/ng-formworks-core.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/framework-library/framework-library.service.d.ts +55 -0
- package/lib/framework-library/framework.d.ts +13 -0
- package/lib/framework-library/no-framework.component.d.ts +8 -0
- package/lib/framework-library/no-framework.module.d.ts +9 -0
- package/lib/framework-library/no.framework.d.ts +10 -0
- package/lib/json-schema-form.component.d.ts +218 -0
- package/lib/json-schema-form.module.d.ts +11 -0
- package/lib/json-schema-form.service.d.ts +115 -0
- package/lib/locale/de-validation-messages.d.ts +1 -0
- package/lib/locale/en-validation-messages.d.ts +1 -0
- package/lib/locale/es-validation-messages.d.ts +1 -0
- package/lib/locale/fr-validation-messages.d.ts +1 -0
- package/{src/lib/locale/index.ts → lib/locale/index.d.ts} +7 -7
- package/lib/locale/it-validation-messages.d.ts +1 -0
- package/lib/locale/pt-validation-messages.d.ts +1 -0
- package/lib/locale/zh-validation-messages.d.ts +1 -0
- package/lib/shared/convert-schema-to-draft6.function.d.ts +21 -0
- package/lib/shared/form-group.functions.d.ts +100 -0
- package/lib/shared/format-regex.constants.d.ts +19 -0
- package/lib/shared/index.d.ts +9 -0
- package/lib/shared/json-schema.functions.d.ts +193 -0
- package/lib/shared/json.validators.d.ts +441 -0
- package/lib/shared/jsonpointer.functions.d.ts +416 -0
- package/lib/shared/layout.functions.d.ts +83 -0
- package/lib/shared/merge-schemas.function.d.ts +19 -0
- package/lib/shared/utility.functions.d.ts +165 -0
- package/{src/lib/shared/validator.functions.ts → lib/shared/validator.functions.d.ts} +364 -601
- package/lib/widget-library/add-reference.component.d.ts +20 -0
- package/lib/widget-library/button.component.d.ts +21 -0
- package/lib/widget-library/checkbox.component.d.ts +24 -0
- package/lib/widget-library/checkboxes.component.d.ts +24 -0
- package/lib/widget-library/file.component.d.ts +21 -0
- package/lib/widget-library/hidden.component.d.ts +19 -0
- package/{src/lib/widget-library/index.ts → lib/widget-library/index.d.ts} +47 -56
- package/lib/widget-library/input.component.d.ts +22 -0
- package/lib/widget-library/message.component.d.ts +15 -0
- package/lib/widget-library/none.component.d.ts +8 -0
- package/lib/widget-library/number.component.d.ts +25 -0
- package/lib/widget-library/one-of.component.d.ts +21 -0
- package/lib/widget-library/orderable.directive.d.ts +41 -0
- package/lib/widget-library/radios.component.d.ts +23 -0
- package/lib/widget-library/root.component.d.ts +17 -0
- package/lib/widget-library/section.component.d.ts +19 -0
- package/lib/widget-library/select-framework.component.d.ts +18 -0
- package/lib/widget-library/select-widget.component.d.ts +18 -0
- package/lib/widget-library/select.component.d.ts +24 -0
- package/lib/widget-library/submit.component.d.ts +24 -0
- package/lib/widget-library/tab.component.d.ts +14 -0
- package/lib/widget-library/tabs.component.d.ts +20 -0
- package/lib/widget-library/template.component.d.ts +18 -0
- package/lib/widget-library/textarea.component.d.ts +21 -0
- package/lib/widget-library/widget-library.module.d.ts +31 -0
- package/lib/widget-library/widget-library.service.d.ts +22 -0
- package/package.json +64 -53
- package/{src/public_api.ts → public_api.d.ts} +9 -21
- package/karma.conf.js +0 -46
- package/ng-package.json +0 -11
- package/src/lib/framework-library/framework-library.service.ts +0 -195
- package/src/lib/framework-library/framework.ts +0 -11
- package/src/lib/framework-library/no-framework.component.html +0 -2
- package/src/lib/framework-library/no-framework.component.ts +0 -11
- package/src/lib/framework-library/no-framework.module.ts +0 -18
- package/src/lib/framework-library/no.framework.ts +0 -11
- package/src/lib/json-schema-form.component.html +0 -7
- package/src/lib/json-schema-form.component.ts +0 -809
- package/src/lib/json-schema-form.module.ts +0 -17
- package/src/lib/json-schema-form.service.ts +0 -907
- package/src/lib/locale/de-validation-messages.ts +0 -58
- package/src/lib/locale/en-validation-messages.ts +0 -58
- package/src/lib/locale/es-validation-messages.ts +0 -55
- package/src/lib/locale/fr-validation-messages.ts +0 -58
- package/src/lib/locale/it-validation-messages.ts +0 -58
- package/src/lib/locale/pt-validation-messages.ts +0 -58
- package/src/lib/locale/zh-validation-messages.ts +0 -58
- package/src/lib/locale-dates/en-US.ts +0 -5
- package/src/lib/shared/convert-schema-to-draft6.function.ts +0 -321
- package/src/lib/shared/form-group.functions.ts +0 -522
- package/src/lib/shared/format-regex.constants.ts +0 -73
- package/src/lib/shared/index.ts +0 -40
- package/src/lib/shared/json-schema.functions.ts +0 -788
- package/src/lib/shared/json.validators.ts +0 -878
- package/src/lib/shared/jsonpointer.functions.ts +0 -1012
- package/src/lib/shared/jspointer.functions.json.spec.ts +0 -103
- package/src/lib/shared/layout.functions.ts +0 -1233
- package/src/lib/shared/merge-schemas.function.ts +0 -329
- package/src/lib/shared/utility.functions.ts +0 -373
- package/src/lib/shared/validator.functions.spec.ts +0 -55
- package/src/lib/widget-library/add-reference.component.ts +0 -59
- package/src/lib/widget-library/button.component.ts +0 -54
- package/src/lib/widget-library/checkbox.component.ts +0 -74
- package/src/lib/widget-library/checkboxes.component.ts +0 -104
- package/src/lib/widget-library/file.component.ts +0 -36
- package/src/lib/widget-library/hidden.component.ts +0 -39
- package/src/lib/widget-library/input.component.ts +0 -76
- package/src/lib/widget-library/message.component.ts +0 -29
- package/src/lib/widget-library/none.component.ts +0 -12
- package/src/lib/widget-library/number.component.ts +0 -79
- package/src/lib/widget-library/one-of.component.ts +0 -36
- package/src/lib/widget-library/orderable.directive.ts +0 -130
- package/src/lib/widget-library/radios.component.ts +0 -101
- package/src/lib/widget-library/root.component.ts +0 -78
- package/src/lib/widget-library/section.component.ts +0 -133
- package/src/lib/widget-library/select-framework.component.ts +0 -50
- package/src/lib/widget-library/select-widget.component.ts +0 -46
- package/src/lib/widget-library/select.component.ts +0 -96
- package/src/lib/widget-library/submit.component.ts +0 -68
- package/src/lib/widget-library/tab.component.ts +0 -29
- package/src/lib/widget-library/tabs.component.ts +0 -83
- package/src/lib/widget-library/template.component.ts +0 -52
- package/src/lib/widget-library/textarea.component.ts +0 -68
- package/src/lib/widget-library/widget-library.module.ts +0 -13
- package/src/lib/widget-library/widget-library.service.ts +0 -234
- package/src/test.ts +0 -18
- package/tsconfig.lib.json +0 -25
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -11
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { AbstractControl } from '@angular/forms';
|
|
2
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
3
|
-
import { JsonSchemaFormService } from '../json-schema-form.service';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'textarea-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<div
|
|
11
|
-
[class]="options?.htmlClass || ''">
|
|
12
|
-
<label *ngIf="options?.title"
|
|
13
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
14
|
-
[class]="options?.labelHtmlClass || ''"
|
|
15
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
16
|
-
[innerHTML]="options?.title"></label>
|
|
17
|
-
<textarea *ngIf="boundControl"
|
|
18
|
-
[formControl]="formControl"
|
|
19
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
20
|
-
[attr.maxlength]="options?.maxLength"
|
|
21
|
-
[attr.minlength]="options?.minLength"
|
|
22
|
-
[attr.pattern]="options?.pattern"
|
|
23
|
-
[attr.placeholder]="options?.placeholder"
|
|
24
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
25
|
-
[attr.required]="options?.required"
|
|
26
|
-
[class]="options?.fieldHtmlClass || ''"
|
|
27
|
-
[id]="'control' + layoutNode?._id"
|
|
28
|
-
[name]="controlName"></textarea>
|
|
29
|
-
<textarea *ngIf="!boundControl"
|
|
30
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
31
|
-
[attr.maxlength]="options?.maxLength"
|
|
32
|
-
[attr.minlength]="options?.minLength"
|
|
33
|
-
[attr.pattern]="options?.pattern"
|
|
34
|
-
[attr.placeholder]="options?.placeholder"
|
|
35
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
36
|
-
[attr.required]="options?.required"
|
|
37
|
-
[class]="options?.fieldHtmlClass || ''"
|
|
38
|
-
[disabled]="controlDisabled"
|
|
39
|
-
[id]="'control' + layoutNode?._id"
|
|
40
|
-
[name]="controlName"
|
|
41
|
-
[value]="controlValue"
|
|
42
|
-
(input)="updateValue($event)">{{controlValue}}</textarea>
|
|
43
|
-
</div>`,
|
|
44
|
-
})
|
|
45
|
-
export class TextareaComponent implements OnInit {
|
|
46
|
-
formControl: AbstractControl;
|
|
47
|
-
controlName: string;
|
|
48
|
-
controlValue: any;
|
|
49
|
-
controlDisabled = false;
|
|
50
|
-
boundControl = false;
|
|
51
|
-
options: any;
|
|
52
|
-
@Input() layoutNode: any;
|
|
53
|
-
@Input() layoutIndex: number[];
|
|
54
|
-
@Input() dataIndex: number[];
|
|
55
|
-
|
|
56
|
-
constructor(
|
|
57
|
-
private jsf: JsonSchemaFormService
|
|
58
|
-
) { }
|
|
59
|
-
|
|
60
|
-
ngOnInit() {
|
|
61
|
-
this.options = this.layoutNode.options || {};
|
|
62
|
-
this.jsf.initializeControl(this);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
updateValue(event) {
|
|
66
|
-
this.jsf.updateValue(this, event.target.value);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BASIC_WIDGETS } from './index';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { NgModule } from '@angular/core';
|
|
5
|
-
import { OrderableDirective } from './orderable.directive';
|
|
6
|
-
|
|
7
|
-
@NgModule({
|
|
8
|
-
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
|
9
|
-
declarations: [...BASIC_WIDGETS, OrderableDirective],
|
|
10
|
-
exports: [...BASIC_WIDGETS, OrderableDirective]
|
|
11
|
-
})
|
|
12
|
-
export class WidgetLibraryModule {
|
|
13
|
-
}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { AddReferenceComponent } from './add-reference.component';
|
|
2
|
-
import { ButtonComponent } from './button.component';
|
|
3
|
-
import { CheckboxComponent } from './checkbox.component';
|
|
4
|
-
import { CheckboxesComponent } from './checkboxes.component';
|
|
5
|
-
import { FileComponent } from './file.component';
|
|
6
|
-
import { hasOwn } from '../shared/utility.functions';
|
|
7
|
-
import { Injectable } from '@angular/core';
|
|
8
|
-
import { InputComponent } from './input.component';
|
|
9
|
-
import { MessageComponent } from './message.component';
|
|
10
|
-
import { NoneComponent } from './none.component';
|
|
11
|
-
import { NumberComponent } from './number.component';
|
|
12
|
-
import { OneOfComponent } from './one-of.component';
|
|
13
|
-
import { RadiosComponent } from './radios.component';
|
|
14
|
-
import { RootComponent } from './root.component';
|
|
15
|
-
import { SectionComponent } from './section.component';
|
|
16
|
-
import { SelectComponent } from './select.component';
|
|
17
|
-
import { SelectFrameworkComponent } from './select-framework.component';
|
|
18
|
-
import { SelectWidgetComponent } from './select-widget.component';
|
|
19
|
-
import { SubmitComponent } from './submit.component';
|
|
20
|
-
import { TabsComponent } from './tabs.component';
|
|
21
|
-
import { TemplateComponent } from './template.component';
|
|
22
|
-
import { TextareaComponent } from './textarea.component';
|
|
23
|
-
|
|
24
|
-
@Injectable({
|
|
25
|
-
providedIn: 'root',
|
|
26
|
-
})
|
|
27
|
-
export class WidgetLibraryService {
|
|
28
|
-
|
|
29
|
-
defaultWidget = 'text';
|
|
30
|
-
widgetLibrary: any = {
|
|
31
|
-
|
|
32
|
-
// Angular JSON Schema Form administrative widgets
|
|
33
|
-
'none': NoneComponent, // Placeholder, for development - displays nothing
|
|
34
|
-
'root': RootComponent, // Form root, renders a complete layout
|
|
35
|
-
'select-framework': SelectFrameworkComponent, // Applies the selected framework to a specified widget
|
|
36
|
-
'select-widget': SelectWidgetComponent, // Displays a specified widget
|
|
37
|
-
'$ref': AddReferenceComponent, // Button to add a new array item or $ref element
|
|
38
|
-
|
|
39
|
-
// Free-form text HTML 'input' form control widgets <input type="...">
|
|
40
|
-
'email': 'text',
|
|
41
|
-
'integer': 'number', // Note: 'integer' is not a recognized HTML input type
|
|
42
|
-
'number': NumberComponent,
|
|
43
|
-
'password': 'text',
|
|
44
|
-
'search': 'text',
|
|
45
|
-
'tel': 'text',
|
|
46
|
-
'text': InputComponent,
|
|
47
|
-
'url': 'text',
|
|
48
|
-
|
|
49
|
-
// Controlled text HTML 'input' form control widgets <input type="...">
|
|
50
|
-
'color': 'text',
|
|
51
|
-
'date': 'text',
|
|
52
|
-
'datetime': 'text',
|
|
53
|
-
'datetime-local': 'text',
|
|
54
|
-
'month': 'text',
|
|
55
|
-
'range': 'number',
|
|
56
|
-
'time': 'text',
|
|
57
|
-
'week': 'text',
|
|
58
|
-
|
|
59
|
-
// Non-text HTML 'input' form control widgets <input type="...">
|
|
60
|
-
// 'button': <input type="button"> not used, use <button> instead
|
|
61
|
-
'checkbox': CheckboxComponent, // TODO: Set ternary = true for 3-state ??
|
|
62
|
-
'file': FileComponent, // TODO: Finish 'file' widget
|
|
63
|
-
'hidden': 'text',
|
|
64
|
-
'image': 'text', // TODO: Figure out how to handle these
|
|
65
|
-
'radio': 'radios',
|
|
66
|
-
'reset': 'submit', // TODO: Figure out how to handle these
|
|
67
|
-
'submit': SubmitComponent,
|
|
68
|
-
|
|
69
|
-
// Other (non-'input') HTML form control widgets
|
|
70
|
-
'button': ButtonComponent,
|
|
71
|
-
'select': SelectComponent,
|
|
72
|
-
// 'option': automatically generated by select widgets
|
|
73
|
-
// 'optgroup': automatically generated by select widgets
|
|
74
|
-
'textarea': TextareaComponent,
|
|
75
|
-
|
|
76
|
-
// HTML form control widget sets
|
|
77
|
-
'checkboxes': CheckboxesComponent, // Grouped list of checkboxes
|
|
78
|
-
'checkboxes-inline': 'checkboxes', // Checkboxes in one line
|
|
79
|
-
'checkboxbuttons': 'checkboxes', // Checkboxes as html buttons
|
|
80
|
-
'radios': RadiosComponent, // Grouped list of radio buttons
|
|
81
|
-
'radios-inline': 'radios', // Radio controls in one line
|
|
82
|
-
'radiobuttons': 'radios', // Radio controls as html buttons
|
|
83
|
-
|
|
84
|
-
// HTML Layout widgets
|
|
85
|
-
// 'label': automatically added to data widgets
|
|
86
|
-
// 'legend': automatically added to fieldsets
|
|
87
|
-
'section': SectionComponent, // Just a div <div>
|
|
88
|
-
'div': 'section', // Still just a div <div>
|
|
89
|
-
'fieldset': 'section', // A fieldset, with an optional legend <fieldset>
|
|
90
|
-
'flex': 'section', // A flexbox container <div style="display: flex">
|
|
91
|
-
|
|
92
|
-
// Non-HTML layout widgets
|
|
93
|
-
'one-of': OneOfComponent, // A select box that changes another input
|
|
94
|
-
// TODO: Finish 'one-of' widget
|
|
95
|
-
'array': 'section', // A list you can add, remove and reorder <fieldset>
|
|
96
|
-
'tabarray': 'tabs', // A tabbed version of array
|
|
97
|
-
'tab': 'section', // A tab group, similar to a fieldset or section <fieldset>
|
|
98
|
-
'tabs': TabsComponent, // A tabbed set of panels with different controls
|
|
99
|
-
'message': MessageComponent, // Insert arbitrary html
|
|
100
|
-
'help': 'message', // Insert arbitrary html
|
|
101
|
-
'msg': 'message', // Insert arbitrary html
|
|
102
|
-
'html': 'message', // Insert arbitrary html
|
|
103
|
-
'template': TemplateComponent, // Insert a custom Angular component
|
|
104
|
-
|
|
105
|
-
// Widgets included for compatibility with JSON Form API
|
|
106
|
-
'advancedfieldset': 'section', // Adds 'Advanced settings' title <fieldset>
|
|
107
|
-
'authfieldset': 'section', // Adds 'Authentication settings' title <fieldset>
|
|
108
|
-
'optionfieldset': 'one-of', // Option control, displays selected sub-item <fieldset>
|
|
109
|
-
'selectfieldset': 'one-of', // Select control, displays selected sub-item <fieldset>
|
|
110
|
-
'conditional': 'section', // Identical to 'section' (depeciated) <div>
|
|
111
|
-
'actions': 'section', // Horizontal button list, can only submit, uses buttons as items <div>
|
|
112
|
-
'tagsinput': 'section', // For entering short text tags <div>
|
|
113
|
-
// See: http://ulion.github.io/jsonform/playground/?example=fields-checkboxbuttons
|
|
114
|
-
|
|
115
|
-
// Widgets included for compatibility with React JSON Schema Form API
|
|
116
|
-
'updown': 'number',
|
|
117
|
-
'date-time': 'datetime-local',
|
|
118
|
-
'alt-datetime': 'datetime-local',
|
|
119
|
-
'alt-date': 'date',
|
|
120
|
-
|
|
121
|
-
// Widgets included for compatibility with Angular Schema Form API
|
|
122
|
-
'wizard': 'section', // TODO: Sequential panels with "Next" and "Previous" buttons
|
|
123
|
-
|
|
124
|
-
// Widgets included for compatibility with other libraries
|
|
125
|
-
'textline': 'text',
|
|
126
|
-
|
|
127
|
-
// Recommended 3rd-party add-on widgets (TODO: create wrappers for these...)
|
|
128
|
-
// 'ng2-select': Select control replacement - http://valor-software.com/ng2-select/
|
|
129
|
-
// 'flatpickr': Flatpickr date picker - https://github.com/chmln/flatpickr
|
|
130
|
-
// 'pikaday': Pikaday date picker - https://github.com/dbushell/Pikaday
|
|
131
|
-
// 'spectrum': Spectrum color picker - http://bgrins.github.io/spectrum
|
|
132
|
-
// 'bootstrap-slider': Bootstrap Slider range control - https://github.com/seiyria/bootstrap-slider
|
|
133
|
-
// 'ace': ACE code editor - https://ace.c9.io
|
|
134
|
-
// 'ckeditor': CKEditor HTML / rich text editor - http://ckeditor.com
|
|
135
|
-
// 'tinymce': TinyMCE HTML / rich text editor - https://www.tinymce.com
|
|
136
|
-
// 'imageselect': Bootstrap drop-down image selector - http://silviomoreto.github.io/bootstrap-select
|
|
137
|
-
// 'wysihtml5': HTML editor - http://jhollingworth.github.io/bootstrap-wysihtml5
|
|
138
|
-
// 'quill': Quill HTML / rich text editor (?) - https://quilljs.com
|
|
139
|
-
};
|
|
140
|
-
registeredWidgets: any = { };
|
|
141
|
-
frameworkWidgets: any = { };
|
|
142
|
-
activeWidgets: any = { };
|
|
143
|
-
|
|
144
|
-
constructor() {
|
|
145
|
-
this.setActiveWidgets();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
setActiveWidgets(): boolean {
|
|
149
|
-
this.activeWidgets = Object.assign(
|
|
150
|
-
{ }, this.widgetLibrary, this.frameworkWidgets, this.registeredWidgets
|
|
151
|
-
);
|
|
152
|
-
for (const widgetName of Object.keys(this.activeWidgets)) {
|
|
153
|
-
let widget: any = this.activeWidgets[widgetName];
|
|
154
|
-
// Resolve aliases
|
|
155
|
-
if (typeof widget === 'string') {
|
|
156
|
-
const usedAliases: string[] = [];
|
|
157
|
-
while (typeof widget === 'string' && !usedAliases.includes(widget)) {
|
|
158
|
-
usedAliases.push(widget);
|
|
159
|
-
widget = this.activeWidgets[widget];
|
|
160
|
-
}
|
|
161
|
-
if (typeof widget !== 'string') {
|
|
162
|
-
this.activeWidgets[widgetName] = widget;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
setDefaultWidget(type: string): boolean {
|
|
170
|
-
if (!this.hasWidget(type)) { return false; }
|
|
171
|
-
this.defaultWidget = type;
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
hasWidget(type: string, widgetSet = 'activeWidgets'): boolean {
|
|
176
|
-
if (!type || typeof type !== 'string') { return false; }
|
|
177
|
-
return hasOwn(this[widgetSet], type);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
hasDefaultWidget(type: string): boolean {
|
|
181
|
-
return this.hasWidget(type, 'widgetLibrary');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
registerWidget(type: string, widget: any): boolean {
|
|
185
|
-
if (!type || !widget || typeof type !== 'string') { return false; }
|
|
186
|
-
this.registeredWidgets[type] = widget;
|
|
187
|
-
return this.setActiveWidgets();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
unRegisterWidget(type: string): boolean {
|
|
191
|
-
if (!hasOwn(this.registeredWidgets, type)) { return false; }
|
|
192
|
-
delete this.registeredWidgets[type];
|
|
193
|
-
return this.setActiveWidgets();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
unRegisterAllWidgets(unRegisterFrameworkWidgets = true): boolean {
|
|
197
|
-
this.registeredWidgets = { };
|
|
198
|
-
if (unRegisterFrameworkWidgets) { this.frameworkWidgets = { }; }
|
|
199
|
-
return this.setActiveWidgets();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
registerFrameworkWidgets(widgets: any): boolean {
|
|
203
|
-
if (widgets === null || typeof widgets !== 'object') { widgets = { }; }
|
|
204
|
-
this.frameworkWidgets = widgets;
|
|
205
|
-
return this.setActiveWidgets();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
unRegisterFrameworkWidgets(): boolean {
|
|
209
|
-
if (Object.keys(this.frameworkWidgets).length) {
|
|
210
|
-
this.frameworkWidgets = { };
|
|
211
|
-
return this.setActiveWidgets();
|
|
212
|
-
}
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
getWidget(type?: string, widgetSet = 'activeWidgets'): any {
|
|
217
|
-
if (this.hasWidget(type, widgetSet)) {
|
|
218
|
-
return this[widgetSet][type];
|
|
219
|
-
} else if (this.hasWidget(this.defaultWidget, widgetSet)) {
|
|
220
|
-
return this[widgetSet][this.defaultWidget];
|
|
221
|
-
} else {
|
|
222
|
-
return null;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
getAllWidgets(): any {
|
|
227
|
-
return {
|
|
228
|
-
widgetLibrary: this.widgetLibrary,
|
|
229
|
-
registeredWidgets: this.registeredWidgets,
|
|
230
|
-
frameworkWidgets: this.frameworkWidgets,
|
|
231
|
-
activeWidgets: this.activeWidgets,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
package/src/test.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'core-js/es/reflect';
|
|
4
|
-
import 'zone.js';
|
|
5
|
-
import 'zone.js/testing';
|
|
6
|
-
import { getTestBed } from '@angular/core/testing';
|
|
7
|
-
import {
|
|
8
|
-
BrowserDynamicTestingModule,
|
|
9
|
-
platformBrowserDynamicTesting
|
|
10
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
11
|
-
|
|
12
|
-
// First, initialize the Angular testing environment.
|
|
13
|
-
getTestBed().initTestEnvironment(
|
|
14
|
-
BrowserDynamicTestingModule,
|
|
15
|
-
platformBrowserDynamicTesting(), {
|
|
16
|
-
teardown: { destroyAfterEach: false }
|
|
17
|
-
}
|
|
18
|
-
);
|
package/tsconfig.lib.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../out-tsc/lib",
|
|
5
|
-
"declarationMap": true,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"inlineSources": true,
|
|
8
|
-
"types": [],
|
|
9
|
-
"lib": [
|
|
10
|
-
"dom",
|
|
11
|
-
"es2018"
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
"angularCompilerOptions": {
|
|
15
|
-
"skipTemplateCodegen": true,
|
|
16
|
-
"strictMetadataEmit": true,
|
|
17
|
-
"fullTemplateTypeCheck": true,
|
|
18
|
-
"strictInjectionParameters": true,
|
|
19
|
-
"enableResourceInlining": true
|
|
20
|
-
},
|
|
21
|
-
"exclude": [
|
|
22
|
-
"src/test.ts",
|
|
23
|
-
"**/*.spec.ts"
|
|
24
|
-
]
|
|
25
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED