ngx-dsxlibrary 2.21.45 → 2.21.47
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/fesm2022/ngx-dsxlibrary-src-lib-components.mjs +114 -1
- package/fesm2022/ngx-dsxlibrary-src-lib-components.mjs.map +1 -1
- package/fesm2022/ngx-dsxlibrary.mjs +139 -1
- package/fesm2022/ngx-dsxlibrary.mjs.map +1 -1
- package/ngx-dsxlibrary-2.21.47.tgz +0 -0
- package/package.json +1 -1
- package/types/ngx-dsxlibrary-src-lib-components.d.ts +23 -1
- package/types/ngx-dsxlibrary-src-lib-models.d.ts +1 -1
- package/types/ngx-dsxlibrary.d.ts +33 -2
- package/ngx-dsxlibrary-2.21.45.tgz +0 -0
|
@@ -127,6 +127,119 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
|
|
|
127
127
|
type: Input
|
|
128
128
|
}] } });
|
|
129
129
|
|
|
130
|
+
class AppMessageHelpComponent {
|
|
131
|
+
elementRef;
|
|
132
|
+
renderer;
|
|
133
|
+
defaultFloatLabelHelpSpace = '1.6rem';
|
|
134
|
+
floatLabelElement = null;
|
|
135
|
+
previousInlineMarginBottom = '';
|
|
136
|
+
lastAppliedVisibleState = false;
|
|
137
|
+
constructor(elementRef, renderer) {
|
|
138
|
+
this.elementRef = elementRef;
|
|
139
|
+
this.renderer = renderer;
|
|
140
|
+
}
|
|
141
|
+
control = null;
|
|
142
|
+
helperFunction = 'dateLong';
|
|
143
|
+
ngAfterViewInit() {
|
|
144
|
+
this.floatLabelElement = this.elementRef.nativeElement.closest('.p-floatlabel');
|
|
145
|
+
if (this.floatLabelElement) {
|
|
146
|
+
this.previousInlineMarginBottom =
|
|
147
|
+
this.floatLabelElement.style.marginBottom;
|
|
148
|
+
this.syncFloatLabelSpacing();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
ngDoCheck() {
|
|
152
|
+
this.syncFloatLabelSpacing();
|
|
153
|
+
}
|
|
154
|
+
ngOnDestroy() {
|
|
155
|
+
if (!this.floatLabelElement) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (this.previousInlineMarginBottom) {
|
|
159
|
+
this.renderer.setStyle(this.floatLabelElement, 'margin-bottom', this.previousInlineMarginBottom);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.renderer.removeStyle(this.floatLabelElement, 'margin-bottom');
|
|
163
|
+
}
|
|
164
|
+
getHelpMessage() {
|
|
165
|
+
if (this.helperFunction === 'dateLong') {
|
|
166
|
+
return this.buildDateLongMessage();
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
isHelpVisible() {
|
|
171
|
+
if (!this.control?.valid) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
return !!this.getHelpMessage();
|
|
175
|
+
}
|
|
176
|
+
syncFloatLabelSpacing() {
|
|
177
|
+
if (!this.floatLabelElement) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const isVisible = this.isHelpVisible();
|
|
181
|
+
if (isVisible === this.lastAppliedVisibleState) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.lastAppliedVisibleState = isVisible;
|
|
185
|
+
if (isVisible) {
|
|
186
|
+
this.renderer.setStyle(this.floatLabelElement, 'margin-bottom', this.defaultFloatLabelHelpSpace);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (this.previousInlineMarginBottom) {
|
|
190
|
+
this.renderer.setStyle(this.floatLabelElement, 'margin-bottom', this.previousInlineMarginBottom);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.renderer.removeStyle(this.floatLabelElement, 'margin-bottom');
|
|
194
|
+
}
|
|
195
|
+
buildDateLongMessage() {
|
|
196
|
+
const rawValue = this.control?.value;
|
|
197
|
+
if (!rawValue) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const date = this.parseDateInput(rawValue);
|
|
201
|
+
if (!date) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
const formattedDate = new Intl.DateTimeFormat('es-GT', {
|
|
205
|
+
weekday: 'long',
|
|
206
|
+
year: 'numeric',
|
|
207
|
+
month: 'long',
|
|
208
|
+
day: 'numeric',
|
|
209
|
+
}).format(date);
|
|
210
|
+
const message = formattedDate.charAt(0).toUpperCase() + formattedDate.slice(1);
|
|
211
|
+
return `${message}`;
|
|
212
|
+
}
|
|
213
|
+
parseDateInput(value) {
|
|
214
|
+
if (value instanceof Date) {
|
|
215
|
+
return Number.isNaN(value.getTime()) ? null : value;
|
|
216
|
+
}
|
|
217
|
+
if (typeof value === 'string') {
|
|
218
|
+
const shortDateMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
219
|
+
if (shortDateMatch) {
|
|
220
|
+
const year = Number(shortDateMatch[1]);
|
|
221
|
+
const month = Number(shortDateMatch[2]) - 1;
|
|
222
|
+
const day = Number(shortDateMatch[3]);
|
|
223
|
+
const localDate = new Date(year, month, day);
|
|
224
|
+
return Number.isNaN(localDate.getTime()) ? null : localDate;
|
|
225
|
+
}
|
|
226
|
+
const parsedDate = new Date(value);
|
|
227
|
+
return Number.isNaN(parsedDate.getTime()) ? null : parsedDate;
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AppMessageHelpComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
232
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: AppMessageHelpComponent, isStandalone: true, selector: "dsx-message-help", inputs: { control: "control", helperFunction: "helperFunction" }, ngImport: i0, template: "<div class=\"dsx-help-slot\" [class.is-visible]=\"isHelpVisible()\">\r\n @if (isHelpVisible()) {\r\n <div class=\"dsx-help-message\">\r\n <i class=\"pi pi-info-circle dsx-help-icon\" aria-hidden=\"true\"></i>\r\n <span>{{ getHelpMessage() }}</span>\r\n </div>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.dsx-help-slot{max-height:0;margin-top:0;overflow:hidden;opacity:0;transition:max-height .22s ease,margin-top .22s ease,opacity .18s ease}.dsx-help-slot.is-visible{max-height:3.6rem;margin-top:.3rem;opacity:1}.dsx-help-message{--dsx-help-color: #067647;--dsx-help-bg: #ecfdf3;color:var(--dsx-help-color);font-family:Roboto,Montserrat,sans-serif;font-size:clamp(.75rem,.72rem + .12vw,.8125rem);font-weight:400;line-height:1.35;letter-spacing:.01em;display:flex;align-items:center;gap:.35rem;position:relative;z-index:1;padding:.2rem .45rem;border-left:3px solid var(--dsx-help-color);border-radius:0 6px 6px 0;background:var(--dsx-help-bg);box-shadow:0 1px 2px #00000014;max-width:min(52ch,100%);white-space:normal;word-break:break-word;transform:translateY(-2px);transition:transform .2s ease}.dsx-help-slot.is-visible .dsx-help-message{transform:translateY(0)}.dsx-help-icon{flex-shrink:0;font-size:.78rem;line-height:1;color:var(--dsx-help-color)}@media(max-width:640px){.dsx-help-slot.is-visible{max-height:4.4rem}.dsx-help-message{max-width:100%}}:host-context(.p-floatlabel){position:absolute;top:100%;left:0;width:100%;z-index:3;pointer-events:none}:host-context(.p-floatlabel) .dsx-help-slot{max-height:none;margin-top:.25rem;overflow:visible;opacity:0;transform:translateY(-3px);transition:opacity .16s ease,transform .18s ease}:host-context(.p-floatlabel) .dsx-help-slot.is-visible{opacity:1;transform:translateY(0)}:host-context(.p-floatlabel) .dsx-help-message{max-width:min(52ch,calc(100% - .25rem))}\n"] });
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: AppMessageHelpComponent, decorators: [{
|
|
235
|
+
type: Component,
|
|
236
|
+
args: [{ selector: 'dsx-message-help', template: "<div class=\"dsx-help-slot\" [class.is-visible]=\"isHelpVisible()\">\r\n @if (isHelpVisible()) {\r\n <div class=\"dsx-help-message\">\r\n <i class=\"pi pi-info-circle dsx-help-icon\" aria-hidden=\"true\"></i>\r\n <span>{{ getHelpMessage() }}</span>\r\n </div>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.dsx-help-slot{max-height:0;margin-top:0;overflow:hidden;opacity:0;transition:max-height .22s ease,margin-top .22s ease,opacity .18s ease}.dsx-help-slot.is-visible{max-height:3.6rem;margin-top:.3rem;opacity:1}.dsx-help-message{--dsx-help-color: #067647;--dsx-help-bg: #ecfdf3;color:var(--dsx-help-color);font-family:Roboto,Montserrat,sans-serif;font-size:clamp(.75rem,.72rem + .12vw,.8125rem);font-weight:400;line-height:1.35;letter-spacing:.01em;display:flex;align-items:center;gap:.35rem;position:relative;z-index:1;padding:.2rem .45rem;border-left:3px solid var(--dsx-help-color);border-radius:0 6px 6px 0;background:var(--dsx-help-bg);box-shadow:0 1px 2px #00000014;max-width:min(52ch,100%);white-space:normal;word-break:break-word;transform:translateY(-2px);transition:transform .2s ease}.dsx-help-slot.is-visible .dsx-help-message{transform:translateY(0)}.dsx-help-icon{flex-shrink:0;font-size:.78rem;line-height:1;color:var(--dsx-help-color)}@media(max-width:640px){.dsx-help-slot.is-visible{max-height:4.4rem}.dsx-help-message{max-width:100%}}:host-context(.p-floatlabel){position:absolute;top:100%;left:0;width:100%;z-index:3;pointer-events:none}:host-context(.p-floatlabel) .dsx-help-slot{max-height:none;margin-top:.25rem;overflow:visible;opacity:0;transform:translateY(-3px);transition:opacity .16s ease,transform .18s ease}:host-context(.p-floatlabel) .dsx-help-slot.is-visible{opacity:1;transform:translateY(0)}:host-context(.p-floatlabel) .dsx-help-message{max-width:min(52ch,calc(100% - .25rem))}\n"] }]
|
|
237
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { control: [{
|
|
238
|
+
type: Input
|
|
239
|
+
}], helperFunction: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}] } });
|
|
242
|
+
|
|
130
243
|
class DsxStatusToggle {
|
|
131
244
|
onLabel = input('Activo', ...(ngDevMode ? [{ debugName: "onLabel" }] : /* istanbul ignore next */ []));
|
|
132
245
|
offLabel = input('Inactivo', ...(ngDevMode ? [{ debugName: "offLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -1044,5 +1157,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
|
|
|
1044
1157
|
* Generated bundle index. Do not edit.
|
|
1045
1158
|
*/
|
|
1046
1159
|
|
|
1047
|
-
export { AppMessageErrorComponent, DateIndicator, DocxPreviewComponent, DsxEnableDisable, DsxStatusToggle, FileComponent, JsonViewerComponent, KpicardComponent, PdfPreviewComponent, TemplateHighlight };
|
|
1160
|
+
export { AppMessageErrorComponent, AppMessageHelpComponent, DateIndicator, DocxPreviewComponent, DsxEnableDisable, DsxStatusToggle, FileComponent, JsonViewerComponent, KpicardComponent, PdfPreviewComponent, TemplateHighlight };
|
|
1048
1161
|
//# sourceMappingURL=ngx-dsxlibrary-src-lib-components.mjs.map
|