@decaf-ts/for-angular 0.0.5 → 0.0.7
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/dist/lib/components/component-renderer/component-renderer.component.d.ts +16 -7
- package/dist/lib/components/crud-field/crud-field.component.d.ts +1 -3
- package/dist/lib/components/crud-form/crud-form.component.d.ts +1 -1
- package/dist/lib/components/model-renderer/model-renderer.component.d.ts +5 -6
- package/dist/lib/engine/NgxCrudFormField.d.ts +3 -7
- package/dist/lib/engine/NgxRenderingEngine.d.ts +2 -3
- package/dist/lib/engine/NgxRenderingEngine2.d.ts +5 -6
- package/dist/lib/engine/ValidatorFactory.d.ts +2 -2
- package/dist/lib/engine/types.d.ts +69 -25
- package/dist/lib/esm2022/components/component-renderer/component-renderer.component.mjs +14 -10
- package/dist/lib/esm2022/components/crud-field/crud-field.component.mjs +20 -11
- package/dist/lib/esm2022/components/crud-form/crud-form.component.mjs +3 -4
- package/dist/lib/esm2022/components/model-renderer/model-renderer.component.mjs +10 -9
- package/dist/lib/esm2022/engine/NgxCrudFormField.mjs +21 -15
- package/dist/lib/esm2022/engine/NgxFormService.mjs +1 -1
- package/dist/lib/esm2022/engine/NgxRenderingEngine.mjs +2 -4
- package/dist/lib/esm2022/engine/NgxRenderingEngine2.mjs +5 -6
- package/dist/lib/esm2022/engine/ValidatorFactory.mjs +4 -4
- package/dist/lib/esm2022/engine/types.mjs +1 -1
- package/dist/lib/esm2022/for-angular.module.mjs +1 -1
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs +71 -56
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/dist/lib/for-angular.module.d.ts +2 -1
- package/package.json +4 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UIKeys, parseValueByType, HTML5InputTypes, HTML5CheckTypes, escapeHtml, parseToNumber, RenderingEngine, RenderingError } from '@decaf-ts/ui-decorators';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { reflectComponentType, inject, EnvironmentInjector, EventEmitter, ViewContainerRef, TemplateRef, ViewChild, Input, Output, Component, ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
|
+
import { reflectComponentType, inject, EnvironmentInjector, EventEmitter, ViewContainerRef, TemplateRef, ViewChild, Input, Output, Component, Injector, ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
4
4
|
import { VALIDATION_PARENT_KEY, ValidationKeys, DEFAULT_PATTERNS, Validation, ComparisonValidationKeys, PathProxyEngine, isValidDate, parseDate, Model, sf } from '@decaf-ts/decorator-validation';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import { NgComponentOutlet, Location } from '@angular/common';
|
|
@@ -10,10 +10,11 @@ import * as i2 from '@angular/forms';
|
|
|
10
10
|
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
|
11
11
|
import { getLogger, ForAngularModule } from 'src/lib/for-angular.module';
|
|
12
12
|
import { NgxRenderingEngine2 as NgxRenderingEngine2$1 } from 'src/lib/engine/NgxRenderingEngine2';
|
|
13
|
-
import { __decorate
|
|
13
|
+
import { __decorate } from 'tslib';
|
|
14
|
+
import * as i3 from '@ngx-translate/core';
|
|
15
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
14
16
|
import * as i1$1 from '@ionic/angular/standalone';
|
|
15
17
|
import { IonInput, IonItem, IonCheckbox, IonRadioGroup, IonRadio, IonSelect, IonSelectOption, IonLabel, IonTextarea, IonText, IonIcon } from '@ionic/angular/standalone';
|
|
16
|
-
import * as i3 from '@ngx-translate/core';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* @description Angular engine key constants
|
|
@@ -241,7 +242,7 @@ class ValidatorFactory {
|
|
|
241
242
|
* Enables Validators handling method to access parent and child properties using consistent dot-notation in Angular forms.
|
|
242
243
|
*
|
|
243
244
|
* @param {AbstractControl} control - The control to wrap in a proxy.
|
|
244
|
-
* @returns {PathProxy<
|
|
245
|
+
* @returns {PathProxy<unknown>} A proxy object exposing form values and enabling recursive parent access.
|
|
245
246
|
*/
|
|
246
247
|
static createProxy(control) {
|
|
247
248
|
return PathProxyEngine.create(control, {
|
|
@@ -260,10 +261,10 @@ class ValidatorFactory {
|
|
|
260
261
|
// const control = value.controls[prop];
|
|
261
262
|
// return control instanceof FormControl ? control.value : control;
|
|
262
263
|
// }
|
|
263
|
-
return target[prop];
|
|
264
|
+
return target?.[prop];
|
|
264
265
|
},
|
|
265
266
|
getParent: function (target) {
|
|
266
|
-
return target
|
|
267
|
+
return target?.['_parent'];
|
|
267
268
|
},
|
|
268
269
|
ignoreUndefined: true,
|
|
269
270
|
ignoreNull: true,
|
|
@@ -661,8 +662,8 @@ class NgxRenderingEngine2 extends RenderingEngine {
|
|
|
661
662
|
* Method-->>Caller: return AngularDynamicOutput
|
|
662
663
|
*/
|
|
663
664
|
fromFieldDefinition(fieldDef, vcr, injector, tpl, registryFormId = Date.now().toString(36).toUpperCase()) {
|
|
664
|
-
const cmp = fieldDef?.component || NgxRenderingEngine2.components(fieldDef.tag);
|
|
665
|
-
const component =
|
|
665
|
+
const cmp = fieldDef?.['component'] || NgxRenderingEngine2.components(fieldDef.tag);
|
|
666
|
+
const component = cmp.constructor;
|
|
666
667
|
const componentMetadata = reflectComponentType(component);
|
|
667
668
|
if (!componentMetadata) {
|
|
668
669
|
throw new InternalError(`Metadata for component ${fieldDef.tag} not found.`);
|
|
@@ -710,7 +711,7 @@ class NgxRenderingEngine2 extends RenderingEngine {
|
|
|
710
711
|
* @param {ComponentMirror<unknown>} metadata - The component metadata for input validation
|
|
711
712
|
* @param {ViewContainerRef} vcr - The view container reference for component creation
|
|
712
713
|
* @param {Injector} injector - The Angular injector for dependency injection
|
|
713
|
-
* @param {
|
|
714
|
+
* @param {Node[]} [template=[]] - The template nodes to project into the component
|
|
714
715
|
* @return {ComponentRef<unknown>} The created component reference
|
|
715
716
|
*/
|
|
716
717
|
static createComponent(component, inputs = {}, metadata, vcr, injector, template = []) {
|
|
@@ -797,10 +798,9 @@ class NgxRenderingEngine2 extends RenderingEngine {
|
|
|
797
798
|
* and sets the initialized flag to true. This method is called before the engine is used
|
|
798
799
|
* to ensure it's properly set up for rendering operations.
|
|
799
800
|
*
|
|
800
|
-
* @param {...any[]} args - Initialization arguments
|
|
801
801
|
* @return {Promise<void>} A promise that resolves when initialization is complete
|
|
802
802
|
*/
|
|
803
|
-
async initialize(
|
|
803
|
+
async initialize() {
|
|
804
804
|
if (this.initialized)
|
|
805
805
|
return;
|
|
806
806
|
// ValidatableByType[]
|
|
@@ -1099,13 +1099,11 @@ class NgxRenderingEngine extends RenderingEngine {
|
|
|
1099
1099
|
* @description Initializes the rendering engine
|
|
1100
1100
|
* @summary This method initializes the rendering engine. It checks if the engine is already initialized
|
|
1101
1101
|
* and sets the initialized flag to true. This method is called before the engine is used.
|
|
1102
|
-
* @param {...any[]} args - Initialization arguments
|
|
1103
1102
|
* @return {Promise<void>} A promise that resolves when initialization is complete
|
|
1104
1103
|
*/
|
|
1105
|
-
async initialize(
|
|
1104
|
+
async initialize() {
|
|
1106
1105
|
if (this.initialized)
|
|
1107
1106
|
return;
|
|
1108
|
-
// ValidatableByType[]
|
|
1109
1107
|
this.initialized = true;
|
|
1110
1108
|
}
|
|
1111
1109
|
/**
|
|
@@ -1184,7 +1182,7 @@ class NgxRenderingEngine extends RenderingEngine {
|
|
|
1184
1182
|
* +Record~string, unknown~ globals
|
|
1185
1183
|
* +EnvironmentInjector injector
|
|
1186
1184
|
* +ComponentRef~unknown~ component
|
|
1187
|
-
* +EventEmitter~
|
|
1185
|
+
* +EventEmitter~RendererCustomEvent~ listenEvent
|
|
1188
1186
|
* +ngOnInit()
|
|
1189
1187
|
* +ngOnDestroy()
|
|
1190
1188
|
* +ngOnChanges(changes)
|
|
@@ -1240,7 +1238,7 @@ class ComponentRendererComponent {
|
|
|
1240
1238
|
* dynamic component, creating a communication channel between the parent and the dynamically
|
|
1241
1239
|
* rendered child.
|
|
1242
1240
|
*
|
|
1243
|
-
* @type {EventEmitter<
|
|
1241
|
+
* @type {EventEmitter<RendererCustomEvent>}
|
|
1244
1242
|
* @memberOf ComponentRendererComponent
|
|
1245
1243
|
*/
|
|
1246
1244
|
this.listenEvent = new EventEmitter();
|
|
@@ -1271,9 +1269,12 @@ class ComponentRendererComponent {
|
|
|
1271
1269
|
* @memberOf ComponentRendererComponent
|
|
1272
1270
|
*/
|
|
1273
1271
|
ngOnInit() {
|
|
1274
|
-
if (!this.parent)
|
|
1272
|
+
if (!this.parent) {
|
|
1275
1273
|
this.createComponent(this.tag, this.globals);
|
|
1276
|
-
|
|
1274
|
+
}
|
|
1275
|
+
else {
|
|
1276
|
+
this.createParentComponent();
|
|
1277
|
+
}
|
|
1277
1278
|
}
|
|
1278
1279
|
/**
|
|
1279
1280
|
* @description Cleans up resources when the component is destroyed.
|
|
@@ -1336,8 +1337,9 @@ class ComponentRendererComponent {
|
|
|
1336
1337
|
?.constructor;
|
|
1337
1338
|
const metadata = reflectComponentType(component);
|
|
1338
1339
|
const componentInputs = metadata.inputs;
|
|
1339
|
-
const props = globals?.['item'];
|
|
1340
|
-
|
|
1340
|
+
const props = globals?.['item'] || globals?.['props'] || {};
|
|
1341
|
+
if (props?.['tag'])
|
|
1342
|
+
delete props['tag'];
|
|
1341
1343
|
const inputKeys = Object.keys(props);
|
|
1342
1344
|
const unmappedKeys = [];
|
|
1343
1345
|
for (const input of inputKeys) {
|
|
@@ -1349,8 +1351,6 @@ class ComponentRendererComponent {
|
|
|
1349
1351
|
unmappedKeys.push(input);
|
|
1350
1352
|
}
|
|
1351
1353
|
}
|
|
1352
|
-
if (unmappedKeys.length)
|
|
1353
|
-
this.logger.info(`Unmapped input properties for component ${tag}: ${unmappedKeys.join(', ')}`);
|
|
1354
1354
|
this.vcr.clear();
|
|
1355
1355
|
this.component = NgxRenderingEngine2$1.createComponent(component, props, metadata, this.vcr, this.injector, []);
|
|
1356
1356
|
this.subscribeEvents();
|
|
@@ -1443,7 +1443,7 @@ class ComponentRendererComponent {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
1445
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ComponentRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1446
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ComponentRendererComponent, isStandalone: true, selector: "ngx-decaf-component-renderer", inputs: { tag: "tag", globals: "globals", parent: "parent" }, outputs: { listenEvent: "listenEvent" }, viewQueries: [{ propertyName: "vcr", first: true, predicate: ["componentViewContainer"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "inner", first: true, predicate: ["inner"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<ng-template #componentViewContainer></ng-template>\n\n<ng-template #inner>\n @if(parent?.children?.length) {\n @for(child of parent.children; track child) {\n @if(!child.children?.length) {\n <ng-container\n *ngComponentOutlet=\"\n child.component;\n injector: child.injector;\n inputs: child.inputs;\n content:child.content;\n \"\n />\n } @else {\n <ngx-decaf-component-renderer [parent]=\"child\"> </ngx-decaf-component-renderer>\n }\n }\n }\n</ng-template>\n\n\n", styles: [""], dependencies: [{ kind: "component", type: ComponentRendererComponent, selector: "ngx-decaf-component-renderer", inputs: ["tag", "globals", "parent"], outputs: ["listenEvent"] }, { kind: "ngmodule", type: ForAngularModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
|
|
1446
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ComponentRendererComponent, isStandalone: true, selector: "ngx-decaf-component-renderer", inputs: { tag: "tag", globals: "globals", model: "model", parent: "parent" }, outputs: { listenEvent: "listenEvent" }, viewQueries: [{ propertyName: "vcr", first: true, predicate: ["componentViewContainer"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "inner", first: true, predicate: ["inner"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<ng-template #componentViewContainer></ng-template>\n\n<ng-template #inner>\n @if(parent?.children?.length) {\n @for(child of parent.children; track child) {\n @if(!child.children?.length) {\n <ng-container\n *ngComponentOutlet=\"\n child.component;\n injector: child.injector;\n inputs: child.inputs;\n content:child.content;\n \"\n />\n } @else {\n <ngx-decaf-component-renderer [parent]=\"child\"> </ngx-decaf-component-renderer>\n }\n }\n }\n</ng-template>\n\n\n", styles: [""], dependencies: [{ kind: "component", type: ComponentRendererComponent, selector: "ngx-decaf-component-renderer", inputs: ["tag", "globals", "model", "parent"], outputs: ["listenEvent"] }, { kind: "ngmodule", type: ForAngularModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
|
|
1447
1447
|
}
|
|
1448
1448
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ComponentRendererComponent, decorators: [{
|
|
1449
1449
|
type: Component,
|
|
@@ -1458,6 +1458,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1458
1458
|
type: Input
|
|
1459
1459
|
}], listenEvent: [{
|
|
1460
1460
|
type: Output
|
|
1461
|
+
}], model: [{
|
|
1462
|
+
type: Input
|
|
1461
1463
|
}], parent: [{
|
|
1462
1464
|
type: Input
|
|
1463
1465
|
}], inner: [{
|
|
@@ -1494,8 +1496,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1494
1496
|
* ModelRenderer-->>App: Emit events
|
|
1495
1497
|
*/
|
|
1496
1498
|
class ModelRendererComponent {
|
|
1497
|
-
constructor(
|
|
1498
|
-
this.injector = injector;
|
|
1499
|
+
constructor() {
|
|
1499
1500
|
/**
|
|
1500
1501
|
* @description Global variables to be passed to the rendered component
|
|
1501
1502
|
*/
|
|
@@ -1504,8 +1505,10 @@ class ModelRendererComponent {
|
|
|
1504
1505
|
* @description Event emitter for custom events from the rendered component
|
|
1505
1506
|
*/
|
|
1506
1507
|
this.listenEvent = new EventEmitter();
|
|
1508
|
+
this.injector = inject(Injector);
|
|
1507
1509
|
this.JSON = JSON;
|
|
1508
1510
|
}
|
|
1511
|
+
// constructor() {}
|
|
1509
1512
|
/**
|
|
1510
1513
|
* @description Refreshes the rendered model
|
|
1511
1514
|
* @param {string | M} model - The model to be rendered
|
|
@@ -1513,7 +1516,7 @@ class ModelRendererComponent {
|
|
|
1513
1516
|
refresh(model) {
|
|
1514
1517
|
model =
|
|
1515
1518
|
typeof model === 'string'
|
|
1516
|
-
? Model.build({},
|
|
1519
|
+
? Model.build({}, model)
|
|
1517
1520
|
: model;
|
|
1518
1521
|
this.output = model.render(this.globals || {}, this.vcr, this.injector, this.inner);
|
|
1519
1522
|
if (this.output?.inputs)
|
|
@@ -1527,7 +1530,7 @@ class ModelRendererComponent {
|
|
|
1527
1530
|
*/
|
|
1528
1531
|
ngOnChanges(changes) {
|
|
1529
1532
|
if (changes[BaseComponentProps.MODEL]) {
|
|
1530
|
-
const { currentValue
|
|
1533
|
+
const { currentValue } = changes[BaseComponentProps.MODEL];
|
|
1531
1534
|
this.refresh(currentValue);
|
|
1532
1535
|
}
|
|
1533
1536
|
}
|
|
@@ -1571,13 +1574,13 @@ class ModelRendererComponent {
|
|
|
1571
1574
|
}
|
|
1572
1575
|
}
|
|
1573
1576
|
}
|
|
1574
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ModelRendererComponent, deps: [
|
|
1575
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ModelRendererComponent, isStandalone: true, selector: "ngx-decaf-model-renderer", inputs: { model: "model", globals: "globals", rendererId: "rendererId" }, outputs: { listenEvent: "listenEvent" }, viewQueries: [{ propertyName: "inner", first: true, predicate: ["inner"], descendants: true, read: TemplateRef, static: true }, { propertyName: "vcr", first: true, predicate: ["componentOuter"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: " <ng-template #componentOuter></ng-template>\n <ng-template #inner>\n <div [id]=\"rendererId || null\">\n @for (child of output?.children; track child) {\n @if(child?.children?.length) {\n <ngx-decaf-component-renderer [parent]=\"child\" />\n } @else {\n <ng-container\n #childComponents\n *ngComponentOutlet=\"\n child.component;\n injector: child.injector;\n inputs: child.inputs;\n content:child.content;\n \"\n />\n }\n }\n </div>\n </ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ForAngularModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: ComponentRendererComponent, selector: "ngx-decaf-component-renderer", inputs: ["tag", "globals", "parent"], outputs: ["listenEvent"] }] }); }
|
|
1577
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ModelRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1578
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ModelRendererComponent, isStandalone: true, selector: "ngx-decaf-model-renderer", inputs: { model: "model", globals: "globals", rendererId: "rendererId" }, outputs: { listenEvent: "listenEvent" }, viewQueries: [{ propertyName: "inner", first: true, predicate: ["inner"], descendants: true, read: TemplateRef, static: true }, { propertyName: "vcr", first: true, predicate: ["componentOuter"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: " <ng-template #componentOuter></ng-template>\n <ng-template #inner>\n <div [id]=\"rendererId || null\">\n @for (child of output?.children; track child) {\n @if(child?.children?.length) {\n <ngx-decaf-component-renderer [parent]=\"child\" />\n } @else {\n <ng-container\n #childComponents\n *ngComponentOutlet=\"\n child.component;\n injector: child.injector;\n inputs: child.inputs;\n content:child.content;\n \"\n />\n }\n }\n </div>\n </ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ForAngularModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "component", type: ComponentRendererComponent, selector: "ngx-decaf-component-renderer", inputs: ["tag", "globals", "model", "parent"], outputs: ["listenEvent"] }] }); }
|
|
1576
1579
|
}
|
|
1577
1580
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ModelRendererComponent, decorators: [{
|
|
1578
1581
|
type: Component,
|
|
1579
1582
|
args: [{ standalone: true, imports: [ForAngularModule, NgComponentOutlet, ComponentRendererComponent], selector: 'ngx-decaf-model-renderer', template: " <ng-template #componentOuter></ng-template>\n <ng-template #inner>\n <div [id]=\"rendererId || null\">\n @for (child of output?.children; track child) {\n @if(child?.children?.length) {\n <ngx-decaf-component-renderer [parent]=\"child\" />\n } @else {\n <ng-container\n #childComponents\n *ngComponentOutlet=\"\n child.component;\n injector: child.injector;\n inputs: child.inputs;\n content:child.content;\n \"\n />\n }\n }\n </div>\n </ng-template>\n" }]
|
|
1580
|
-
}],
|
|
1583
|
+
}], propDecorators: { model: [{
|
|
1581
1584
|
type: Input,
|
|
1582
1585
|
args: [{ required: true }]
|
|
1583
1586
|
}], globals: [{
|
|
@@ -1603,8 +1606,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1603
1606
|
* implementing both CrudFormField and ControlValueAccessor interfaces.
|
|
1604
1607
|
*/
|
|
1605
1608
|
class NgxCrudFormField {
|
|
1606
|
-
constructor(
|
|
1607
|
-
this.
|
|
1609
|
+
constructor() {
|
|
1610
|
+
this.translateService = inject(TranslateService);
|
|
1611
|
+
// protected constructor() {}
|
|
1608
1612
|
/**
|
|
1609
1613
|
* @summary String formatting function
|
|
1610
1614
|
* @description Provides access to the sf function for error message formatting
|
|
@@ -1616,15 +1620,13 @@ class NgxCrudFormField {
|
|
|
1616
1620
|
* @description Function called when the field value changes
|
|
1617
1621
|
* @property {function(): unknown} onChange - onChange event handler
|
|
1618
1622
|
*/
|
|
1619
|
-
this.onChange = () => {
|
|
1620
|
-
};
|
|
1623
|
+
this.onChange = () => { };
|
|
1621
1624
|
/**
|
|
1622
1625
|
* @summary Touch callback function
|
|
1623
1626
|
* @description Function called when the field is touched
|
|
1624
1627
|
* @property {function(): unknown} onTouch - onTouch event handler
|
|
1625
1628
|
*/
|
|
1626
|
-
this.onTouch = () => {
|
|
1627
|
-
};
|
|
1629
|
+
this.onTouch = () => { };
|
|
1628
1630
|
}
|
|
1629
1631
|
/**
|
|
1630
1632
|
* @summary Write value to the field
|
|
@@ -1694,16 +1696,21 @@ class NgxCrudFormField {
|
|
|
1694
1696
|
/**
|
|
1695
1697
|
* @summary Get field errors
|
|
1696
1698
|
* @description Retrieves all errors associated with the field
|
|
1697
|
-
* @returns {
|
|
1699
|
+
* @returns {string|void} An array of error objects
|
|
1698
1700
|
*/
|
|
1699
1701
|
getErrors(parent) {
|
|
1700
|
-
const
|
|
1701
|
-
if (
|
|
1702
|
-
collapsableContainer.
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1702
|
+
const formControl = this.formControl;
|
|
1703
|
+
if ((!formControl.pristine || formControl.touched) && !formControl.valid) {
|
|
1704
|
+
const collapsableContainer = parent.closest('ion-accordion-group');
|
|
1705
|
+
if (collapsableContainer)
|
|
1706
|
+
collapsableContainer.setAttribute('value', 'open');
|
|
1707
|
+
const errors = Object.keys(formControl.errors ?? {}).map(key => ({
|
|
1708
|
+
key: key,
|
|
1709
|
+
message: key,
|
|
1710
|
+
}));
|
|
1711
|
+
for (const error of errors)
|
|
1712
|
+
return `* ${this.sf(this.translateService.instant(`errors.${error?.['message']}`), this[error?.['key']] ?? "")}`;
|
|
1713
|
+
}
|
|
1707
1714
|
}
|
|
1708
1715
|
}
|
|
1709
1716
|
|
|
@@ -1751,9 +1758,8 @@ class NgxCrudFormField {
|
|
|
1751
1758
|
* @memberOf module:for-angular
|
|
1752
1759
|
*/
|
|
1753
1760
|
let CrudFieldComponent = class CrudFieldComponent extends NgxCrudFormField {
|
|
1754
|
-
constructor(
|
|
1755
|
-
super(
|
|
1756
|
-
this.elementRef = elementRef;
|
|
1761
|
+
constructor() {
|
|
1762
|
+
super(...arguments);
|
|
1757
1763
|
/**
|
|
1758
1764
|
* @description The parent field path, if this field is nested.
|
|
1759
1765
|
* @summary Specifies the full dot-delimited path of the parent field. This is only set when the field is nested.
|
|
@@ -1772,6 +1778,15 @@ let CrudFieldComponent = class CrudFieldComponent extends NgxCrudFormField {
|
|
|
1772
1778
|
* @memberOf CrudFieldComponent
|
|
1773
1779
|
*/
|
|
1774
1780
|
this.value = '';
|
|
1781
|
+
/**
|
|
1782
|
+
* @description Interface style for select inputs.
|
|
1783
|
+
* @summary Specifies the interface style for select inputs, such as 'alert', 'action-sheet', or 'popover'.
|
|
1784
|
+
* This determines how the select options are presented to the user.
|
|
1785
|
+
*
|
|
1786
|
+
* @type {SelectInterface}
|
|
1787
|
+
* @memberOf CrudFieldComponent
|
|
1788
|
+
*/
|
|
1789
|
+
this.interface = 'popover';
|
|
1775
1790
|
/**
|
|
1776
1791
|
* @description Spellcheck attribute for text inputs.
|
|
1777
1792
|
* @summary Enables or disables spellchecking for text inputs.
|
|
@@ -1843,6 +1858,8 @@ let CrudFieldComponent = class CrudFieldComponent extends NgxCrudFormField {
|
|
|
1843
1858
|
*/
|
|
1844
1859
|
this.translatable = true;
|
|
1845
1860
|
}
|
|
1861
|
+
// constructor() {
|
|
1862
|
+
// }
|
|
1846
1863
|
ngOnInit() {
|
|
1847
1864
|
// super.onInit(this.updateOn);
|
|
1848
1865
|
if ([OperationKeys.READ, OperationKeys.DELETE].includes(this.operation)) {
|
|
@@ -1861,12 +1878,11 @@ let CrudFieldComponent = class CrudFieldComponent extends NgxCrudFormField {
|
|
|
1861
1878
|
if ([OperationKeys.READ, OperationKeys.DELETE].includes(this.operation))
|
|
1862
1879
|
this.onDestroy();
|
|
1863
1880
|
}
|
|
1864
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CrudFieldComponent, deps:
|
|
1865
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CrudFieldComponent, isStandalone: true, selector: "ngx-decaf-crud-field", inputs: { operation: "operation", name: "name", path: "path", childOf: "childOf", type: "type", value: "value", disabled: "disabled", label: "label", placeholder: "placeholder", format: "format", hidden: "hidden", max: "max", maxlength: "maxlength", min: "min", minlength: "minlength", pattern: "pattern", readonly: "readonly", required: "required", step: "step", equals: "equals", different: "different", lessThan: "lessThan", lessThanOrEqual: "lessThanOrEqual", greaterThan: "greaterThan", greaterThanOrEqual: "greaterThanOrEqual", cols: "cols", rows: "rows", alignment: "alignment", checked: "checked", justify: "justify", cancelText: "cancelText", interface: "interface", options: "options", mode: "mode", spellcheck: "spellcheck", inputmode: "inputmode", autocomplete: "autocomplete", fill: "fill", labelPlacement: "labelPlacement", updateOn: "updateOn", formGroup: "formGroup", formControl: "formControl", translatable: "translatable", uid: "uid" }, viewQueries: [{ propertyName: "component", first: true, predicate: ["component"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "@if(operation === 'read' || operation === 'delete') {\n <ng-container #component>\n <div [class]=\"'dcf-input-item ' + operation\">\n <ion-item>\n <ion-label>\n {{ label | translate }}<br />\n @if(value) {\n <ion-text class=\"dcf-display-block\" [innerHTML]=\"value\"></ion-text>\n } @else {\n <br />\n }\n </ion-label>\n </ion-item>\n </div>\n </ng-container>\n} @else {\n <ng-container #component [formGroup]=\"formGroup\">\n <div #container [class]=\"'dcf-input-item ' + (operation || 'create')\">\n @if(type === 'textarea') {\n <ion-textarea\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [required]=\"required !== undefined ? required : null\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [inputmode]=\"inputmode\"\n [spellcheck]=\"spellcheck\"\n [rows]=\"rows\"\n [labelPlacement]=\"labelPlacement\"\n [value]=\"value\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [label]=\"translatable ? (label | translate) : label\"\n >\n </ion-textarea>\n }\n @else if(type === 'checkbox') {\n <ion-item>\n <ion-checkbox\n #checkboxElement\n [name]=\"path\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [justify]=\"justify\"\n [value]=\"value\"\n [checked]=\"checked\"\n [readonly]=\"readonly\"\n (ionChange)=\"checked = !checked\"\n [formControlName]=\"name\"\n >\n <span [innerHTML]=\"label | translate\"></span>\n </ion-checkbox>\n </ion-item>\n }\n @else if(type === 'radio') {\n <ion-radio-group [formControlName]=\"name\" [name]=\"path\" [value]=\"value\" #component>\n <label class=\"dcf-radio-group-label\" [for]=\"path\">{{label | translate}}</label>\n @for(option of options; track option) {\n <ion-item>\n <ion-radio\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [alignment]=\"alignment\"\n [justify]=\"justify\"\n [readonly]=\"readonly\"\n [value]=\"option.value\"\n >{{ translatable ? (option?.text | translate) : option?.text }}</ion-radio>\n </ion-item>\n }\n </ion-radio-group>\n }\n @else if(type === 'select') {\n <ion-item>\n <ion-select\n [name]=\"path\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [label]=\"translatable ? (label | translate : label) : label\"\n [value]=\"value\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [interface]=\"interface\">\n @for(option of options; track option.value) {\n <ion-select-option [value]=\"option.value\">\n {{ translatable ? (option.text | translate) : options.text }}\n </ion-select-option>\n }\n </ion-select>\n </ion-item>\n }\n @else {\n <ion-input\n [name]=\"path\"\n [type]=\"type\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [inputmode]=\"inputmode\"\n [labelPlacement]=\"labelPlacement\"\n [required]=\"required !== undefined ? required : false\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [max]=\"max !== undefined ? max : null\"\n [min]=\"min !== undefined ? min : null\"\n [pattern]=\"pattern !== undefined ? pattern : null\"\n [step]=\"step !== undefined ? step : null\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [label]=\"translatable ? (label | translate) : label\">\n </ion-input>\n }\n @if((!formControl.pristine || formControl.touched) && !formControl.valid) {\n <div class=\"error dcf-error dcf-flex dcf-flex-top\">\n @for(error of getErrors(container); track error.key) {\n * {{ sf((\"errors.\" + error.message) | translate, this[error.key]) }}\n }\n </div>\n }\n </div>\n </ng-container>\n}\n\n", styles: [".dcf-input-item.create,.dcf-input-item.update{margin-bottom:1.8rem;margin-top:0!important}.dcf-input-item.create.checkbox+.checkbox,.dcf-input-item.update.checkbox+.checkbox{margin-top:-.25rem!important}.dcf-input-item.create ion-item,.dcf-input-item.update ion-item{--border-color: transparent}.dcf-input-item.create ion-item.dcf-text-wrap ion-label>*,.dcf-input-item.update ion-item.dcf-text-wrap ion-label>*{white-space:wrap!important;word-break:break-all!important}.dcf-input-item.read ion-label,.dcf-input-item.delete ion-label{font-weight:600}.dcf-input-item ion-item{--padding-end: 0rem;--padding-start: 0px !important;--padding-top: 0px !important;--background: transparent;--background-hover-opacity: .1;--background-hover: var(--ion-color-primary);--background-activated-opacity: .15;--background-focused: var(--ion-color-primary);--background-focused-opacity: .15}.dcf-input-item ion-item span,.dcf-input-item ion-item ion-text{font-weight:400!important;font-size:.925rem;min-height:.5rem!important}.dcf-input-item ion-item span:not(.dcf-display-block),.dcf-input-item ion-item ion-text:not(.dcf-display-block){display:inline-block}.dcf-input-item ion-item span.dcf-display-block,.dcf-input-item ion-item ion-text.dcf-display-block{display:block!important}ion-textarea textarea{scrollbar-width:thin!important;margin-bottom:.5rem!important}ion-select.dcf-select-label-placement-floating::part(label){line-height:1.2rem!important}.dcf-proccessing,.dcf-proccessing *{pointer-events:none;touch-action:none;cursor:text}ion-checkbox{--size: 1.5rem;--checkbox-background-checked: var(--ion-color-primary);--checkmark-width: 2px}ion-item{--inner-padding-start: .75rem}ion-checkbox::part(container){border-radius:50%;border:2px solid var(--ion-color-primary);padding:3px}ion-item .dcf-radio-group-label,ion-radio-group .dcf-radio-group-label{font-weight:600}ion-item .dcf-radio-group-label~ion-item,ion-radio-group .dcf-radio-group-label~ion-item{margin-top:.5rem;--inner-padding-start: .75rem}ion-item+.dcf-helper,ion-radio-group+.dcf-helper{padding-left:.75rem;position:relative}.dcf-error{position:absolute;color:var(--ion-color-danger)!important;font-size:.8rem!important;font-weight:600!important;line-height:1.1rem;box-sizing:border-box;z-index:9999;margin-top:0;animation-duration:.1s;animation-timing-function:ease-out;animation-fill-mode:both;animation-name:fadeTopSmallAnimation;display:flex;align-items:flex-start;gap:.25rem}.dcf-error .ti,.dcf-error ion-icon{position:relative;top:2px!important;min-width:20px;font-size:1rem!important;text-align:left}.dcf-helper{font-size:.875rem!important;font-weight:500;margin-top:.25rem;margin-bottom:-.75rem}.dcf-helper.dcf-has-action{cursor:pointer;color:var(--ion-color-gray-8)!important;text-decoration:underline}.dcf-error+.dcf-helper{padding-top:1rem}@keyframes fadeTopSmallAnimation{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeBottomSmallAnimation{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeTopMediumAnimation{0%{opacity:0;transform:translateY(-50px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: ForAngularModule }, { kind: "component", type: i1$1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "errorText", "helperText", "indeterminate", "justify", "labelPlacement", "mode", "name", "value"] }, { kind: "component", type: IonRadioGroup, selector: "ion-radio-group", inputs: ["allowEmptySelection", "compareWith", "errorText", "helperText", "name", "value"] }, { kind: "component", type: IonRadio, selector: "ion-radio", inputs: ["alignment", "color", "disabled", "justify", "labelPlacement", "mode", "name", "value"] }, { kind: "component", type: IonSelect, selector: "ion-select", inputs: ["cancelText", "color", "compareWith", "disabled", "errorText", "expandedIcon", "fill", "helperText", "interface", "interfaceOptions", "justify", "label", "labelPlacement", "mode", "multiple", "name", "okText", "placeholder", "selectedText", "shape", "toggleIcon", "value"] }, { kind: "component", type: IonSelectOption, selector: "ion-select-option", inputs: ["disabled", "value"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }] }); }
|
|
1881
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CrudFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1882
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CrudFieldComponent, isStandalone: true, selector: "ngx-decaf-crud-field", inputs: { operation: "operation", name: "name", path: "path", childOf: "childOf", type: "type", value: "value", disabled: "disabled", label: "label", placeholder: "placeholder", format: "format", hidden: "hidden", max: "max", maxlength: "maxlength", min: "min", minlength: "minlength", pattern: "pattern", readonly: "readonly", required: "required", step: "step", equals: "equals", different: "different", lessThan: "lessThan", lessThanOrEqual: "lessThanOrEqual", greaterThan: "greaterThan", greaterThanOrEqual: "greaterThanOrEqual", cols: "cols", rows: "rows", alignment: "alignment", checked: "checked", justify: "justify", cancelText: "cancelText", interface: "interface", options: "options", mode: "mode", spellcheck: "spellcheck", inputmode: "inputmode", autocomplete: "autocomplete", fill: "fill", labelPlacement: "labelPlacement", updateOn: "updateOn", formGroup: "formGroup", formControl: "formControl", translatable: "translatable", uid: "uid" }, viewQueries: [{ propertyName: "component", first: true, predicate: ["component"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "@if(operation === 'read' || operation === 'delete') {\n <ng-container #component>\n <div [class]=\"'dcf-input-item ' + operation\">\n <ion-item>\n <ion-label>\n {{ label | translate }}<br />\n @if(value) {\n <ion-text [innerHTML]=\"type === 'password' ? '********' : value\"></ion-text>\n } @else {\n <br />\n }\n </ion-label>\n </ion-item>\n </div>\n </ng-container>\n} @else {\n <ng-container #component [formGroup]=\"formGroup\">\n <div #container [class]=\"'dcf-input-item ' + (operation || 'create')\">\n @if(type === 'textarea') {\n <ion-textarea\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [required]=\"required !== undefined ? required : null\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [inputmode]=\"inputmode\"\n [spellcheck]=\"spellcheck\"\n [rows]=\"rows\"\n [labelPlacement]=\"labelPlacement\"\n [value]=\"value\"\n [fill]=\"fill\"\n [errorText]=\"getErrors(container)\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [label]=\"translatable ? (label | translate) : label\"\n >\n </ion-textarea>\n }\n @else if(type === 'checkbox') {\n <ion-item>\n <ion-checkbox\n #checkboxElement\n [name]=\"path\"\n [mode]=\"mode\"\n [errorText]=\"getErrors(container)\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [justify]=\"justify\"\n [value]=\"value\"\n [checked]=\"checked\"\n [readonly]=\"readonly\"\n (ionChange)=\"checked = !checked\"\n [formControlName]=\"name\"\n >\n <span [innerHTML]=\"label | translate\"></span>\n </ion-checkbox>\n </ion-item>\n }\n @else if(type === 'radio') {\n <ion-radio-group [formControlName]=\"name\" [name]=\"path\" [value]=\"value\" #component>\n <label class=\"dcf-radio-group-label\" [for]=\"path\">{{label | translate}}</label>\n @for(option of options; track option) {\n <ion-item>\n <ion-radio\n [errorText]=\"getErrors(container)\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [alignment]=\"alignment\"\n [justify]=\"justify\"\n [readonly]=\"readonly\"\n [value]=\"option.value\"\n >{{ translatable ? (option?.text | translate) : option?.text }}</ion-radio>\n </ion-item>\n }\n </ion-radio-group>\n }\n @else if(type === 'select') {\n <ion-select\n [name]=\"path\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [label]=\"translatable ? (label | translate) : label\"\n [value]=\"value\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [errorText]=\"getErrors(container)\"\n [interface]=\"interface\">\n @for(option of options; track option.value) {\n <ion-select-option [value]=\"option.value\">\n {{ translatable ? (option.text | translate) : options.text }}\n </ion-select-option>\n }\n </ion-select>\n }\n @else {\n <ion-input\n [name]=\"path\"\n [type]=\"type\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [inputmode]=\"inputmode\"\n [labelPlacement]=\"labelPlacement\"\n [required]=\"required !== undefined ? required : false\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [max]=\"max !== undefined ? max : null\"\n [min]=\"min !== undefined ? min : null\"\n [pattern]=\"pattern !== undefined ? pattern : null\"\n [step]=\"step !== undefined ? step : null\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [errorText]=\"getErrors(container)\"\n [label]=\"translatable ? (label | translate) : label\">\n </ion-input>\n }\n </div>\n </ng-container>\n}\n\n", styles: [".dcf-input-item.create,.dcf-input-item.update{margin-bottom:1.8rem;margin-top:0!important}.dcf-input-item.create.checkbox+.checkbox,.dcf-input-item.update.checkbox+.checkbox{margin-top:-.25rem!important}.dcf-input-item.create ion-item,.dcf-input-item.update ion-item{--border-color: transparent}.dcf-input-item.create ion-item.dcf-text-wrap ion-label>*,.dcf-input-item.update ion-item.dcf-text-wrap ion-label>*{white-space:wrap!important;word-break:break-all!important}.dcf-input-item.read ion-label,.dcf-input-item.delete ion-label{font-weight:600}.dcf-input-item.read ion-text,.dcf-input-item.delete ion-text{display:block;margin-top:.5rem!important}.dcf-input-item ion-item{--padding-end: 0rem;--padding-start: 0px !important;--padding-top: 0px !important;--background: transparent;--background-hover-opacity: .1;--background-hover: var(--ion-color-primary);--background-activated-opacity: .15;--background-focused: var(--ion-color-primary);--background-focused-opacity: .15}.dcf-input-item ion-item span,.dcf-input-item ion-item ion-text{font-weight:400!important;font-size:.925rem;min-height:.5rem!important}.dcf-input-item ion-item span:not(.dcf-display-block),.dcf-input-item ion-item ion-text:not(.dcf-display-block){display:inline-block}.dcf-input-item ion-item span.dcf-display-block,.dcf-input-item ion-item ion-text.dcf-display-block{display:block!important}ion-textarea textarea{scrollbar-width:thin!important;margin-bottom:.5rem!important}ion-select.dcf-select-label-placement-floating::part(label){line-height:1.2rem!important}.dcf-proccessing,.dcf-proccessing *{pointer-events:none;touch-action:none;cursor:text}ion-checkbox{--size: 1.5rem;--checkbox-background-checked: var(--ion-color-primary);--checkmark-width: 2px}ion-item{--inner-padding-start: .75rem}ion-checkbox::part(container){border-radius:50%;border:2px solid var(--ion-color-primary);padding:3px}ion-item .dcf-radio-group-label,ion-radio-group .dcf-radio-group-label{font-weight:600}ion-item .dcf-radio-group-label~ion-item,ion-radio-group .dcf-radio-group-label~ion-item{margin-top:.5rem;--inner-padding-start: .75rem}ion-item+.dcf-helper,ion-radio-group+.dcf-helper{padding-left:.75rem;position:relative}.dcf-error{position:absolute;color:var(--ion-color-danger)!important;font-size:.8rem!important;font-weight:600!important;line-height:1.1rem;box-sizing:border-box;z-index:9999;margin-top:0;animation-duration:.1s;animation-timing-function:ease-out;animation-fill-mode:both;animation-name:fadeTopSmallAnimation;display:flex;align-items:flex-start;gap:.25rem}.dcf-error .ti,.dcf-error ion-icon{position:relative;top:2px!important;min-width:20px;font-size:1rem!important;text-align:left}.dcf-helper{font-size:.875rem!important;font-weight:500;margin-top:.25rem;margin-bottom:-.75rem}.dcf-helper.dcf-has-action{cursor:pointer;color:var(--ion-color-gray-8)!important;text-decoration:underline}.dcf-error+.dcf-helper{padding-top:1rem}@keyframes fadeTopSmallAnimation{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeBottomSmallAnimation{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeTopMediumAnimation{0%{opacity:0;transform:translateY(-50px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: ForAngularModule }, { kind: "component", type: i1$1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "errorText", "helperText", "indeterminate", "justify", "labelPlacement", "mode", "name", "value"] }, { kind: "component", type: IonRadioGroup, selector: "ion-radio-group", inputs: ["allowEmptySelection", "compareWith", "errorText", "helperText", "name", "value"] }, { kind: "component", type: IonRadio, selector: "ion-radio", inputs: ["alignment", "color", "disabled", "justify", "labelPlacement", "mode", "name", "value"] }, { kind: "component", type: IonSelect, selector: "ion-select", inputs: ["cancelText", "color", "compareWith", "disabled", "errorText", "expandedIcon", "fill", "helperText", "interface", "interfaceOptions", "justify", "label", "labelPlacement", "mode", "multiple", "name", "okText", "placeholder", "selectedText", "shape", "toggleIcon", "value"] }, { kind: "component", type: IonSelectOption, selector: "ion-select-option", inputs: ["disabled", "value"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }] }); }
|
|
1866
1883
|
};
|
|
1867
1884
|
CrudFieldComponent = __decorate([
|
|
1868
|
-
Dynamic()
|
|
1869
|
-
__metadata("design:paramtypes", [ElementRef])
|
|
1885
|
+
Dynamic()
|
|
1870
1886
|
], CrudFieldComponent);
|
|
1871
1887
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CrudFieldComponent, decorators: [{
|
|
1872
1888
|
type: Component,
|
|
@@ -1882,8 +1898,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1882
1898
|
IonLabel,
|
|
1883
1899
|
IonText,
|
|
1884
1900
|
IonTextarea,
|
|
1885
|
-
], selector: 'ngx-decaf-crud-field', schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "@if(operation === 'read' || operation === 'delete') {\n <ng-container #component>\n <div [class]=\"'dcf-input-item ' + operation\">\n <ion-item>\n <ion-label>\n {{ label | translate }}<br />\n @if(value) {\n <ion-text
|
|
1886
|
-
}],
|
|
1901
|
+
], selector: 'ngx-decaf-crud-field', schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "@if(operation === 'read' || operation === 'delete') {\n <ng-container #component>\n <div [class]=\"'dcf-input-item ' + operation\">\n <ion-item>\n <ion-label>\n {{ label | translate }}<br />\n @if(value) {\n <ion-text [innerHTML]=\"type === 'password' ? '********' : value\"></ion-text>\n } @else {\n <br />\n }\n </ion-label>\n </ion-item>\n </div>\n </ng-container>\n} @else {\n <ng-container #component [formGroup]=\"formGroup\">\n <div #container [class]=\"'dcf-input-item ' + (operation || 'create')\">\n @if(type === 'textarea') {\n <ion-textarea\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [required]=\"required !== undefined ? required : null\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [inputmode]=\"inputmode\"\n [spellcheck]=\"spellcheck\"\n [rows]=\"rows\"\n [labelPlacement]=\"labelPlacement\"\n [value]=\"value\"\n [fill]=\"fill\"\n [errorText]=\"getErrors(container)\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [label]=\"translatable ? (label | translate) : label\"\n >\n </ion-textarea>\n }\n @else if(type === 'checkbox') {\n <ion-item>\n <ion-checkbox\n #checkboxElement\n [name]=\"path\"\n [mode]=\"mode\"\n [errorText]=\"getErrors(container)\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [justify]=\"justify\"\n [value]=\"value\"\n [checked]=\"checked\"\n [readonly]=\"readonly\"\n (ionChange)=\"checked = !checked\"\n [formControlName]=\"name\"\n >\n <span [innerHTML]=\"label | translate\"></span>\n </ion-checkbox>\n </ion-item>\n }\n @else if(type === 'radio') {\n <ion-radio-group [formControlName]=\"name\" [name]=\"path\" [value]=\"value\" #component>\n <label class=\"dcf-radio-group-label\" [for]=\"path\">{{label | translate}}</label>\n @for(option of options; track option) {\n <ion-item>\n <ion-radio\n [errorText]=\"getErrors(container)\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [alignment]=\"alignment\"\n [justify]=\"justify\"\n [readonly]=\"readonly\"\n [value]=\"option.value\"\n >{{ translatable ? (option?.text | translate) : option?.text }}</ion-radio>\n </ion-item>\n }\n </ion-radio-group>\n }\n @else if(type === 'select') {\n <ion-select\n [name]=\"path\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [labelPlacement]=\"labelPlacement\"\n [label]=\"translatable ? (label | translate) : label\"\n [value]=\"value\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [errorText]=\"getErrors(container)\"\n [interface]=\"interface\">\n @for(option of options; track option.value) {\n <ion-select-option [value]=\"option.value\">\n {{ translatable ? (option.text | translate) : options.text }}\n </ion-select-option>\n }\n </ion-select>\n }\n @else {\n <ion-input\n [name]=\"path\"\n [type]=\"type\"\n [mode]=\"mode\"\n [hidden]=\"hidden\"\n [inputmode]=\"inputmode\"\n [labelPlacement]=\"labelPlacement\"\n [required]=\"required !== undefined ? required : false\"\n [minlength]=\"minlength !== undefined ? minlength : null\"\n [maxlength]=\"maxlength !== undefined ? maxlength : null\"\n [readonly]=\"readonly !== undefined ? readonly : null\"\n [max]=\"max !== undefined ? max : null\"\n [min]=\"min !== undefined ? min : null\"\n [pattern]=\"pattern !== undefined ? pattern : null\"\n [step]=\"step !== undefined ? step : null\"\n [fill]=\"fill\"\n [placeholder]=\"translatable ? (placeholder | translate) : placeholder\"\n [formControlName]=\"name\"\n [errorText]=\"getErrors(container)\"\n [label]=\"translatable ? (label | translate) : label\">\n </ion-input>\n }\n </div>\n </ng-container>\n}\n\n", styles: [".dcf-input-item.create,.dcf-input-item.update{margin-bottom:1.8rem;margin-top:0!important}.dcf-input-item.create.checkbox+.checkbox,.dcf-input-item.update.checkbox+.checkbox{margin-top:-.25rem!important}.dcf-input-item.create ion-item,.dcf-input-item.update ion-item{--border-color: transparent}.dcf-input-item.create ion-item.dcf-text-wrap ion-label>*,.dcf-input-item.update ion-item.dcf-text-wrap ion-label>*{white-space:wrap!important;word-break:break-all!important}.dcf-input-item.read ion-label,.dcf-input-item.delete ion-label{font-weight:600}.dcf-input-item.read ion-text,.dcf-input-item.delete ion-text{display:block;margin-top:.5rem!important}.dcf-input-item ion-item{--padding-end: 0rem;--padding-start: 0px !important;--padding-top: 0px !important;--background: transparent;--background-hover-opacity: .1;--background-hover: var(--ion-color-primary);--background-activated-opacity: .15;--background-focused: var(--ion-color-primary);--background-focused-opacity: .15}.dcf-input-item ion-item span,.dcf-input-item ion-item ion-text{font-weight:400!important;font-size:.925rem;min-height:.5rem!important}.dcf-input-item ion-item span:not(.dcf-display-block),.dcf-input-item ion-item ion-text:not(.dcf-display-block){display:inline-block}.dcf-input-item ion-item span.dcf-display-block,.dcf-input-item ion-item ion-text.dcf-display-block{display:block!important}ion-textarea textarea{scrollbar-width:thin!important;margin-bottom:.5rem!important}ion-select.dcf-select-label-placement-floating::part(label){line-height:1.2rem!important}.dcf-proccessing,.dcf-proccessing *{pointer-events:none;touch-action:none;cursor:text}ion-checkbox{--size: 1.5rem;--checkbox-background-checked: var(--ion-color-primary);--checkmark-width: 2px}ion-item{--inner-padding-start: .75rem}ion-checkbox::part(container){border-radius:50%;border:2px solid var(--ion-color-primary);padding:3px}ion-item .dcf-radio-group-label,ion-radio-group .dcf-radio-group-label{font-weight:600}ion-item .dcf-radio-group-label~ion-item,ion-radio-group .dcf-radio-group-label~ion-item{margin-top:.5rem;--inner-padding-start: .75rem}ion-item+.dcf-helper,ion-radio-group+.dcf-helper{padding-left:.75rem;position:relative}.dcf-error{position:absolute;color:var(--ion-color-danger)!important;font-size:.8rem!important;font-weight:600!important;line-height:1.1rem;box-sizing:border-box;z-index:9999;margin-top:0;animation-duration:.1s;animation-timing-function:ease-out;animation-fill-mode:both;animation-name:fadeTopSmallAnimation;display:flex;align-items:flex-start;gap:.25rem}.dcf-error .ti,.dcf-error ion-icon{position:relative;top:2px!important;min-width:20px;font-size:1rem!important;text-align:left}.dcf-helper{font-size:.875rem!important;font-weight:500;margin-top:.25rem;margin-bottom:-.75rem}.dcf-helper.dcf-has-action{cursor:pointer;color:var(--ion-color-gray-8)!important;text-decoration:underline}.dcf-error+.dcf-helper{padding-top:1rem}@keyframes fadeTopSmallAnimation{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeBottomSmallAnimation{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeTopMediumAnimation{0%{opacity:0;transform:translateY(-50px)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
1902
|
+
}], propDecorators: { operation: [{
|
|
1887
1903
|
type: Input,
|
|
1888
1904
|
args: [{ required: true }]
|
|
1889
1905
|
}], name: [{
|
|
@@ -2059,10 +2075,9 @@ let CrudFormComponent = class CrudFormComponent {
|
|
|
2059
2075
|
if (!NgxFormService.validateFields(this.formGroup))
|
|
2060
2076
|
return false;
|
|
2061
2077
|
const data = NgxFormService.getFormData(this.formGroup);
|
|
2062
|
-
console.log('Submit=', data);
|
|
2063
2078
|
this.submitEvent.emit({
|
|
2064
2079
|
data,
|
|
2065
|
-
component: '
|
|
2080
|
+
component: 'CrudFormComponent',
|
|
2066
2081
|
name: this.action || EventConstants.SUBMIT_EVENT,
|
|
2067
2082
|
handlers: this.handlers,
|
|
2068
2083
|
});
|
|
@@ -2077,7 +2092,7 @@ let CrudFormComponent = class CrudFormComponent {
|
|
|
2077
2092
|
handleDelete() {
|
|
2078
2093
|
this.submitEvent.emit({
|
|
2079
2094
|
data: this.uid,
|
|
2080
|
-
component: '
|
|
2095
|
+
component: 'CrudFormComponent',
|
|
2081
2096
|
name: EventConstants.SUBMIT_EVENT,
|
|
2082
2097
|
});
|
|
2083
2098
|
}
|