@acorex/components 4.1.0 → 4.1.1
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/esm2020/lib/base/base-page.class.mjs +1 -1
- package/esm2020/lib/base/element.class.mjs +1 -1
- package/esm2020/lib/data-list/core/data-list.component.mjs +1 -1
- package/esm2020/lib/form-group/form-group.component.mjs +2 -1
- package/esm2020/lib/property-editor/property-editor.class.mjs +1 -1
- package/esm2020/lib/validation/validation-form.component.mjs +1 -1
- package/esm2020/lib/validation/validation-rule.widget.mjs +13 -5
- package/esm2020/lib/validation/validation.component.mjs +19 -11
- package/fesm2015/acorex-components.mjs +35 -13
- package/fesm2015/acorex-components.mjs.map +1 -1
- package/fesm2020/acorex-components.mjs +30 -13
- package/fesm2020/acorex-components.mjs.map +1 -1
- package/lib/validation/validation-rule.widget.d.ts +4 -1
- package/lib/validation/validation.component.d.ts +6 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, Injectable, EventEmitter,
|
|
2
|
+
import { ElementRef, Component, Inject, Optional, Input, Injectable, EventEmitter, Output, Directive, ViewChild, ContentChild, TemplateRef, ViewEncapsulation, HostListener, NgModule, ChangeDetectionStrategy, Attribute, ContentChildren, ViewChildren, ViewContainerRef } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@acorex/core';
|
|
4
4
|
import { AXTranslator, AXHtmlUtil, AXConfig, AXDateTime, AXDateTimeRange, AXCoreModule, AXTranslatorModule, AXObjectUtil, AXScrollModule, setPropByPath, AXColorUtil } from '@acorex/core';
|
|
5
5
|
import * as i1 from '@angular/cdk/overlay';
|
|
@@ -45,9 +45,12 @@ class AXValidationRules {
|
|
|
45
45
|
}
|
|
46
46
|
AXValidationRules.registredRules = [];
|
|
47
47
|
class AXValidationRuleComponent {
|
|
48
|
-
constructor() {
|
|
48
|
+
constructor(ref) {
|
|
49
|
+
this.ref = ref;
|
|
49
50
|
this.type = 'required';
|
|
50
51
|
this.enabled = true;
|
|
52
|
+
if (ref)
|
|
53
|
+
ref.nativeElement["__axContext__"] = this;
|
|
51
54
|
}
|
|
52
55
|
validate(value) {
|
|
53
56
|
if (this.enabled === false) {
|
|
@@ -107,7 +110,7 @@ class AXValidationRuleComponent {
|
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
|
-
AXValidationRuleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationRuleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
113
|
+
AXValidationRuleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationRuleComponent, deps: [{ token: ElementRef, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
111
114
|
AXValidationRuleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AXValidationRuleComponent, selector: "ax-validation-rule", inputs: { type: "type", message: "message", value: "value", enabled: "enabled" }, ngImport: i0, template: '', isInline: true });
|
|
112
115
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationRuleComponent, decorators: [{
|
|
113
116
|
type: Component,
|
|
@@ -115,7 +118,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
115
118
|
selector: 'ax-validation-rule',
|
|
116
119
|
template: ''
|
|
117
120
|
}]
|
|
118
|
-
}],
|
|
121
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
|
|
122
|
+
type: Inject,
|
|
123
|
+
args: [ElementRef]
|
|
124
|
+
}, {
|
|
125
|
+
type: Optional
|
|
126
|
+
}] }]; }, propDecorators: { type: [{
|
|
119
127
|
type: Input
|
|
120
128
|
}], message: [{
|
|
121
129
|
type: Input
|
|
@@ -130,6 +138,7 @@ class AXValidation {
|
|
|
130
138
|
this.validateOn = 'submit';
|
|
131
139
|
}
|
|
132
140
|
validate(value) {
|
|
141
|
+
debugger;
|
|
133
142
|
if (!this.rules || this.rules.length === 0) {
|
|
134
143
|
return Promise.resolve({ result: true });
|
|
135
144
|
}
|
|
@@ -161,12 +170,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
161
170
|
type: Injectable
|
|
162
171
|
}] });
|
|
163
172
|
class AXValidationComponent extends AXValidation {
|
|
164
|
-
constructor() {
|
|
165
|
-
super(
|
|
173
|
+
constructor(ref) {
|
|
174
|
+
super();
|
|
175
|
+
this.ref = ref;
|
|
166
176
|
this.rulesChange = new EventEmitter();
|
|
167
177
|
this.showMessage = true;
|
|
178
|
+
this._rules = [];
|
|
168
179
|
this.validateOn = null;
|
|
169
180
|
}
|
|
181
|
+
_getComponenets() {
|
|
182
|
+
return Array.from(this.ref?.nativeElement.querySelectorAll('ax-validation-rule')).map(c => c["__axContext__"]);
|
|
183
|
+
}
|
|
170
184
|
get rules() {
|
|
171
185
|
return this._rules;
|
|
172
186
|
}
|
|
@@ -178,12 +192,12 @@ class AXValidationComponent extends AXValidation {
|
|
|
178
192
|
}
|
|
179
193
|
ngAfterContentInit() {
|
|
180
194
|
if (this.rules && this.rules.length === 0) {
|
|
181
|
-
this.rules.push(...this.
|
|
195
|
+
this.rules.push(...this._getComponenets());
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
198
|
}
|
|
185
|
-
AXValidationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationComponent, deps:
|
|
186
|
-
AXValidationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AXValidationComponent, selector: "ax-validation", inputs: { rules: "rules", validateOn: "validateOn" }, outputs: { rulesChange: "rulesChange", showMessage: "showMessage" }, providers: [{ provide: AXValidation, useExisting: AXValidationComponent }],
|
|
199
|
+
AXValidationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationComponent, deps: [{ token: ElementRef, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
200
|
+
AXValidationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AXValidationComponent, selector: "ax-validation", inputs: { rules: "rules", validateOn: "validateOn" }, outputs: { rulesChange: "rulesChange", showMessage: "showMessage" }, providers: [{ provide: AXValidation, useExisting: AXValidationComponent }], usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
187
201
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AXValidationComponent, decorators: [{
|
|
188
202
|
type: Component,
|
|
189
203
|
args: [{
|
|
@@ -191,10 +205,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
|
|
|
191
205
|
template: '<ng-content></ng-content>',
|
|
192
206
|
providers: [{ provide: AXValidation, useExisting: AXValidationComponent }]
|
|
193
207
|
}]
|
|
194
|
-
}],
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
|
|
209
|
+
type: Inject,
|
|
210
|
+
args: [ElementRef]
|
|
211
|
+
}, {
|
|
212
|
+
type: Optional
|
|
213
|
+
}] }]; }, propDecorators: { rulesChange: [{
|
|
198
214
|
type: Output
|
|
199
215
|
}], showMessage: [{
|
|
200
216
|
type: Output
|
|
@@ -5442,6 +5458,7 @@ class AXFormGroupComponent extends AXBaseComponent {
|
|
|
5442
5458
|
this.required = false;
|
|
5443
5459
|
}
|
|
5444
5460
|
ngAfterViewInit() {
|
|
5461
|
+
debugger;
|
|
5445
5462
|
this.required = this.component?.validation?.rules?.some(c => c.type === 'required');
|
|
5446
5463
|
if (this.required) {
|
|
5447
5464
|
this.div.nativeElement.classList.add('required-state');
|