@sd-angular/core 19.0.0-beta.13 → 19.0.0-beta.15

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.
Files changed (46) hide show
  1. package/assets/scss/ckeditor5.scss +59 -2
  2. package/components/document-builder/src/document-builder.component.d.ts +7 -2
  3. package/components/document-builder/src/document-builder.model.d.ts +5 -1
  4. package/components/document-builder/src/plugins/highlight-range/highlight-range.plugin.d.ts +4 -0
  5. package/components/document-builder/src/plugins/image-custom/image-custom.plugin.d.ts +31 -0
  6. package/components/document-builder/src/plugins/index.d.ts +1 -0
  7. package/components/document-builder/src/plugins/table-fit/table-fit.plugin.d.ts +25 -0
  8. package/components/index.d.ts +1 -0
  9. package/components/mini-editor/index.d.ts +2 -0
  10. package/components/mini-editor/src/mini-editor.component.d.ts +90 -0
  11. package/components/mini-editor/src/mini-editor.model.d.ts +42 -0
  12. package/components/view/index.d.ts +1 -0
  13. package/components/view/src/view.component.d.ts +14 -0
  14. package/directives/index.d.ts +1 -0
  15. package/directives/src/sd-href.directive.d.ts +9 -0
  16. package/fesm2022/sd-angular-core-components-document-builder.mjs +642 -69
  17. package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
  18. package/fesm2022/sd-angular-core-components-mini-editor.mjs +326 -0
  19. package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -0
  20. package/fesm2022/sd-angular-core-components-view.mjs +88 -0
  21. package/fesm2022/sd-angular-core-components-view.mjs.map +1 -0
  22. package/fesm2022/sd-angular-core-components-workflow.mjs +16 -26
  23. package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
  24. package/fesm2022/sd-angular-core-components.mjs +1 -0
  25. package/fesm2022/sd-angular-core-components.mjs.map +1 -1
  26. package/fesm2022/sd-angular-core-directives.mjs +51 -2
  27. package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
  28. package/fesm2022/sd-angular-core-forms-input-number.mjs +7 -0
  29. package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
  30. package/fesm2022/sd-angular-core-forms-radio.mjs +3 -2
  31. package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
  32. package/fesm2022/sd-angular-core-forms-select.mjs +7 -4
  33. package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
  34. package/fesm2022/sd-angular-core-forms-textarea.mjs +2 -2
  35. package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
  36. package/fesm2022/sd-angular-core-modules-layout.mjs +52 -17
  37. package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
  38. package/fesm2022/sd-angular-core-modules-oidc.mjs +0 -2
  39. package/fesm2022/sd-angular-core-modules-oidc.mjs.map +1 -1
  40. package/modules/layout/components/sidebar-v1/components/sidebar/sidebar.component.d.ts +1 -0
  41. package/modules/layout/components/sidebar-v1/components/user/user.component.d.ts +5 -2
  42. package/modules/layout/configurations/layout.configuration.d.ts +3 -0
  43. package/modules/layout/services/storage/storage.service.d.ts +1 -0
  44. package/package.json +64 -56
  45. package/sd-angular-core-19.0.0-beta.15.tgz +0 -0
  46. package/sd-angular-core-19.0.0-beta.13.tgz +0 -0
@@ -21,11 +21,68 @@
21
21
  @import '@ckeditor/ckeditor5-basic-styles/dist/index.css';
22
22
  // @import '@ckeditor/ckeditor5-block-quote/dist/index.css';
23
23
  @import '@ckeditor/ckeditor5-heading/dist/index.css';
24
- @import '@ckeditor/ckeditor5-image/dist/index.css';
24
+ // @import '@ckeditor/ckeditor5-image/dist/index.css';
25
+ @import '@ckeditor/ckeditor5-image/dist/index-editor.css';
25
26
  @import '@ckeditor/ckeditor5-indent/dist/index.css';
26
27
  @import '@ckeditor/ckeditor5-link/dist/index.css';
27
28
  @import '@ckeditor/ckeditor5-list/dist/index.css';
28
29
  // @import '@ckeditor/ckeditor5-media-embed/dist/index.css';
