@sd-angular/core 19.0.0-beta.80 → 19.0.0-beta.81
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/components/document-builder/src/document-builder.component.d.ts +2 -2
- package/components/document-builder/src/document-builder.model.d.ts +1 -1
- package/components/editor/index.d.ts +3 -0
- package/components/editor/src/configurations/editor.configuration.d.ts +12 -0
- package/components/editor/src/configurations/index.d.ts +1 -0
- package/components/editor/src/editor.component.d.ts +42 -0
- package/components/editor/src/models/editor.model.d.ts +8 -0
- package/components/editor/src/models/image-upload.plugin.model.d.ts +20 -0
- package/components/editor/src/models/index.d.ts +2 -0
- package/components/editor/src/plugins/image-upload/image-upload.plugin.d.ts +22 -0
- package/components/editor/src/plugins/image-upload/utils/batch.utils.d.ts +14 -0
- package/components/editor/src/plugins/image-upload/utils/index.d.ts +3 -0
- package/components/editor/src/plugins/image-upload/utils/style.utils.d.ts +2 -0
- package/components/editor/src/plugins/image-upload/utils/validate.utils.d.ts +3 -0
- package/components/index.d.ts +1 -0
- package/fesm2022/sd-angular-core-components-document-builder.mjs +0 -1
- package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-editor.mjs +933 -0
- package/fesm2022/sd-angular-core-components-editor.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components.mjs +1 -0
- package/fesm2022/sd-angular-core-components.mjs.map +1 -1
- package/package.json +61 -57
- package/sd-angular-core-19.0.0-beta.81.tgz +0 -0
- package/sd-angular-core-19.0.0-beta.80.tgz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { ClassicEditor, ModelRange } from 'ckeditor5';
|
|
3
3
|
import { VariablePlugin, CkCommentPlugin } from './plugins';
|
|
4
|
-
import { SdDocumentBuilderHeading, SdDocumentBuilderOption
|
|
4
|
+
import { DocumentBuilderOption, SdDocumentBuilderHeading, SdDocumentBuilderOption } from './document-builder.model';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class SdDocumentBuilder {
|
|
7
7
|
#private;
|
|
@@ -10,7 +10,7 @@ export declare class SdDocumentBuilder {
|
|
|
10
10
|
set _disabled(val: boolean | '' | undefined | null);
|
|
11
11
|
contentChange: EventEmitter<string>;
|
|
12
12
|
Editor: typeof ClassicEditor;
|
|
13
|
-
config:
|
|
13
|
+
config: DocumentBuilderOption;
|
|
14
14
|
ngOnInit(): void;
|
|
15
15
|
ngOnDestroy(): void;
|
|
16
16
|
onReady(editor: ClassicEditor): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorConfig, EventInfo, ModelDocumentSelection, ViewDataTransfer } from 'ckeditor5';
|
|
2
2
|
import { CkCommentConfig } from './plugins/ck-comment/ck-comment.plugin.model';
|
|
3
|
-
export type
|
|
3
|
+
export type DocumentBuilderOption = EditorConfig & {
|
|
4
4
|
getOption?: () => SdDocumentBuilderOption;
|
|
5
5
|
};
|
|
6
6
|
export interface SdDocumentBuilderOption {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export interface SdEditorUploadFileDetail {
|
|
3
|
+
idOrKey: string;
|
|
4
|
+
cdn: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
export type SdEditorUploadFileFuncUpload = (files: File[]) => Promise<SdEditorUploadFileDetail[]>;
|
|
8
|
+
export interface ISdEditorConfiguration {
|
|
9
|
+
key?: string;
|
|
10
|
+
upload: SdEditorUploadFileFuncUpload;
|
|
11
|
+
}
|
|
12
|
+
export declare const SD_EDITOR_CONFIGURATION: InjectionToken<ISdEditorConfiguration>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './editor.configuration';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FormGroup } from '@angular/forms';
|
|
2
|
+
import { ClassicEditor } from 'ckeditor5';
|
|
3
|
+
import { EditorOption, SdEditorOption } from './models';
|
|
4
|
+
import { SdCustomValidator, SdFormControl } from '@sd-angular/core/forms/models';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class SdEditor {
|
|
7
|
+
#private;
|
|
8
|
+
readonly option: import("@angular/core").InputSignal<SdEditorOption>;
|
|
9
|
+
readonly height: import("@angular/core").InputSignal<string>;
|
|
10
|
+
readonly maxHeight: import("@angular/core").InputSignal<string>;
|
|
11
|
+
readonly maxlength: import("@angular/core").InputSignal<number | undefined>;
|
|
12
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
13
|
+
readonly helperText: import("@angular/core").InputSignal<string | undefined>;
|
|
14
|
+
readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
15
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
16
|
+
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
17
|
+
readonly hideInlineError: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
18
|
+
readonly inlineError: import("@angular/core").InputSignal<string | undefined>;
|
|
19
|
+
readonly placeholder: import("@angular/core").InputSignal<string | undefined>;
|
|
20
|
+
readonly validator: import("@angular/core").InputSignal<SdCustomValidator | undefined>;
|
|
21
|
+
readonly form: import("@angular/core").InputSignalWithTransform<FormGroup<any> | undefined, any>;
|
|
22
|
+
readonly key: import("@angular/core").InputSignal<string | undefined>;
|
|
23
|
+
readonly autoIdInput: import("@angular/core").InputSignal<string | null | undefined>;
|
|
24
|
+
readonly autoId: import("@angular/core").Signal<string | undefined>;
|
|
25
|
+
readonly name: import("@angular/core").InputSignal<string>;
|
|
26
|
+
readonly valueModel: import("@angular/core").ModelSignal<string>;
|
|
27
|
+
readonly sdChange: import("@angular/core").OutputEmitterRef<string>;
|
|
28
|
+
readonly sdBlur: import("@angular/core").OutputEmitterRef<FocusEvent>;
|
|
29
|
+
readonly sdFocus: import("@angular/core").OutputEmitterRef<FocusEvent>;
|
|
30
|
+
readonly _textLength: import("@angular/core").WritableSignal<number>;
|
|
31
|
+
readonly formControl: SdFormControl;
|
|
32
|
+
readonly isOverLimit: import("@angular/core").Signal<boolean>;
|
|
33
|
+
get errorMessage(): string | undefined;
|
|
34
|
+
readonly Editor: typeof ClassicEditor;
|
|
35
|
+
readonly editorConfig: import("@angular/core").Signal<EditorOption>;
|
|
36
|
+
constructor();
|
|
37
|
+
onReady: (editor: ClassicEditor) => void;
|
|
38
|
+
focusEditor: () => void | undefined;
|
|
39
|
+
upload: () => Promise<string>;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdEditor, never>;
|
|
41
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdEditor, "sd-editor", never, { "option": { "alias": "option"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "helperText": { "alias": "helperText"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "hideInlineError": { "alias": "hideInlineError"; "required": false; "isSignal": true; }; "inlineError": { "alias": "inlineError"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "validator": { "alias": "validator"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "key": { "alias": "key"; "required": false; "isSignal": true; }; "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "valueModel": { "alias": "model"; "required": false; "isSignal": true; }; }, { "valueModel": "modelChange"; "sdChange": "sdChange"; "sdBlur": "sdBlur"; "sdFocus": "sdFocus"; }, never, never, true, never>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorConfig } from 'ckeditor5';
|
|
2
|
+
import { SdEditorImageConfig } from './image-upload.plugin.model';
|
|
3
|
+
export interface SdEditorOption {
|
|
4
|
+
imageConfig?: SdEditorImageConfig;
|
|
5
|
+
}
|
|
6
|
+
export type EditorOption = EditorConfig & {
|
|
7
|
+
getOption?: () => SdEditorOption;
|
|
8
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SdEditorUploadFileDetail } from '../configurations';
|
|
2
|
+
export interface SdEditorImageUploadValidation {
|
|
3
|
+
minWidth?: number;
|
|
4
|
+
minHeight?: number;
|
|
5
|
+
maxWidth?: number;
|
|
6
|
+
maxHeight?: number;
|
|
7
|
+
maxSizeMB?: number;
|
|
8
|
+
allowedFormats?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface SdEditorImageConfig {
|
|
11
|
+
/** 'immediate': upload ngay khi chọn ảnh.
|
|
12
|
+
** 'deferred': lưu tạm, upload thì viewChild component rồi gọi upload() */
|
|
13
|
+
uploadMode?: 'immediate' | 'deferred';
|
|
14
|
+
uploadFn?: (files: File[]) => Promise<SdEditorUploadFileDetail[]>;
|
|
15
|
+
validation?: SdEditorImageUploadValidation;
|
|
16
|
+
maxConcurrentUploads?: number;
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
maxImagesPerSelection?: number;
|
|
19
|
+
lazyLoad?: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileRepository, Image, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Plugin } from 'ckeditor5';
|
|
2
|
+
declare class UploadQueue {
|
|
3
|
+
#private;
|
|
4
|
+
readonly maxConcurrent: number;
|
|
5
|
+
constructor(maxConcurrent: number);
|
|
6
|
+
run<T>(task: () => Promise<T>): Promise<T>;
|
|
7
|
+
}
|
|
8
|
+
export declare class EditorImageUploadPlugin extends Plugin {
|
|
9
|
+
#private;
|
|
10
|
+
pendingFiles: Map<string, File>;
|
|
11
|
+
uploadQueue: UploadQueue;
|
|
12
|
+
setMeta(cdnUrl: string, meta: {
|
|
13
|
+
name?: string;
|
|
14
|
+
idOrKey?: string;
|
|
15
|
+
lazyLoad: boolean;
|
|
16
|
+
}): void;
|
|
17
|
+
static get pluginName(): "EditorImageUploadPlugin";
|
|
18
|
+
static get requires(): readonly [typeof FileRepository, typeof Image, typeof ImageResize, typeof ImageUpload, typeof ImageStyle, typeof ImageToolbar];
|
|
19
|
+
init(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClassicEditor } from 'ckeditor5';
|
|
2
|
+
import { SdEditorOption } from '../../../models';
|
|
3
|
+
import { SdEditorUploadFileDetail, SdEditorUploadFileFuncUpload } from '../../../configurations';
|
|
4
|
+
export declare const getBatchConfig: (option: SdEditorOption) => {
|
|
5
|
+
batchSize: number;
|
|
6
|
+
maxConcurrent: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getActiveBlobUrls: (editor: ClassicEditor) => Set<string>;
|
|
9
|
+
export declare const filterActivePendingFiles: (pendingFiles: Map<string, File>, activeBlobUrls: Set<string>) => Array<[string, File]>;
|
|
10
|
+
export declare const runBatchUploads: (toUpload: Array<[string, File]>, uploadFn: SdEditorUploadFileFuncUpload, batchSize: number, maxConcurrent: number) => Promise<{
|
|
11
|
+
replacements: Map<string, SdEditorUploadFileDetail>;
|
|
12
|
+
failedBatches: Array<[string, File][]>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const applyReplacementsToEditor: (editor: ClassicEditor, replacements: Map<string, SdEditorUploadFileDetail>) => void;
|
package/components/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export * from '@sd-angular/core/components/mini-editor';
|
|
|
18
18
|
export * from '@sd-angular/core/components/view';
|
|
19
19
|
export * from '@sd-angular/core/components/code-editor';
|
|
20
20
|
export * from '@sd-angular/core/components/chart';
|
|
21
|
+
export * from '@sd-angular/core/components/editor';
|