@sd-angular/core 19.0.0-beta.82 → 19.0.0-beta.84
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/sd-angular-core-components-anchor-v2.mjs +9 -9
- package/fesm2022/sd-angular-core-components-anchor.mjs +12 -12
- package/fesm2022/sd-angular-core-components-avatar.mjs +3 -3
- package/fesm2022/sd-angular-core-components-badge.mjs +3 -3
- package/fesm2022/sd-angular-core-components-base.mjs +3 -3
- package/fesm2022/sd-angular-core-components-button.mjs +3 -3
- package/fesm2022/sd-angular-core-components-chart.mjs +12 -12
- package/fesm2022/sd-angular-core-components-code-editor.mjs +3 -3
- package/fesm2022/sd-angular-core-components-document-builder.mjs +6 -6
- package/fesm2022/sd-angular-core-components-editor.mjs +3 -3
- package/fesm2022/sd-angular-core-components-history.mjs +7 -7
- package/fesm2022/sd-angular-core-components-import-excel.mjs +10 -10
- package/fesm2022/sd-angular-core-components-mini-editor.mjs +3 -3
- package/fesm2022/sd-angular-core-components-modal.mjs +3 -3
- package/fesm2022/sd-angular-core-components-preview.mjs +3 -3
- package/fesm2022/sd-angular-core-components-query-builder.mjs +3 -3
- package/fesm2022/sd-angular-core-components-quick-action.mjs +3 -3
- package/fesm2022/sd-angular-core-components-section.mjs +6 -6
- package/fesm2022/sd-angular-core-components-side-drawer.mjs +3 -3
- package/fesm2022/sd-angular-core-components-tab-router.mjs +104 -51
- package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +96 -96
- package/fesm2022/sd-angular-core-components-upload-file.mjs +15 -15
- package/fesm2022/sd-angular-core-components-view.mjs +3 -3
- package/fesm2022/sd-angular-core-components-workflow.mjs +198 -198
- package/fesm2022/sd-angular-core-directives.mjs +21 -21
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-checkbox.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-chip-calendar.mjs +6 -6
- package/fesm2022/sd-angular-core-forms-chip.mjs +6 -6
- package/fesm2022/sd-angular-core-forms-date-range.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-date.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-datetime.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-directives.mjs +12 -12
- package/fesm2022/sd-angular-core-forms-input-number.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-input.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-label.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-radio.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-select.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-switch.mjs +3 -3
- package/fesm2022/sd-angular-core-forms-textarea.mjs +3 -3
- package/fesm2022/sd-angular-core-forms.mjs +4 -4
- package/fesm2022/sd-angular-core-handlers.mjs +3 -3
- package/fesm2022/sd-angular-core-interceptors.mjs +3 -3
- package/fesm2022/sd-angular-core-modules-auth.mjs +9 -9
- package/fesm2022/sd-angular-core-modules-authom.mjs +7 -7
- package/fesm2022/sd-angular-core-modules-keycloak.mjs +7 -7
- package/fesm2022/sd-angular-core-modules-layout.mjs +73 -73
- package/fesm2022/sd-angular-core-modules-permission.mjs +9 -9
- package/fesm2022/sd-angular-core-pipes.mjs +14 -14
- package/fesm2022/sd-angular-core-services-api.mjs +10 -10
- package/fesm2022/sd-angular-core-services-cache.mjs +3 -3
- package/fesm2022/sd-angular-core-services-confirm.mjs +6 -6
- package/fesm2022/sd-angular-core-services-docx.mjs +198 -71
- package/fesm2022/sd-angular-core-services-docx.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-excel.mjs +3 -3
- package/fesm2022/sd-angular-core-services-firebase.mjs +3 -3
- package/fesm2022/sd-angular-core-services-license.mjs +3 -3
- package/fesm2022/sd-angular-core-services-loading.mjs +3 -3
- package/fesm2022/sd-angular-core-services-notify.mjs +9 -9
- package/fesm2022/sd-angular-core-services-storage.mjs +3 -3
- package/package.json +57 -57
- package/sd-angular-core-19.0.0-beta.84.tgz +0 -0
- package/services/docx/src/lib/docx.service.d.ts +4 -2
- package/services/docx/src/lib/pandoc-core.d.ts +11 -0
- package/sd-angular-core-19.0.0-beta.82.tgz +0 -0
|
@@ -156,10 +156,10 @@ class SdPermissionService {
|
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
160
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
159
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
160
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionService, providedIn: 'root' });
|
|
161
161
|
}
|
|
162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionService, decorators: [{
|
|
163
163
|
type: Injectable,
|
|
164
164
|
args: [{ providedIn: 'root' }]
|
|
165
165
|
}], ctorParameters: () => [] });
|
|
@@ -187,10 +187,10 @@ class SdPermissionDirective {
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
191
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
191
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: SdPermissionDirective, isStandalone: true, selector: "[sdPermission]", inputs: { sdPermission: { classPropertyName: "sdPermission", publicName: "sdPermission", isSignal: true, isRequired: false, transformFunction: null }, sdPermissionKey: { classPropertyName: "sdPermissionKey", publicName: "sdPermissionKey", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
192
192
|
}
|
|
193
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionDirective, decorators: [{
|
|
194
194
|
type: Directive,
|
|
195
195
|
args: [{
|
|
196
196
|
selector: '[sdPermission]',
|
|
@@ -230,10 +230,10 @@ class SdPermissionGuard {
|
|
|
230
230
|
onForbiden?.();
|
|
231
231
|
return false;
|
|
232
232
|
};
|
|
233
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
234
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionGuard, deps: [{ token: SD_PERMISSION_CONFIGURATION }, { token: SdPermissionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
234
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionGuard, providedIn: 'root' });
|
|
235
235
|
}
|
|
236
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPermissionGuard, decorators: [{
|
|
237
237
|
type: Injectable,
|
|
238
238
|
args: [{ providedIn: 'root' }]
|
|
239
239
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
@@ -22,11 +22,11 @@ class SdFormatNumberPipe {
|
|
|
22
22
|
// Ngược lại dùng định dạng ISO
|
|
23
23
|
return NumberUtilities.toISO(fixedValue);
|
|
24
24
|
}
|
|
25
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
26
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
27
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormatNumberPipe, deps: [{ token: SD_CORE_CONFIGURATION, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
26
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdFormatNumberPipe, isStandalone: true, name: "sdFormatNumber" });
|
|
27
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormatNumberPipe, providedIn: 'root' });
|
|
28
28
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFormatNumberPipe, decorators: [{
|
|
30
30
|
type: Pipe,
|
|
31
31
|
args: [{
|
|
32
32
|
name: 'sdFormatNumber',
|
|
@@ -58,11 +58,11 @@ class SdSafeHtmlPipe {
|
|
|
58
58
|
}
|
|
59
59
|
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
60
60
|
}
|
|
61
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
62
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
63
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
62
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdSafeHtmlPipe, isStandalone: true, name: "sdSafeHtml" });
|
|
63
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSafeHtmlPipe, providedIn: 'root' });
|
|
64
64
|
}
|
|
65
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSafeHtmlPipe, decorators: [{
|
|
66
66
|
type: Pipe,
|
|
67
67
|
args: [{
|
|
68
68
|
name: 'sdSafeHtml',
|
|
@@ -112,10 +112,10 @@ class SdTimeDifferentPipe {
|
|
|
112
112
|
return DateUtilities.toFormat(value, format);
|
|
113
113
|
}));
|
|
114
114
|
}
|
|
115
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
116
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTimeDifferentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
116
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdTimeDifferentPipe, isStandalone: true, name: "sdTimeDifferent" });
|
|
117
117
|
}
|
|
118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTimeDifferentPipe, decorators: [{
|
|
119
119
|
type: Pipe,
|
|
120
120
|
args: [{
|
|
121
121
|
name: 'sdTimeDifferent',
|
|
@@ -131,10 +131,10 @@ class SdEmptyPipe {
|
|
|
131
131
|
}
|
|
132
132
|
return value;
|
|
133
133
|
}
|
|
134
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
135
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
134
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
135
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdEmptyPipe, isStandalone: true, name: "sdEmpty" });
|
|
136
136
|
}
|
|
137
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
137
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdEmptyPipe, decorators: [{
|
|
138
138
|
type: Pipe,
|
|
139
139
|
args: [{
|
|
140
140
|
name: 'sdEmpty',
|
|
@@ -155,10 +155,10 @@ class SdApiService {
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
159
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
158
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiService, deps: [{ token: i1.HttpClient }, { token: SD_API_CONFIG, optional: true }, { token: i2.SdCacheService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
159
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiService, providedIn: 'root' });
|
|
160
160
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiService, decorators: [{
|
|
162
162
|
type: Injectable,
|
|
163
163
|
args: [{
|
|
164
164
|
providedIn: 'root',
|
|
@@ -216,10 +216,10 @@ class SdHttpInterceptor {
|
|
|
216
216
|
return throwError(() => error);
|
|
217
217
|
}));
|
|
218
218
|
}
|
|
219
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
220
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
219
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdHttpInterceptor, deps: [{ token: SD_API_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
220
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdHttpInterceptor });
|
|
221
221
|
}
|
|
222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdHttpInterceptor, decorators: [{
|
|
223
223
|
type: Injectable
|
|
224
224
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
225
225
|
type: Inject,
|
|
@@ -229,11 +229,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
229
229
|
}] }] });
|
|
230
230
|
|
|
231
231
|
class SdApiModule {
|
|
232
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
233
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.
|
|
234
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.
|
|
232
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
233
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdApiModule });
|
|
234
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiModule, providers: [provideHttpClient(withInterceptorsFromDi()), { provide: HTTP_INTERCEPTORS, useClass: SdHttpInterceptor, multi: true }] });
|
|
235
235
|
}
|
|
236
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdApiModule, decorators: [{
|
|
237
237
|
type: NgModule,
|
|
238
238
|
args: [{
|
|
239
239
|
imports: [],
|
|
@@ -140,10 +140,10 @@ class SdCacheService {
|
|
|
140
140
|
return val;
|
|
141
141
|
return JSON.parse(JSON.stringify(val));
|
|
142
142
|
}
|
|
143
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
144
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdCacheService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
144
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdCacheService, providedIn: 'root' });
|
|
145
145
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdCacheService, decorators: [{
|
|
147
147
|
type: Injectable,
|
|
148
148
|
args: [{
|
|
149
149
|
providedIn: 'root',
|
|
@@ -46,10 +46,10 @@ class DialogConfirmComponent {
|
|
|
46
46
|
this.dialogRef.close({ action: 'ACCEPT', value: null });
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
50
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.
|
|
49
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogConfirmComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
50
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DialogConfirmComponent, isStandalone: true, selector: "sd-dialog-confirm", ngImport: i0, template: "<div mat-dialog-title class=\"\">\r\n @if (data.icon) {\r\n <mat-icon>\r\n {{ data.icon }}\r\n </mat-icon>\r\n }\r\n <span class=\"T24M\" [innerHtml]=\"data.title || 'Confirm'\"></span>\r\n</div>\r\n<div mat-dialog-content>\r\n <div class=\"T14R mb-4\" [innerHtml]=\"data.message\"></div>\r\n @if (data.input) {\r\n <sd-textarea [placeholder]=\"data.input.placeholder\" [(model)]=\"value\" [rows]=\"5\" [maxlength]=\"data.input.maxlength!\" />\r\n }\r\n @if (data.date) {\r\n <sd-date\r\n [placeholder]=\"data.date.placeholder\"\r\n [(model)]=\"value\"\r\n type=\"date\"\r\n [min]=\"data.date.min!\"\r\n [max]=\"data.date.max!\"\r\n [required]=\"data.date.required\">\r\n </sd-date>\r\n }\r\n @if (data.radio) {\r\n <sd-radio\r\n [items]=\"data.radio.items\"\r\n [valueField]=\"data.radio.valueField\"\r\n [displayField]=\"data.radio.displayField\"\r\n [display]=\"data.radio.display || 'column'\"\r\n [(model)]=\"value\"\r\n [required]=\"data.radio.required\">\r\n </sd-radio>\r\n }\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n @if (data.noTitle) {\r\n <sd-button [color]=\"data.noButtonColor || 'secondary'\" [title]=\"data.noTitle\" (click)=\"onCancel()\"></sd-button>\r\n }\r\n @if (data.yesTitle) {\r\n <sd-button\r\n class=\"ml-8\"\r\n type=\"fill\"\r\n [color]=\"data.yesButtonColor || 'primary'\"\r\n [disabled]=\"required && !value\"\r\n cdkFocusInitial\r\n [title]=\"data.yesTitle\"\r\n (click)=\"onAccept()\"></sd-button>\r\n }\r\n</div>\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host ::ng-deep .mat-dialog-title{display:flex;align-items:center;justify-content:flex-start}:host ::ng-deep .mat-dialog-title .mat-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title .mat-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title .mat-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title .mat-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title .mat-icon.error{color:var(--sd-error)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdRadio, selector: "sd-radio", inputs: ["autoId", "name", "form", "label", "placeholder", "display", "model", "items", "valueField", "displayField", "required", "inlineError", "disabled", "viewed", "hyperlink"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange"] }] });
|
|
51
51
|
}
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DialogConfirmComponent, decorators: [{
|
|
53
53
|
type: Component,
|
|
54
54
|
args: [{ selector: 'sd-dialog-confirm', imports: [CommonModule, FormsModule, MatDialogModule, MatIconModule, SdButton, SdDate, SdRadio, SdTextarea], template: "<div mat-dialog-title class=\"\">\r\n @if (data.icon) {\r\n <mat-icon>\r\n {{ data.icon }}\r\n </mat-icon>\r\n }\r\n <span class=\"T24M\" [innerHtml]=\"data.title || 'Confirm'\"></span>\r\n</div>\r\n<div mat-dialog-content>\r\n <div class=\"T14R mb-4\" [innerHtml]=\"data.message\"></div>\r\n @if (data.input) {\r\n <sd-textarea [placeholder]=\"data.input.placeholder\" [(model)]=\"value\" [rows]=\"5\" [maxlength]=\"data.input.maxlength!\" />\r\n }\r\n @if (data.date) {\r\n <sd-date\r\n [placeholder]=\"data.date.placeholder\"\r\n [(model)]=\"value\"\r\n type=\"date\"\r\n [min]=\"data.date.min!\"\r\n [max]=\"data.date.max!\"\r\n [required]=\"data.date.required\">\r\n </sd-date>\r\n }\r\n @if (data.radio) {\r\n <sd-radio\r\n [items]=\"data.radio.items\"\r\n [valueField]=\"data.radio.valueField\"\r\n [displayField]=\"data.radio.displayField\"\r\n [display]=\"data.radio.display || 'column'\"\r\n [(model)]=\"value\"\r\n [required]=\"data.radio.required\">\r\n </sd-radio>\r\n }\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n @if (data.noTitle) {\r\n <sd-button [color]=\"data.noButtonColor || 'secondary'\" [title]=\"data.noTitle\" (click)=\"onCancel()\"></sd-button>\r\n }\r\n @if (data.yesTitle) {\r\n <sd-button\r\n class=\"ml-8\"\r\n type=\"fill\"\r\n [color]=\"data.yesButtonColor || 'primary'\"\r\n [disabled]=\"required && !value\"\r\n cdkFocusInitial\r\n [title]=\"data.yesTitle\"\r\n (click)=\"onAccept()\"></sd-button>\r\n }\r\n</div>\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host .mat-dialog-content{margin:0 -16px 16px!important}:host .mat-button{background-color:#f5f5f5}:host ::ng-deep .mat-dialog-title{display:flex;align-items:center;justify-content:flex-start}:host ::ng-deep .mat-dialog-title .mat-icon{margin-right:5px}:host{display:block}:host ::ng-deep .mat-dialog-title .mat-icon.info{color:var(--sd-info)}:host ::ng-deep .mat-dialog-title .mat-icon.warning{color:var(--sd-warning)}:host ::ng-deep .mat-dialog-title .mat-icon.success{color:var(--sd-success)}:host ::ng-deep .mat-dialog-title .mat-icon.error{color:var(--sd-error)}\n"] }]
|
|
55
55
|
}], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
@@ -184,10 +184,10 @@ class SdConfirmService {
|
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
188
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
187
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdConfirmService, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
188
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdConfirmService, providedIn: 'root' });
|
|
189
189
|
}
|
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdConfirmService, decorators: [{
|
|
191
191
|
type: Injectable,
|
|
192
192
|
args: [{
|
|
193
193
|
providedIn: 'root',
|
|
@@ -1,18 +1,157 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable } from '@angular/core';
|
|
3
|
-
import
|
|
4
|
-
import { docxToHtml } from '@omer-go/docx-parser-converter-ts';
|
|
3
|
+
import { OpenFile, PreopenDirectory, File as File$1, ConsoleStdout, WASI } from '@bjorn3/browser_wasi_shim';
|
|
5
4
|
import * as i1 from '@sd-angular/core/services/notify';
|
|
5
|
+
import * as i2 from '@sd-angular/core/services/loading';
|
|
6
|
+
|
|
7
|
+
/* Pandoc WASM core logic — adapted from pandoc-wasm/src/core.js
|
|
8
|
+
*
|
|
9
|
+
* This file is a local copy of the environment-agnostic pandoc core.
|
|
10
|
+
* It imports @bjorn3/browser_wasi_shim directly, avoiding the pandoc-wasm
|
|
11
|
+
* package entry points which use top-level await (incompatible with
|
|
12
|
+
* Angular's esbuild/Vite build pipeline).
|
|
13
|
+
*
|
|
14
|
+
* Source: https://github.com/pandoc/pandoc-wasm (GPL-2.0-or-later)
|
|
15
|
+
*/
|
|
16
|
+
// @ts-nocheck
|
|
17
|
+
function createPandocInstance(wasmBinary) {
|
|
18
|
+
const args = ['pandoc.wasm', '+RTS', '-H64m', '-RTS'];
|
|
19
|
+
const env = [];
|
|
20
|
+
const fileSystem = new Map();
|
|
21
|
+
const fds = [
|
|
22
|
+
new OpenFile(new File$1(new Uint8Array(), { readonly: true })),
|
|
23
|
+
ConsoleStdout.lineBuffered((msg) => console.log(`[WASI stdout] ${msg}`)),
|
|
24
|
+
ConsoleStdout.lineBuffered((msg) => console.warn(`[WASI stderr] ${msg}`)),
|
|
25
|
+
new PreopenDirectory('/', fileSystem),
|
|
26
|
+
];
|
|
27
|
+
const options = { debug: false };
|
|
28
|
+
const wasi = new WASI(args, env, fds, options);
|
|
29
|
+
return WebAssembly.instantiate(wasmBinary, {
|
|
30
|
+
wasi_snapshot_preview1: wasi.wasiImport,
|
|
31
|
+
}).then(({ instance }) => {
|
|
32
|
+
wasi.initialize(instance);
|
|
33
|
+
instance.exports.__wasm_call_ctors();
|
|
34
|
+
function memory_data_view() {
|
|
35
|
+
return new DataView(instance.exports.memory.buffer);
|
|
36
|
+
}
|
|
37
|
+
const argc_ptr = instance.exports.malloc(4);
|
|
38
|
+
memory_data_view().setUint32(argc_ptr, args.length, true);
|
|
39
|
+
const argv = instance.exports.malloc(4 * (args.length + 1));
|
|
40
|
+
for (let i = 0; i < args.length; ++i) {
|
|
41
|
+
const arg = instance.exports.malloc(args[i].length + 1);
|
|
42
|
+
new TextEncoder().encodeInto(args[i], new Uint8Array(instance.exports.memory.buffer, arg, args[i].length));
|
|
43
|
+
memory_data_view().setUint8(arg + args[i].length, 0);
|
|
44
|
+
memory_data_view().setUint32(argv + 4 * i, arg, true);
|
|
45
|
+
}
|
|
46
|
+
memory_data_view().setUint32(argv + 4 * args.length, 0, true);
|
|
47
|
+
const argv_ptr = instance.exports.malloc(4);
|
|
48
|
+
memory_data_view().setUint32(argv_ptr, argv, true);
|
|
49
|
+
instance.exports.hs_init_with_rtsopts(argc_ptr, argv_ptr);
|
|
50
|
+
async function addFile(filename, data, readonly) {
|
|
51
|
+
let uint8Array;
|
|
52
|
+
if (typeof data === 'string') {
|
|
53
|
+
uint8Array = new TextEncoder().encode(data);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const buffer = await data.arrayBuffer();
|
|
57
|
+
uint8Array = new Uint8Array(buffer);
|
|
58
|
+
}
|
|
59
|
+
const file = new File$1(uint8Array, { readonly });
|
|
60
|
+
fileSystem.set(filename, file);
|
|
61
|
+
}
|
|
62
|
+
async function convert(options, stdin, files) {
|
|
63
|
+
const opts_str = JSON.stringify(options);
|
|
64
|
+
const encoded = new TextEncoder().encode(opts_str);
|
|
65
|
+
const opts_ptr = instance.exports.malloc(encoded.length);
|
|
66
|
+
new TextEncoder().encodeInto(opts_str, new Uint8Array(instance.exports.memory.buffer, opts_ptr, encoded.length));
|
|
67
|
+
files = { ...files };
|
|
68
|
+
fileSystem.clear();
|
|
69
|
+
const in_file = new File$1(new Uint8Array(), { readonly: true });
|
|
70
|
+
const out_file = new File$1(new Uint8Array(), { readonly: false });
|
|
71
|
+
const err_file = new File$1(new Uint8Array(), { readonly: false });
|
|
72
|
+
const warnings_file = new File$1(new Uint8Array(), { readonly: false });
|
|
73
|
+
fileSystem.set('stdin', in_file);
|
|
74
|
+
fileSystem.set('stdout', out_file);
|
|
75
|
+
fileSystem.set('stderr', err_file);
|
|
76
|
+
fileSystem.set('warnings', warnings_file);
|
|
77
|
+
const knownFiles = new Set(['stdin', 'stdout', 'stderr', 'warnings']);
|
|
78
|
+
for (const filename in files) {
|
|
79
|
+
await addFile(filename, files[filename], true);
|
|
80
|
+
knownFiles.add(filename);
|
|
81
|
+
}
|
|
82
|
+
const outputFileName = options['output-file'] || null;
|
|
83
|
+
const extractMediaPath = options['extract-media'] || null;
|
|
84
|
+
if (outputFileName) {
|
|
85
|
+
await addFile(outputFileName, new Blob(), false);
|
|
86
|
+
knownFiles.add(outputFileName);
|
|
87
|
+
}
|
|
88
|
+
if (extractMediaPath) {
|
|
89
|
+
await addFile(extractMediaPath, new Blob(), false);
|
|
90
|
+
if (extractMediaPath.endsWith('.zip')) {
|
|
91
|
+
knownFiles.add(extractMediaPath);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (stdin) {
|
|
95
|
+
in_file.data = new TextEncoder().encode(stdin);
|
|
96
|
+
}
|
|
97
|
+
instance.exports.convert(opts_ptr, encoded.length);
|
|
98
|
+
if (options['output-file']) {
|
|
99
|
+
const outputFile = fileSystem.get(options['output-file']);
|
|
100
|
+
if (outputFile && outputFile.data && outputFile.data.length > 0) {
|
|
101
|
+
files[options['output-file']] = new Blob([outputFile.data]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (options['extract-media']) {
|
|
105
|
+
const mediaFile = fileSystem.get(options['extract-media']);
|
|
106
|
+
if (mediaFile && mediaFile.data && mediaFile.data.length > 0) {
|
|
107
|
+
files[options['extract-media']] = new Blob([mediaFile.data], { type: 'application/zip' });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const mediaFiles = {};
|
|
111
|
+
for (const [name, fileData] of fileSystem.entries()) {
|
|
112
|
+
if (!knownFiles.has(name) && fileData && fileData.data && fileData.data.length > 0) {
|
|
113
|
+
const blob = new Blob([fileData.data]);
|
|
114
|
+
files[name] = blob;
|
|
115
|
+
if (name !== outputFileName && name !== extractMediaPath) {
|
|
116
|
+
mediaFiles[name] = blob;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const rawWarnings = new TextDecoder('utf-8', { fatal: true }).decode(warnings_file.data);
|
|
121
|
+
let warnings = [];
|
|
122
|
+
if (rawWarnings) {
|
|
123
|
+
try {
|
|
124
|
+
warnings = JSON.parse(rawWarnings);
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
console.warn('Failed to parse warnings:', e);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
stdout: new TextDecoder('utf-8', { fatal: true }).decode(out_file.data),
|
|
132
|
+
stderr: new TextDecoder('utf-8', { fatal: true }).decode(err_file.data),
|
|
133
|
+
warnings,
|
|
134
|
+
files,
|
|
135
|
+
mediaFiles,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return { convert };
|
|
139
|
+
});
|
|
140
|
+
}
|
|
6
141
|
|
|
7
142
|
class SdDocxService {
|
|
8
143
|
notifyService;
|
|
144
|
+
loadingService;
|
|
9
145
|
#DEFAULT_MAX_SIZE_MB = 50;
|
|
10
146
|
#VALID_EXTENSIONS = ['.doc', '.docx'];
|
|
11
147
|
#ERROR_INVALID_FORMAT = 'Định dạng không hợp lệ. Vui lòng chọn Mẫu có định dạng DOC hoặc DOCX';
|
|
12
148
|
#ERROR_SIZE_EXCEEDED = 'Kích thước tệp mẫu vượt quá tiêu chuẩn hỗ trợ của hệ thống. Vui lòng thử lại';
|
|
149
|
+
#PANDOC_WASM_URL = 'https://pandoc.github.io/pandoc-wasm/pandoc.wasm';
|
|
13
150
|
#fileInput = null;
|
|
14
|
-
|
|
151
|
+
#pandocInstance = null;
|
|
152
|
+
constructor(notifyService, loadingService) {
|
|
15
153
|
this.notifyService = notifyService;
|
|
154
|
+
this.loadingService = loadingService;
|
|
16
155
|
}
|
|
17
156
|
async open(options) {
|
|
18
157
|
return new Promise(resolve => {
|
|
@@ -28,11 +167,21 @@ class SdDocxService {
|
|
|
28
167
|
resolve(null);
|
|
29
168
|
return;
|
|
30
169
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
170
|
+
this.loadingService.start();
|
|
171
|
+
try {
|
|
172
|
+
const result = await this.convertToHtml(file, options);
|
|
173
|
+
resolve(result);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
console.error('[SdDocxService] DocX conversion error:', error);
|
|
177
|
+
this.notifyService.error('Có lỗi xảy ra khi chuyển đổi file DOCX');
|
|
178
|
+
resolve(null);
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
input.value = '';
|
|
182
|
+
input.removeEventListener('change', handleChange);
|
|
183
|
+
this.loadingService.stop();
|
|
184
|
+
}
|
|
36
185
|
};
|
|
37
186
|
this.#fileInput.addEventListener('change', handleChange, { once: true });
|
|
38
187
|
this.#fileInput.click();
|
|
@@ -48,6 +197,22 @@ class SdDocxService {
|
|
|
48
197
|
this.#fileInput.style.display = 'none';
|
|
49
198
|
document.body.appendChild(this.#fileInput);
|
|
50
199
|
}
|
|
200
|
+
async #getPandocInstance() {
|
|
201
|
+
if (this.#pandocInstance) {
|
|
202
|
+
return this.#pandocInstance;
|
|
203
|
+
}
|
|
204
|
+
console.log('[SdDocxService] Fetching WASM binary from:', this.#PANDOC_WASM_URL);
|
|
205
|
+
const wasmResponse = await fetch(this.#PANDOC_WASM_URL);
|
|
206
|
+
if (!wasmResponse.ok) {
|
|
207
|
+
throw new Error(`Failed to fetch pandoc.wasm: ${wasmResponse.status} ${wasmResponse.statusText}`);
|
|
208
|
+
}
|
|
209
|
+
console.log('[SdDocxService] WASM fetched, size:', wasmResponse.headers.get('content-length'));
|
|
210
|
+
const wasmBinary = await wasmResponse.arrayBuffer();
|
|
211
|
+
console.log('[SdDocxService] WASM binary loaded, bytes:', wasmBinary.byteLength);
|
|
212
|
+
this.#pandocInstance = await createPandocInstance(wasmBinary);
|
|
213
|
+
console.log('[SdDocxService] Pandoc instance created successfully');
|
|
214
|
+
return this.#pandocInstance;
|
|
215
|
+
}
|
|
51
216
|
async convertToHtml(input, options) {
|
|
52
217
|
const opts = {
|
|
53
218
|
validateFormat: true,
|
|
@@ -58,18 +223,20 @@ class SdDocxService {
|
|
|
58
223
|
try {
|
|
59
224
|
let fileName;
|
|
60
225
|
let fileSize;
|
|
61
|
-
let
|
|
226
|
+
let blob;
|
|
62
227
|
if (input instanceof File) {
|
|
63
228
|
fileName = input.name;
|
|
64
229
|
fileSize = input.size;
|
|
65
|
-
|
|
230
|
+
blob = input;
|
|
66
231
|
}
|
|
67
232
|
else if (input instanceof Blob) {
|
|
68
233
|
fileSize = input.size;
|
|
69
|
-
|
|
234
|
+
blob = input;
|
|
70
235
|
}
|
|
71
236
|
else {
|
|
72
|
-
|
|
237
|
+
blob = new Blob([input], {
|
|
238
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
239
|
+
});
|
|
73
240
|
}
|
|
74
241
|
if (opts.validateFormat && fileName) {
|
|
75
242
|
if (!this.#isValidFormat(fileName)) {
|
|
@@ -84,33 +251,25 @@ class SdDocxService {
|
|
|
84
251
|
return null;
|
|
85
252
|
}
|
|
86
253
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
html
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
catch (omerError) {
|
|
100
|
-
console.log(omerError);
|
|
101
|
-
// Fallback to mammoth if @omer-go fails (e.g., BOM issue)
|
|
102
|
-
console.warn('@omer-go/docx-parser-converter-ts failed, falling back to mammoth:', omerError?.message);
|
|
103
|
-
const result = await mammoth.convertToHtml({ arrayBuffer }, conversionOptions);
|
|
104
|
-
html = result.value;
|
|
105
|
-
messages = result.messages.map(m => m.toString());
|
|
106
|
-
}
|
|
254
|
+
console.log('[SdDocxService] Getting pandoc instance...');
|
|
255
|
+
const pandoc = await this.#getPandocInstance();
|
|
256
|
+
console.log('[SdDocxService] Converting DOCX, blob size:', blob.size);
|
|
257
|
+
const pandocOpts = {
|
|
258
|
+
from: 'docx',
|
|
259
|
+
to: 'html',
|
|
260
|
+
'input-files': ['document.docx'],
|
|
261
|
+
standalone: true,
|
|
262
|
+
'embed-resources': true,
|
|
263
|
+
};
|
|
264
|
+
const result = await pandoc.convert(pandocOpts, null, { 'document.docx': blob });
|
|
265
|
+
console.log('[SdDocxService] Conversion done, stdout length:', result.stdout?.length, 'stderr:', result.stderr);
|
|
107
266
|
return {
|
|
108
|
-
html,
|
|
109
|
-
messages,
|
|
267
|
+
html: result.stdout,
|
|
268
|
+
messages: result.warnings.map((w) => String(w)),
|
|
110
269
|
};
|
|
111
270
|
}
|
|
112
271
|
catch (error) {
|
|
113
|
-
console.error('DocX conversion error:', error);
|
|
272
|
+
console.error('[SdDocxService] DocX conversion error:', error);
|
|
114
273
|
this.notifyService.error('Có lỗi xảy ra khi chuyển đổi file DOCX');
|
|
115
274
|
return null;
|
|
116
275
|
}
|
|
@@ -123,47 +282,15 @@ class SdDocxService {
|
|
|
123
282
|
const lowerCaseName = fileName.toLowerCase();
|
|
124
283
|
return this.#VALID_EXTENSIONS.some(ext => lowerCaseName.endsWith(ext));
|
|
125
284
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const reader = new FileReader();
|
|
129
|
-
reader.onload = e => {
|
|
130
|
-
const result = e.target?.result;
|
|
131
|
-
if (result) {
|
|
132
|
-
resolve(result);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
reject(new Error('Failed to read file'));
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
reader.onerror = () => reject(reader.error);
|
|
139
|
-
reader.readAsArrayBuffer(file);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
#blobToArrayBuffer(blob) {
|
|
143
|
-
return new Promise((resolve, reject) => {
|
|
144
|
-
const reader = new FileReader();
|
|
145
|
-
reader.onload = e => {
|
|
146
|
-
const result = e.target?.result;
|
|
147
|
-
if (result) {
|
|
148
|
-
resolve(result);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
reject(new Error('Failed to read blob'));
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
reader.onerror = () => reject(reader.error);
|
|
155
|
-
reader.readAsArrayBuffer(blob);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdDocxService, deps: [{ token: i1.SdNotifyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
159
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdDocxService, providedIn: 'root' });
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdDocxService, deps: [{ token: i1.SdNotifyService }, { token: i2.SdLoadingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
286
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdDocxService, providedIn: 'root' });
|
|
160
287
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdDocxService, decorators: [{
|
|
162
289
|
type: Injectable,
|
|
163
290
|
args: [{
|
|
164
291
|
providedIn: 'root',
|
|
165
292
|
}]
|
|
166
|
-
}], ctorParameters: () => [{ type: i1.SdNotifyService }] });
|
|
293
|
+
}], ctorParameters: () => [{ type: i1.SdNotifyService }, { type: i2.SdLoadingService }] });
|
|
167
294
|
|
|
168
295
|
/**
|
|
169
296
|
* Generated bundle index. Do not edit.
|