29
30
  @import '@ckeditor/ckeditor5-paste-from-office/dist/index.css';
30
- @import '@ckeditor/ckeditor5-table/dist/index.css';
31
+
32
+ // hung.pham16: không sử dụng default styles của ckeditor vì server không hỗ trợ
33
+ // @import '@ckeditor/ckeditor5-table/dist/index.css';
34
+ @import '@ckeditor/ckeditor5-table/dist/index-editor.css';
35
+
31
36
  // @import '@ckeditor/ckeditor5-mention/dist/index.css';
37
+
38
+ // Custom toolbar
39
+ .ck-editor {
40
+ /* --- 1. GIẢM KÍCH THƯỚC ICON VÀ CHỮ --- */
41
+ /* Giảm cỡ chữ trong dropdown (mặc định khoảng 13px) */
42
+ --ck-font-size-base: 11px !important;
43
+
44
+ /* Giảm kích thước Icon (mặc định 20px) */
45
+ --ck-icon-size: 16px !important;
46
+
47
+ /* --- 2. TỐI ƯU KHOẢNG CÁCH (Padding/Margin) --- */
48
+
49
+ /* Giảm khoảng cách giữa các nút */
50
+ --ck-spacing-small: 2px !important;
51
+ --ck-spacing-standard: 6px !important;
52
+ --ck-spacing-large: 8px !important;
53
+
54
+ /* */
55
+ --ck-color-table-focused-cell-background: transparent !important;
56
+ --ck-table-content-default-border-color: transparent !important;
57
+
58
+ //
59
+ --ck-insert-table-dropdown-padding: 10px;
60
+ --ck-insert-table-dropdown-box-height: 16px;
61
+ --ck-insert-table-dropdown-box-width: 16px;
62
+ --ck-insert-table-dropdown-box-margin: 1px;
63
+
64
+ --ck-focus-ring: 1px solid var(--ck-color-base-border);
65
+ }
66
+
67
+ /* Giảm độ cao của thanh toolbar (cho gọn) */
68
+ .ck-toolbar {
69
+ min-height: 32px !important; /* Mặc định thường là 40px */
70
+ padding: 2px !important;
71
+
72
+ /* Làm màu nền toolbar nhạt hơn cho hiện đại */
73
+ background: #f8f9fa !important;
74
+ border-bottom: 1px solid #e0e0e0 !important;
75
+ }
76
+
77
+ .ck-toolbar__items {
78
+ /* Chỉnh nút bấm trong toolbar nhỏ lại */
79
+ > .ck-button {
80
+ padding: 2px 4px !important; /* Giảm padding trái phải của nút */
81
+ min-height: 24px !important;
82
+ }
83
+
84
+ /* Chỉnh lại dropdown (Heading, Font Size) cho khớp */
85
+ > .ck-dropdown {
86
+ min-height: 24px !important;
87
+ }
88
+ }
@@ -42,7 +42,10 @@ export declare class SdDocumentBuilder {
42
42
  * @param data - Dữ liệu extra data
43
43
  * @returns SdDocumentBuilderComment hoặc null nếu không có text được chọn
44
44
  */
45
- add: <T = any>(range: ModelRange, comment: string, data?: T) => SdDocumentBuilderComment<T> | null;
45
+ add: <T = any>(range: ModelRange, comment: string, args?: {
46
+ markerIdExternal?: string | number;
47
+ data?: T;
48
+ }) => SdDocumentBuilderComment<T> | null;
46
49
  /**
47
50
  * Cập nhật nội dung comment
48
51
  * @param markerId - ID của marker
@@ -73,7 +76,7 @@ export declare class SdDocumentBuilder {
73
76
  * Lấy tất cả variabes trong document
74
77
  * @returns Danh sách tất cả variables
75
78
  */
76
- all: () => SdDocumentBuilderVariable[];
79
+ all: <T = any>() => SdDocumentBuilderVariable<T>[];
77
80
  /**
78
81
  * Scroll tới vị trí của variable
79
82
  * @param uuid - uuid của variable FE sẽ tự sinh sau mỗi lần drop vào editor
@@ -93,6 +96,8 @@ export declare class SdDocumentBuilder {
93
96
  header?: string;
94
97
  footer?: string;
95
98
  }): void;
99
+ hightSelectRange: (range: ModelRange) => void;
100
+ removeHighlightSeclectRange: () => void;
96
101
  static ɵfac: i0.ɵɵFactoryDeclaration<SdDocumentBuilder, never>;
97
102
  static ɵcmp: i0.ɵɵComponentDeclaration<SdDocumentBuilder, "sd-document-builder", never, { "option": { "alias": "option"; "required": true; }; "_disabled": { "alias": "disabled"; "required": false; }; }, { "contentChange": "contentChange"; }, never, never, true, never>;
98
103
  }
@@ -4,7 +4,7 @@ export type SdEditorConfig = EditorConfig & {
4
4
  };
5
5
  export interface SdDocumentBuilderOption {
6
6
  onDropVariable?: (variable: SdDocumentBuilderVariable, dropIndex: number) => boolean | Promise<boolean | SdDocumentBuilderVariable>;
7
- onAddComment?: (range: ModelRange) => void;
7
+ onAddComment?: (selectedComment: SdDocumentBuilderSelectedComment) => void;
8
8
  onSelectComment?: (markerId: string) => void;
9
9
  onSelection?: (selection: ModelDocumentSelection, $event: EventInfo<string, unknown>) => void;
10
10
  onOrientation?: (orientation: 'PORTRAIT' | 'LANDSCAPE') => void;
@@ -17,6 +17,10 @@ export interface SdDocumentBuilderVariable<T = any> {
17
17
  display: string;
18
18
  data?: T;
19
19
  }
20
+ export interface SdDocumentBuilderSelectedComment {
21
+ range: ModelRange;
22
+ selectedText: string;
23
+ }
20
24
  export interface SdDocumentBuilderComment<T = any> {
21
25
  markerId: string;
22
26
  selectedText: string;
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'ckeditor5';
2
+ export declare class HighlightRangePlugin extends Plugin {
3
+ init(): void;
4
+ }
@@ -0,0 +1,31 @@
1
+ import { Plugin } from 'ckeditor5';
2
+ export declare class ImageCustomPlugin extends Plugin {
3
+ static get pluginName(): "ImageCustomPlugin";
4
+ init(): void;
5
+ /**
6
+ * Xử lý sự kiện chèn ảnh
7
+ */
8
+ private handleImageInsert;
9
+ /**
10
+ * Xử lý sự kiện thay đổi attribute ảnh
11
+ */
12
+ private handleImageAttributeChange;
13
+ /**
14
+ * Xử lý sự kiện thay đổi style ảnh - thêm float inline style cho căn chỉnh
15
+ */
16
+ private handleImageStyleChange;
17
+ /**
18
+ * Áp dụng custom styles cho element ảnh
19
+ */
20
+ private applyCustomStyles;
21
+ /**
22
+ * Tìm container ck-widget (element figure)
23
+ * CKEditor wrap ảnh block trong <figure class="ck-widget"><img></figure>
24
+ */
25
+ private findWidgetElement;
26
+ /**
27
+ * Tìm element img thực tế bên trong widget structure
28
+ * CKEditor wrap ảnh block trong <figure class="ck-widget"><img></figure>
29
+ */
30
+ private findImgElement;
31
+ }
@@ -3,4 +3,5 @@ export * from './comment/comment.plugin';
3
3
  export * from './variable/variable.plugin';
4
4
  export * from './table-fit/table-fit.plugin';
5
5
  export * from './image-upload/image-upload.plugin';
6
+ export * from './image-custom/image-custom.plugin';
6
7
  export * from './page-orientation/page-orientation.plugin';
@@ -1,4 +1,29 @@
1
1
  import { Plugin } from 'ckeditor5';
2
2
  export declare class TableFitPlugin extends Plugin {
3
3
  init(): void;
4
+ /**
5
+ * Apply default table width
6
+ */
7
+ private _applyTableDefaults;
8
+ /**
9
+ * Apply default borders to all cells in a table
10
+ */
11
+ private _applyCellBorders;
12
+ /**
13
+ * Setup listener to preserve cell/table styles when model changes
14
+ */
15
+ private _setupStylePreservationOnModelChange;
16
+ /**
17
+ * Find tables that need border fixes from model changes
18
+ */
19
+ private _findTablesNeedingFix;
20
+ /**
21
+ * Find parent table element
22
+ */
23
+ private _findParentTable;
24
+ /**
25
+ * Cleanup listeners when plugin is destroyed
26
+ * Note: this.listenTo() listeners are automatically cleaned up by super.destroy()
27
+ */
28
+ destroy(): void;
4
29
  }
@@ -14,3 +14,4 @@ export * from '@sd-angular/core/components/anchor-v2';
14
14
  export * from '@sd-angular/core/components/query-builder';
15
15
  export * from '@sd-angular/core/components/import-excel';
16
16
  export * from '@sd-angular/core/components/document-builder';
17
+ export * from '@sd-angular/core/components/mini-editor';
@@ -0,0 +1,2 @@
1
+ export * from './src/mini-editor.model';
2
+ export * from './src/mini-editor.component';
@@ -0,0 +1,90 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { ClassicEditor } from 'ckeditor5';
3
+ import { ControlValueAccessor } from '@angular/forms';
4
+ import { SdMiniEditorOption, SdMiniEditorConfig } from './mini-editor.model';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Component sd-mini-editor - Editor đơn giản cho comment input
8
+ * Sử dụng CKEditor với chế độ đơn giản (bold, italic, link)
9
+ * Hỗ trợ mention và output format (html/markdown)
10
+ *
11
+ * @example
12
+ * ```html
13
+ * <sd-mini-editor
14
+ * [option]="editorOption"
15
+ * [(ngModel)]="content"
16
+ * (contentChange)="onContentChange($event)"
17
+ * >
18
+ * </sd-mini-editor>
19
+ * ```
20
+ */
21
+ export declare class SdMiniEditor implements ControlValueAccessor {
22
+ #private;
23
+ /** Cấu hình option cho editor */
24
+ option: SdMiniEditorOption;
25
+ /** NgModel binding - nội dung HTML/Markdown */
26
+ value: string;
27
+ valueChange: EventEmitter<string>;
28
+ /** Event emitter khi content thay đổi */
29
+ contentChange: EventEmitter<string>;
30
+ /** Event emitter khi blur */
31
+ blur: EventEmitter<FocusEvent>;
32
+ /** Event emitter khi focus */
33
+ focus: EventEmitter<FocusEvent>;
34
+ /** Disabled state */
35
+ disabled: boolean;
36
+ Editor: typeof ClassicEditor;
37
+ get editorConfig(): SdMiniEditorConfig;
38
+ constructor();
39
+ ngOnDestroy(): void;
40
+ /**
41
+ * Xử lý khi editor ready
42
+ */
43
+ onReady(editor: ClassicEditor): void;
44
+ /**
45
+ * Set nội dung cho editor
46
+ */
47
+ setContent(content: string): void;
48
+ /**
49
+ * Get nội dung từ editor
50
+ */
51
+ getContent(): string;
52
+ /**
53
+ * Get nội dung HTML gốc (không convert)
54
+ */
55
+ getHtmlContent(): string;
56
+ /**
57
+ * Focus vào editor
58
+ */
59
+ focusEditor(): void;
60
+ /**
61
+ * Insert mention vào vị trí con trỏ hiện tại
62
+ */
63
+ insertMention(item: {
64
+ id: string;
65
+ name: string;
66
+ marker?: string;
67
+ }): void;
68
+ /**
69
+ * Get danh sách mentions trong nội dung
70
+ */
71
+ getMentions(): Array<{
72
+ id: string;
73
+ name: string;
74
+ marker: string;
75
+ }>;
76
+ /**
77
+ * ControlValueAccessor: Write value
78
+ */
79
+ writeValue(value: string): void;
80
+ /**
81
+ * ControlValueAccessor: Register change callback
82
+ */
83
+ registerOnChange(fn: (value: string) => void): void;
84
+ /**
85
+ * ControlValueAccessor: Register touched callback
86
+ */
87
+ registerOnTouched(fn: () => void): void;
88
+ static ɵfac: i0.ɵɵFactoryDeclaration<SdMiniEditor, never>;
89
+ static ɵcmp: i0.ɵɵComponentDeclaration<SdMiniEditor, "sd-mini-editor", never, { "option": { "alias": "option"; "required": true; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; "contentChange": "contentChange"; "blur": "blur"; "focus": "focus"; }, never, never, true, never>;
90
+ }
@@ -0,0 +1,42 @@
1
+ import { EditorConfig, MentionFeed, MentionFeedObjectItem } from 'ckeditor5';
2
+ export type { MentionFeedObjectItem };
3
+ export type SdMiniEditorOutputFormat = 'html' | 'markdown';
4
+ export interface SdMiniEditorMentionConfig {
5
+ /** Feed data cho mention - có thể là array hoặc function trả về Promise
6
+ * CKEditor MentionFeed đã hỗ trợ: marker, minChars, dropdownLimit, itemRenderer
7
+ */
8
+ feeds?: MentionFeed[];
9
+ /** Custom render function cho giá trị mention khi chèn vào editor
10
+ * Trả về object với text và các attributes tùy chỉnh
11
+ */
12
+ valueRender?: (item: MentionFeedObjectItem) => {
13
+ text: string;
14
+ attributes?: Record<string, string>;
15
+ };
16
+ }
17
+ export type SdMiniEditorMentionItem<T = any> = MentionFeedObjectItem & {
18
+ data?: T;
19
+ };
20
+ export interface SdMiniEditorOption {
21
+ /** Output format: 'html' hoặc 'markdown' (mặc định: 'html') */
22
+ outputFormat?: SdMiniEditorOutputFormat;
23
+ /** Placeholder text */
24
+ placeholder?: string;
25
+ /** Chiều cao editor (mặc định: auto) */
26
+ height?: string;
27
+ /** Bật/tắt mention plugin */
28
+ enableMention?: boolean;
29
+ /** Cấu hình mention */
30
+ mentionConfig?: SdMiniEditorMentionConfig;
31
+ /** Callback khi nội dung thay đổi */
32
+ onChange?: (content: string) => void;
33
+ /** Callback khi blur */
34
+ onBlur?: (event: FocusEvent) => void;
35
+ /** Callback khi focus */
36
+ onFocus?: (event: FocusEvent) => void;
37
+ /** Callback khi mention được chọn */
38
+ onMentionSelect?: (item: SdMiniEditorMentionItem) => void;
39
+ }
40
+ export type SdMiniEditorConfig = EditorConfig & {
41
+ getOption?: () => SdMiniEditorOption;
42
+ };
@@ -0,0 +1 @@
1
+ export * from './src/view.component';
@@ -0,0 +1,14 @@
1
+ import { OnInit } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class SdAvatar implements OnInit {
4
+ #private;
5
+ src: string | undefined | null;
6
+ size: number;
7
+ isUrl: boolean;
8
+ initials: string;
9
+ bgColor: string;
10
+ ngOnInit(): void;
11
+ handleError(): void;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<SdAvatar, never>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<SdAvatar, "sd-view", never, { "src": { "alias": "src"; "required": true; }; "size": { "alias": "size"; "required": false; }; }, {}, never, never, true, never>;
14
+ }
@@ -2,3 +2,4 @@ export * from './src/sd-scroll.directive';
2
2
  export * from './src/sd-desktop.directive';
3
3
  export * from './src/sd-mobile.directive';
4
4
  export * from './src/sd-hover-copy.directive';
5
+ export * from './src/sd-href.directive';
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class SdHrefDirective {
3
+ #private;
4
+ url: string;
5
+ get href(): string;
6
+ onClick(event: Event): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<SdHrefDirective, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SdHrefDirective, "a[sdHref]", never, { "url": { "alias": "sdHref"; "required": false; }; }, {}, never, never, true, never>;
9
+ }