@sdcorejs/angular 21.2.14 → 21.3.0
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/README.md +7 -5
- package/assets/STYLE-GUIDE.md +6 -3
- package/assets/THEME.md +166 -0
- package/assets/fonts/fonts.scss +1 -1
- package/assets/scss/ckeditor5.scss +2 -2
- package/assets/scss/core/_inline-edit.scss +3 -3
- package/assets/scss/core/_read-state-panel.scss +2 -2
- package/assets/scss/core/color.scss +4 -2
- package/assets/scss/core/form.scss +35 -12
- package/assets/scss/core/scrollbar.scss +3 -3
- package/assets/scss/core/utilities/_base.scss +5 -5
- package/assets/scss/core/utilities/_typography.scss +22 -22
- package/assets/scss/sd-core.scss +12 -0
- package/assets/scss/themes/_component-tokens.scss +261 -0
- package/assets/scss/themes/_presets.scss +3 -0
- package/assets/scss/themes/_ramps.scss +56 -0
- package/assets/scss/themes/_scales.scss +90 -0
- package/assets/scss/themes/_semantic.scss +22 -0
- package/assets/scss/themes/default.scss +113 -10
- package/assets/scss/themes/material-theme.scss +3 -0
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +6 -6
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +34 -27
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +35 -5
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +23 -11
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-card.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +8 -4
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +12 -4
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2637 -0
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +5844 -6504
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-highlight.mjs +63 -0
- package/fesm2022/sdcorejs-angular-components-highlight.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-history.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +2088 -0
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +9 -5
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +40 -22
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +129 -7
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +33 -24
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +11 -7
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +118 -9
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +4 -4
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +308 -113
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +14 -5
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +3 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +99 -13
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +149 -6
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +19 -4
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +19 -4
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +17 -7
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +17 -7
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +3 -3
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +18 -4
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +29 -5
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +27 -2
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +498 -7
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +20 -4
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1859 -271
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-auth.mjs +35 -3
- package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +25 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +39 -48
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +196 -8
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +10 -3
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +5 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +107 -7
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +458 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +169 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs.map +1 -1
- package/package.json +18 -2
- package/types/sdcorejs-angular-components-breadcrumb.d.ts +2 -1
- package/types/sdcorejs-angular-components-button.d.ts +5 -0
- package/types/sdcorejs-angular-components-data-state.d.ts +6 -2
- package/types/sdcorejs-angular-components-file-explorer.d.ts +503 -0
- package/types/sdcorejs-angular-components-form-generic.d.ts +897 -835
- package/types/sdcorejs-angular-components-highlight.d.ts +27 -0
- package/types/sdcorejs-angular-components-image-editor.d.ts +478 -0
- package/types/sdcorejs-angular-components-inform.d.ts +5 -2
- package/types/sdcorejs-angular-components-mini-editor.d.ts +1 -1
- package/types/sdcorejs-angular-components-preview.d.ts +51 -2
- package/types/sdcorejs-angular-components-query-builder.d.ts +1 -1
- package/types/sdcorejs-angular-components-section.d.ts +5 -1
- package/types/sdcorejs-angular-components-side-drawer.d.ts +13 -2
- package/types/sdcorejs-angular-components-table.d.ts +6 -0
- package/types/sdcorejs-angular-components.d.ts +3 -0
- package/types/sdcorejs-angular-directives.d.ts +8 -0
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +19 -1
- package/types/sdcorejs-angular-forms-chip-calendar.d.ts +13 -2
- package/types/sdcorejs-angular-forms-chip.d.ts +13 -2
- package/types/sdcorejs-angular-forms-date.d.ts +7 -2
- package/types/sdcorejs-angular-forms-datetime.d.ts +7 -2
- package/types/sdcorejs-angular-forms-inline-text.d.ts +1 -1
- package/types/sdcorejs-angular-forms-input-number.d.ts +12 -2
- package/types/sdcorejs-angular-forms-input.d.ts +21 -5
- package/types/sdcorejs-angular-forms-label.d.ts +16 -1
- package/types/sdcorejs-angular-forms-models.d.ts +16 -1
- package/types/sdcorejs-angular-forms-select.d.ts +66 -4
- package/types/sdcorejs-angular-forms-textarea.d.ts +9 -2
- package/types/sdcorejs-angular-i18n.d.ts +370 -54
- package/types/sdcorejs-angular-modules-auth.d.ts +3 -3
- package/types/sdcorejs-angular-modules-icon.d.ts +11 -1
- package/types/sdcorejs-angular-modules-layout.d.ts +2 -2
- package/types/sdcorejs-angular-modules-permission.d.ts +3 -2
- package/types/sdcorejs-angular-services-api.d.ts +49 -2
- package/types/sdcorejs-angular-services-confirm.d.ts +15 -0
- package/types/sdcorejs-angular-services-notify.d.ts +8 -0
- package/types/sdcorejs-angular-utilities-extensions.d.ts +68 -1
- package/types/sdcorejs-angular-utilities-theme.d.ts +25 -0
- package/types/sdcorejs-angular-utilities.d.ts +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/** Một đoạn của text: khớp (render trong `<mark>`) hoặc không. */
|
|
4
|
+
interface SdHighlightSegment {
|
|
5
|
+
readonly text: string;
|
|
6
|
+
readonly match: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hiển thị `text` và bọc mọi đoạn khớp `term` trong `<mark>` — không phân biệt dấu (kể cả đ/Đ) và
|
|
10
|
+
* hoa-thường, dùng `sdFindHighlightRanges`.
|
|
11
|
+
*
|
|
12
|
+
* why: highlight kiểu cũ dựng HTML bằng chuỗi (`<mark>` + innerHTML) nên dữ liệu chứa markup bị parse
|
|
13
|
+
* thành phần tử thật. Ở đây mỗi đoạn là một text node của template — markup trong dữ liệu luôn hiện
|
|
14
|
+
* nguyên dạng chữ.
|
|
15
|
+
*/
|
|
16
|
+
declare class SdHighlight {
|
|
17
|
+
/** Text cần hiển thị. Số được chuyển thành chuỗi; `null`/`undefined` hiện rỗng. */
|
|
18
|
+
readonly text: _angular_core.InputSignal<string | number | null | undefined>;
|
|
19
|
+
/** Từ khoá cần tô. Trống (hoặc chỉ có khoảng trắng) thì không tô gì. */
|
|
20
|
+
readonly term: _angular_core.InputSignal<string | null | undefined>;
|
|
21
|
+
readonly segments: _angular_core.Signal<readonly SdHighlightSegment[]>;
|
|
22
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdHighlight, never>;
|
|
23
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdHighlight, "sd-highlight", never, { "text": { "alias": "text"; "required": false; "isSignal": true; }; "term": { "alias": "term"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { SdHighlight };
|
|
27
|
+
export type { SdHighlightSegment };
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { WritableSignal, Signal, ElementRef } from '@angular/core';
|
|
3
|
+
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Clockwise rotation in degrees, always a quarter turn.
|
|
7
|
+
*/
|
|
8
|
+
type SdImageEditorRotation = 0 | 90 | 180 | 270;
|
|
9
|
+
/** Width and height in whole pixels. */
|
|
10
|
+
interface SdImageEditorSize {
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Rectangle in whole pixels of the **oriented** image — the image as shown in the editor, after the EXIF
|
|
16
|
+
* orientation, the flip and the rotation. `x`/`y` is the top-left corner; the origin is the top-left of the image.
|
|
17
|
+
*/
|
|
18
|
+
interface SdImageEditorRect {
|
|
19
|
+
readonly x: number;
|
|
20
|
+
readonly y: number;
|
|
21
|
+
readonly width: number;
|
|
22
|
+
readonly height: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Orientation applied to the decoded source, in this order: mirror left ↔ right when `flip` is `true`, then rotate
|
|
26
|
+
* clockwise by `rotate` degrees.
|
|
27
|
+
*
|
|
28
|
+
* Every combination of the toolbar's rotate and flip buttons reduces to this pair. For example "flip vertically"
|
|
29
|
+
* on an unrotated image is stored as `{ flip: true, rotate: 180 }`.
|
|
30
|
+
*/
|
|
31
|
+
interface SdImageEditorOrientation {
|
|
32
|
+
readonly flip: boolean;
|
|
33
|
+
readonly rotate: SdImageEditorRotation;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Complete description of the edits, relative to the decoded source. Plain data: it is what undo/redo stores and
|
|
37
|
+
* what `SdImageEditorResult.edits` returns, so a server can replay the same transform on the original file.
|
|
38
|
+
*
|
|
39
|
+
* Replay order: decode with the EXIF orientation applied → `flip` → `rotate` → `crop` → scale to `resize`
|
|
40
|
+
* (or to the crop size when `resize` is `null`).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const edits: SdImageEditorEdits = {
|
|
45
|
+
* flip: false,
|
|
46
|
+
* rotate: 90,
|
|
47
|
+
* crop: { x: 120, y: 0, width: 1080, height: 1080 },
|
|
48
|
+
* aspectRatio: 1,
|
|
49
|
+
* resize: { width: 512, height: 512 },
|
|
50
|
+
* };
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
interface SdImageEditorEdits extends SdImageEditorOrientation {
|
|
54
|
+
/** Crop area in pixels of the oriented image. Always inside the image and at least 1 × 1. */
|
|
55
|
+
readonly crop: SdImageEditorRect;
|
|
56
|
+
/** Width / height ratio the crop is constrained to, or `null` for a free crop. */
|
|
57
|
+
readonly aspectRatio: number | null;
|
|
58
|
+
/** Output size chosen by the user, or `null` to follow the crop (see `SdImageEditorOutputOption.width`). */
|
|
59
|
+
readonly resize: SdImageEditorSize | null;
|
|
60
|
+
}
|
|
61
|
+
/** Output formats the editor can encode, when the browser supports them. */
|
|
62
|
+
type SdImageEditorFormat = 'image/jpeg' | 'image/png' | 'image/webp';
|
|
63
|
+
/**
|
|
64
|
+
* One entry of the crop ratio picker.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const square: SdImageEditorAspectRatio = { label: '1:1', value: 1 };
|
|
69
|
+
* const free: SdImageEditorAspectRatio = { label: 'Free', value: null };
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
interface SdImageEditorAspectRatio {
|
|
73
|
+
/** Text of the chip. When omitted, `null` shows the translated "Free" and a number shows the ratio. */
|
|
74
|
+
readonly label?: string;
|
|
75
|
+
/** Width / height ratio (`16 / 9`), or `null` for a free crop. */
|
|
76
|
+
readonly value: number | null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Output settings. The user can change format, quality, background and size in the panel; these values are the
|
|
80
|
+
* starting point.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const output: SdImageEditorOutputOption = {
|
|
85
|
+
* format: 'image/webp',
|
|
86
|
+
* quality: 0.85,
|
|
87
|
+
* width: 1600, // scale the crop down to at most 1600 px wide
|
|
88
|
+
* fileName: 'banner',
|
|
89
|
+
* };
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
interface SdImageEditorOutputOption {
|
|
93
|
+
/**
|
|
94
|
+
* Initial output format. Defaults to the source format; when the browser cannot encode it, PNG for images with
|
|
95
|
+
* transparency and JPEG otherwise — the panel shows the format that will be produced.
|
|
96
|
+
*/
|
|
97
|
+
format?: SdImageEditorFormat;
|
|
98
|
+
/**
|
|
99
|
+
* Formats offered in the panel, in this order. Defaults to JPEG, PNG and WebP. Formats the browser cannot
|
|
100
|
+
* encode stay visible but disabled. Pass a single format to hide the picker.
|
|
101
|
+
*/
|
|
102
|
+
formats?: readonly SdImageEditorFormat[];
|
|
103
|
+
/** Initial JPEG/WebP quality between `0` and `1`. Ignored for PNG, which is lossless. @defaultValue `0.92` */
|
|
104
|
+
quality?: number;
|
|
105
|
+
/**
|
|
106
|
+
* CSS colour painted under the image when encoding JPEG, which has no transparency. PNG and WebP keep the alpha
|
|
107
|
+
* channel. @defaultValue `'white'`
|
|
108
|
+
*/
|
|
109
|
+
background?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Default output box: while the user has not typed a size, the crop is scaled down to fit inside `width` ×
|
|
112
|
+
* `height` (either may be omitted), keeping its ratio. The user can still type another size.
|
|
113
|
+
*/
|
|
114
|
+
width?: number;
|
|
115
|
+
height?: number;
|
|
116
|
+
/** Allow an output larger than the crop. Off by default so the editor never upscales by accident. */
|
|
117
|
+
allowUpscale?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* File name without extension. The extension always follows the encoded format (`.jpg`, `.png`, `.webp`).
|
|
120
|
+
* Defaults to the source `File` name, or `image`.
|
|
121
|
+
*/
|
|
122
|
+
fileName?: string;
|
|
123
|
+
/**
|
|
124
|
+
* `'file'` returns a `File`, `'blob'` a plain `Blob`. `'auto'` (default) returns a `File` when the source is a
|
|
125
|
+
* `File`.
|
|
126
|
+
*/
|
|
127
|
+
resultType?: 'auto' | 'blob' | 'file';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Hard limits, checked before any full-resolution canvas is created.
|
|
131
|
+
*
|
|
132
|
+
* Source limits reject the image with an error. Output limits cap the size the user can pick; when the automatic
|
|
133
|
+
* size had to be reduced, the panel says so and `SdImageEditorResult.sizeLimited` is `true`.
|
|
134
|
+
*/
|
|
135
|
+
interface SdImageEditorLimits {
|
|
136
|
+
/** Largest accepted source, in bytes. @defaultValue `41_943_040` (40 MiB) */
|
|
137
|
+
maxSourceSize?: number;
|
|
138
|
+
/** Largest accepted source, in pixels (width × height). @defaultValue `40_000_000` */
|
|
139
|
+
maxSourcePixels?: number;
|
|
140
|
+
/** Largest output, in pixels. The default matches the canvas limit of iOS Safari. @defaultValue `16_777_216` */
|
|
141
|
+
maxOutputPixels?: number;
|
|
142
|
+
/** Longest output side, in pixels. @defaultValue `16_384` */
|
|
143
|
+
maxOutputSide?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Configuration of `<sd-image-editor>`. Every field is optional.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* readonly avatarOption: SdImageEditorOption = {
|
|
151
|
+
* aspectRatio: 1,
|
|
152
|
+
* lockAspectRatio: true,
|
|
153
|
+
* output: { format: 'image/jpeg', width: 512, height: 512, fileName: 'avatar' },
|
|
154
|
+
* limits: { maxSourceSize: 10 * 1024 * 1024 },
|
|
155
|
+
* };
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
interface SdImageEditorOption {
|
|
159
|
+
/** Ratio chips shown above the crop fields. Defaults to Free, 1:1, 4:3, 16:9 and 3:4. */
|
|
160
|
+
aspectRatios?: readonly SdImageEditorAspectRatio[];
|
|
161
|
+
/** Ratio selected when an image loads. `null` (default) starts with a free crop of the whole image. */
|
|
162
|
+
aspectRatio?: number | null;
|
|
163
|
+
/** Keep `aspectRatio` for the whole session and hide the ratio chips — for avatars, thumbnails, banners. */
|
|
164
|
+
lockAspectRatio?: boolean;
|
|
165
|
+
/** Output format, quality, size and file name. */
|
|
166
|
+
output?: SdImageEditorOutputOption;
|
|
167
|
+
/** Source and output limits. */
|
|
168
|
+
limits?: SdImageEditorLimits;
|
|
169
|
+
/** Number of undo steps kept. @defaultValue `50` */
|
|
170
|
+
historyLimit?: number;
|
|
171
|
+
/** E2E scope. Produces `data-autoid="components-image-editor-{autoId}"` and derived child ids. */
|
|
172
|
+
autoId?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Resolved by `SdImageEditor.getResult()`: the encoded image and what produced it.
|
|
176
|
+
*
|
|
177
|
+
* The editor never uploads, downloads or overwrites anything: send `blob` to your API yourself.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* async save(): Promise<void> {
|
|
182
|
+
* const result = await this.editor().getResult();
|
|
183
|
+
* const form = new FormData();
|
|
184
|
+
* form.append('file', result.blob, result.fileName);
|
|
185
|
+
* await firstValueFrom(this.http.post('/api/avatar', form));
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
interface SdImageEditorResult {
|
|
190
|
+
/** Encoded image. The same object as `file` when a `File` is returned. */
|
|
191
|
+
readonly blob: Blob;
|
|
192
|
+
/** `File` named `fileName`, or `null` when `resultType` resolved to a plain `Blob`. */
|
|
193
|
+
readonly file: File | null;
|
|
194
|
+
/** File name with the extension of the real encoded format. */
|
|
195
|
+
readonly fileName: string;
|
|
196
|
+
/** MIME type read back from the encoded bytes — never just the requested one. */
|
|
197
|
+
readonly mimeType: SdImageEditorFormat;
|
|
198
|
+
readonly width: number;
|
|
199
|
+
readonly height: number;
|
|
200
|
+
/** Encoded size in bytes. */
|
|
201
|
+
readonly size: number;
|
|
202
|
+
/** Quality used for JPEG/WebP; `null` for PNG. */
|
|
203
|
+
readonly quality: number | null;
|
|
204
|
+
/** Edits that produced the image, relative to the decoded source. */
|
|
205
|
+
readonly edits: SdImageEditorEdits;
|
|
206
|
+
/** `true` when the automatic output size was reduced to respect `limits`. */
|
|
207
|
+
readonly sizeLimited: boolean;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Reason of a failure: carried by `(failed)` for the source, and by the rejection of `getResult()` for the export.
|
|
211
|
+
*
|
|
212
|
+
* - `unsupported-format`: the bytes are not JPEG, PNG or WebP (for example GIF, HEIC, AVIF, SVG), whatever the
|
|
213
|
+
* declared MIME type.
|
|
214
|
+
* - `animated`: an animated PNG or WebP. Only still images are supported; the editor never drops frames silently.
|
|
215
|
+
* - `source-too-large`: the source is bigger than `limits.maxSourceSize`.
|
|
216
|
+
* - `source-too-many-pixels`: width × height is above `limits.maxSourcePixels`.
|
|
217
|
+
* - `decode-failed`: the browser could not decode the image (corrupt or truncated file).
|
|
218
|
+
* - `format-unsupported`: the browser cannot encode the chosen output format.
|
|
219
|
+
* - `render-failed`: the browser could not allocate the output canvas (too large for this device).
|
|
220
|
+
* - `encode-failed`: the browser returned no data while encoding.
|
|
221
|
+
* - `not-ready`: `getResult()` was called without a loaded image, or the image was replaced while encoding.
|
|
222
|
+
*/
|
|
223
|
+
type SdImageEditorErrorCode = 'not-ready' | 'unsupported-format' | 'animated' | 'source-too-large' | 'source-too-many-pixels' | 'decode-failed' | 'format-unsupported' | 'render-failed' | 'encode-failed';
|
|
224
|
+
/**
|
|
225
|
+
* Error emitted by `(failed)` (source) or rejected by `getResult()` (export), and shown in the editor.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* onFailed(error: SdImageEditorError): void {
|
|
230
|
+
* if (error.code === 'source-too-large') this.notify.warning(error.message);
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
interface SdImageEditorError {
|
|
235
|
+
readonly code: SdImageEditorErrorCode;
|
|
236
|
+
/** `'load'` while reading the source, `'export'` while encoding the result. */
|
|
237
|
+
readonly stage: 'load' | 'export';
|
|
238
|
+
/** Translated, user-facing message. */
|
|
239
|
+
readonly message: string;
|
|
240
|
+
/** Underlying error or detected MIME type, for logging. */
|
|
241
|
+
readonly cause?: unknown;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Lifecycle of the editor.
|
|
245
|
+
*
|
|
246
|
+
* - `empty`: no source.
|
|
247
|
+
* - `loading`: the source is being checked and decoded.
|
|
248
|
+
* - `ready`: the image can be edited.
|
|
249
|
+
* - `exporting`: `getResult()` is encoding the result; the controls are disabled.
|
|
250
|
+
* - `error`: the source could not be loaded. Export errors keep the editor `ready`.
|
|
251
|
+
*/
|
|
252
|
+
type SdImageEditorStatus = 'empty' | 'loading' | 'ready' | 'exporting' | 'error';
|
|
253
|
+
/** Facts about the loaded source, exposed through `SdImageEditor.sourceInfo`. */
|
|
254
|
+
interface SdImageEditorSourceInfo {
|
|
255
|
+
/** Format detected from the bytes. */
|
|
256
|
+
readonly mimeType: SdImageEditorFormat;
|
|
257
|
+
/** Decoded size, EXIF orientation applied. */
|
|
258
|
+
readonly width: number;
|
|
259
|
+
readonly height: number;
|
|
260
|
+
/** Source size in bytes. */
|
|
261
|
+
readonly size: number;
|
|
262
|
+
/**
|
|
263
|
+
* The image has transparent pixels: the header declares an alpha channel and the decoded pixels confirm it
|
|
264
|
+
* (checked once on the preview copy). Always `false` for JPEG.
|
|
265
|
+
*/
|
|
266
|
+
readonly hasAlpha: boolean;
|
|
267
|
+
/** EXIF orientation found in a JPEG (1 when absent). The browser applies it while decoding. */
|
|
268
|
+
readonly exifOrientation: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Edit applied from the toolbar, expressed in what the user sees on screen. */
|
|
272
|
+
type SdImageEditorOrientationOp = 'rotate-cw' | 'rotate-ccw' | 'flip-horizontal' | 'flip-vertical';
|
|
273
|
+
/** Crop handle being dragged: an edge (`n`, `e`, `s`, `w`) or a corner. */
|
|
274
|
+
type SdImageEditorCropHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
|
|
275
|
+
/** Zoom and pan of the preview. View-only: never part of the edits or the export. */
|
|
276
|
+
interface SdImageEditorView {
|
|
277
|
+
/** Zoom relative to "fit": `1` shows the whole oriented image inside the stage. */
|
|
278
|
+
readonly zoom: number;
|
|
279
|
+
/** Offset of the image centre from the stage centre, in CSS pixels. */
|
|
280
|
+
readonly panX: number;
|
|
281
|
+
readonly panY: number;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Output size and whether the limits reduced it. */
|
|
285
|
+
interface SdImageEditorOutputSize extends SdImageEditorSize {
|
|
286
|
+
readonly limited: boolean;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Gesture in progress on the stage. */
|
|
290
|
+
type SdImageEditorDragMode = 'move' | 'resize' | 'pan';
|
|
291
|
+
interface RatioChip {
|
|
292
|
+
readonly key: string;
|
|
293
|
+
readonly label: string;
|
|
294
|
+
readonly value: number | null;
|
|
295
|
+
}
|
|
296
|
+
interface FormatChoice {
|
|
297
|
+
readonly format: SdImageEditorFormat;
|
|
298
|
+
readonly label: string;
|
|
299
|
+
readonly disabled: boolean;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Inline image editor: crop (free or fixed ratio), quarter-turn rotation, flips, resize, zoom/pan, undo/redo/reset and
|
|
303
|
+
* the choice of output format and quality. It only edits: the consumer owns the Apply/Cancel buttons and asks for
|
|
304
|
+
* the result with `getResult()`, `getFile()` or `getBlob()`. It never uploads or saves anything.
|
|
305
|
+
*
|
|
306
|
+
* Works inline or inside `sd-modal` / `sd-side-drawer` without extra setup. Pass a `File` or `Blob`: images behind
|
|
307
|
+
* authentication or presigned URLs are fetched by the consumer first.
|
|
308
|
+
*
|
|
309
|
+
* Independent of `sd-upload-file` and `sd-file-explorer` (neither imports it): open it from their keys or `(open)`
|
|
310
|
+
* event, then upload the result as a new file so the original is never overwritten (see `sd-image-editor.md`).
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```html
|
|
314
|
+
* <sd-image-editor #editor [source]="file" [option]="{ aspectRatio: 1, lockAspectRatio: true, output: { width: 512 } }" />
|
|
315
|
+
* <sd-button type="fill" color="primary" title="Save" [disabled]="editor.status() !== 'ready'" (click)="save(editor)" />
|
|
316
|
+
* ```
|
|
317
|
+
* ```ts
|
|
318
|
+
* async save(editor: SdImageEditor): Promise<void> {
|
|
319
|
+
* const file = await editor.getFile(); // 512 × 512, extension matching the real format
|
|
320
|
+
* await this.api.uploadAvatar(file);
|
|
321
|
+
* }
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
declare class SdImageEditor {
|
|
325
|
+
#private;
|
|
326
|
+
/**
|
|
327
|
+
* Image to edit: a `File` or `Blob` holding a still JPEG, PNG or WebP. The editor reads it and never modifies,
|
|
328
|
+
* revokes or re-uploads it. Changing the value discards the current edits; `null` shows the empty state.
|
|
329
|
+
*/
|
|
330
|
+
readonly source: _angular_core.InputSignal<Blob | null | undefined>;
|
|
331
|
+
/** Ratios, output format/size and limits. See `SdImageEditorOption`. */
|
|
332
|
+
readonly option: _angular_core.InputSignal<SdImageEditorOption | null | undefined>;
|
|
333
|
+
/**
|
|
334
|
+
* Emitted when the source cannot be loaded (unsupported, animated, too large, corrupt…), with `stage: 'load'`. The
|
|
335
|
+
* same message is shown in the editor. Export failures reject the promise of `getResult()` instead.
|
|
336
|
+
*/
|
|
337
|
+
readonly failed: _angular_core.OutputEmitterRef<SdImageEditorError>;
|
|
338
|
+
protected readonly view: WritableSignal<SdImageEditorView>;
|
|
339
|
+
protected readonly dragging: WritableSignal<SdImageEditorDragMode | null>;
|
|
340
|
+
protected readonly format: WritableSignal<SdImageEditorFormat>;
|
|
341
|
+
protected readonly quality: WritableSignal<number>;
|
|
342
|
+
protected readonly background: WritableSignal<string>;
|
|
343
|
+
protected readonly exportError: WritableSignal<SdImageEditorError | null>;
|
|
344
|
+
/** Shown under the size fields when a typed size had to be reduced. */
|
|
345
|
+
protected readonly resizeNotice: WritableSignal<string>;
|
|
346
|
+
protected readonly stage: Signal<ElementRef<HTMLElement> | undefined>;
|
|
347
|
+
protected readonly previewCanvas: Signal<ElementRef<HTMLCanvasElement> | undefined>;
|
|
348
|
+
protected readonly cropBox: Signal<ElementRef<HTMLElement> | undefined>;
|
|
349
|
+
protected readonly instanceId: string;
|
|
350
|
+
protected readonly handles: readonly SdImageEditorCropHandle[];
|
|
351
|
+
/** Current lifecycle state. See `SdImageEditorStatus`. */
|
|
352
|
+
readonly status: Signal<SdImageEditorStatus>;
|
|
353
|
+
/** Current edits (including a drag in progress), or `null` while no image is loaded. */
|
|
354
|
+
readonly edits: Signal<SdImageEditorEdits | null>;
|
|
355
|
+
/** Facts about the loaded source, or `null`. */
|
|
356
|
+
readonly sourceInfo: Signal<SdImageEditorSourceInfo | null>;
|
|
357
|
+
/** Last load or export error, or `null`. */
|
|
358
|
+
readonly error: Signal<SdImageEditorError | null>;
|
|
359
|
+
readonly canUndo: Signal<boolean>;
|
|
360
|
+
readonly canRedo: Signal<boolean>;
|
|
361
|
+
/** The edits differ from the freshly loaded image. */
|
|
362
|
+
readonly dirty: Signal<boolean>;
|
|
363
|
+
readonly autoId: Signal<string | undefined>;
|
|
364
|
+
protected readonly interactive: Signal<boolean>;
|
|
365
|
+
protected readonly busy: Signal<boolean>;
|
|
366
|
+
protected readonly compact: Signal<boolean>;
|
|
367
|
+
protected readonly showRatios: Signal<boolean>;
|
|
368
|
+
/** "Keep ratio" is on: the crop keeps its shape while dragging, typing or rotating. */
|
|
369
|
+
protected readonly ratioLocked: Signal<boolean>;
|
|
370
|
+
/** The ratio is fixed by `option.lockAspectRatio`; the user cannot unlock it. */
|
|
371
|
+
protected readonly ratioFixed: Signal<boolean>;
|
|
372
|
+
protected readonly ratioText: Signal<string>;
|
|
373
|
+
protected readonly ratioChips: Signal<readonly RatioChip[]>;
|
|
374
|
+
protected readonly formatChoices: Signal<FormatChoice[]>;
|
|
375
|
+
protected readonly showFormatPicker: Signal<boolean>;
|
|
376
|
+
protected readonly lossy: Signal<boolean>;
|
|
377
|
+
protected readonly qualityPercent: Signal<number>;
|
|
378
|
+
protected readonly showBackground: Signal<boolean>;
|
|
379
|
+
protected readonly backgroundHex: Signal<string>;
|
|
380
|
+
protected readonly formatLabel: Signal<string>;
|
|
381
|
+
protected readonly formatUnsupported: Signal<boolean>;
|
|
382
|
+
/** CSS transform of the preview canvas: preview pixels → source pixels → oriented image → stage. */
|
|
383
|
+
protected readonly previewTransform: Signal<string>;
|
|
384
|
+
protected readonly previewSize: Signal<SdImageEditorSize>;
|
|
385
|
+
protected readonly imageBox: Signal<SdImageEditorRect | null>;
|
|
386
|
+
protected readonly cropStyle: Signal<SdImageEditorRect | null>;
|
|
387
|
+
protected readonly zoomPercent: Signal<number>;
|
|
388
|
+
protected readonly canZoomIn: Signal<boolean>;
|
|
389
|
+
protected readonly canZoomOut: Signal<boolean>;
|
|
390
|
+
protected readonly isFit: Signal<boolean>;
|
|
391
|
+
protected readonly cropLimits: Signal<{
|
|
392
|
+
maxX: number;
|
|
393
|
+
maxY: number;
|
|
394
|
+
maxWidth: number;
|
|
395
|
+
maxHeight: number;
|
|
396
|
+
} | null>;
|
|
397
|
+
protected readonly cropLabel: Signal<string>;
|
|
398
|
+
protected readonly outputSize: Signal<SdImageEditorOutputSize | null>;
|
|
399
|
+
/** Largest size the user may type for the current crop (no upscaling unless allowed). */
|
|
400
|
+
protected readonly resizeMax: Signal<SdImageEditorSize | null>;
|
|
401
|
+
protected readonly estimateLabel: Signal<string>;
|
|
402
|
+
protected readonly sourceSummary: Signal<string>;
|
|
403
|
+
protected readonly outputSummary: Signal<string>;
|
|
404
|
+
protected readonly statusMessage: Signal<string>;
|
|
405
|
+
constructor();
|
|
406
|
+
/** Steps back one edit. Zoom and pan are not part of the history. */
|
|
407
|
+
undo(): void;
|
|
408
|
+
redo(): void;
|
|
409
|
+
/** Returns to the image as loaded (no crop, rotation, flip or resize). Undoable. */
|
|
410
|
+
reset(): void;
|
|
411
|
+
/** Shows the whole image again. Does not change the edits. */
|
|
412
|
+
fitToView(): void;
|
|
413
|
+
/** Rotates by 90° as the toolbar buttons do. Undoable. */
|
|
414
|
+
rotate(direction: 'left' | 'right'): void;
|
|
415
|
+
/** Mirrors the image as shown, as the toolbar buttons do. Undoable. */
|
|
416
|
+
flip(axis: 'horizontal' | 'vertical'): void;
|
|
417
|
+
/**
|
|
418
|
+
* Encodes the current edits from the full-resolution source and resolves with the image and its facts. Reuses the
|
|
419
|
+
* encoding made for the size preview when nothing changed; concurrent calls share one encoding. While it runs,
|
|
420
|
+
* `status()` is `'exporting'` and the controls are disabled.
|
|
421
|
+
*
|
|
422
|
+
* Rejects with an `SdImageEditorError`: `not-ready` when no image is loaded (or it was replaced meanwhile), or an
|
|
423
|
+
* export code such as `format-unsupported`, `render-failed` or `encode-failed`.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* try {
|
|
428
|
+
* const result = await this.editor().getResult();
|
|
429
|
+
* await this.api.upload(result.blob, result.fileName);
|
|
430
|
+
* } catch (error) {
|
|
431
|
+
* this.notify.error((error as SdImageEditorError).message);
|
|
432
|
+
* }
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
getResult(): Promise<SdImageEditorResult>;
|
|
436
|
+
/** `getResult()` then its `blob`. */
|
|
437
|
+
getBlob(): Promise<Blob>;
|
|
438
|
+
/**
|
|
439
|
+
* `getResult()` as a `File`, whatever `output.resultType` says. `fileName` (without extension) overrides
|
|
440
|
+
* `output.fileName`; the extension always matches the encoded format.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```ts
|
|
444
|
+
* const file = await this.editor().getFile('receipt-0042'); // receipt-0042.jpg
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
getFile(fileName?: string): Promise<File>;
|
|
448
|
+
protected operate(op: SdImageEditorOrientationOp): void;
|
|
449
|
+
protected zoomIn(): void;
|
|
450
|
+
protected zoomOut(): void;
|
|
451
|
+
protected selectRatio(value: number | null): void;
|
|
452
|
+
/** Commits a crop field on blur or Enter (not per keystroke, so typing "1280" never passes through "1"). */
|
|
453
|
+
protected onCropField(field: keyof SdImageEditorRect, input: unknown, control?: SdInputNumber): void;
|
|
454
|
+
/** Output width or height, committed on blur or Enter. The other side always follows the crop ratio. */
|
|
455
|
+
protected onResizeField(field: 'width' | 'height', input: unknown, control?: SdInputNumber): void;
|
|
456
|
+
/** "Keep ratio": on locks the current crop shape, off lets the crop be dragged freely. */
|
|
457
|
+
protected toggleKeepRatio(): void;
|
|
458
|
+
/** Output follows the crop again. */
|
|
459
|
+
protected resetResize(): void;
|
|
460
|
+
protected onFormatChange(value: unknown): void;
|
|
461
|
+
protected onQualityInput(value: string): void;
|
|
462
|
+
protected onBackgroundInput(value: string): void;
|
|
463
|
+
protected sameRatio(a: number | null, b: number | null): boolean;
|
|
464
|
+
protected onCropPointerDown(event: PointerEvent, handle: SdImageEditorCropHandle | null): void;
|
|
465
|
+
protected onStagePointerDown(event: PointerEvent): void;
|
|
466
|
+
protected onPointerMove(event: PointerEvent): void;
|
|
467
|
+
protected onPointerUp(event: PointerEvent): void;
|
|
468
|
+
/** The browser took the pointer away (touch interrupted): drop the gesture instead of committing it. */
|
|
469
|
+
protected onPointerCancel(event: PointerEvent): void;
|
|
470
|
+
protected onWheel(event: WheelEvent): void;
|
|
471
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
472
|
+
protected onCropKeydown(event: KeyboardEvent): void;
|
|
473
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdImageEditor, never>;
|
|
474
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdImageEditor, "sd-image-editor", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "option": { "alias": "option"; "required": false; "isSignal": true; }; }, { "failed": "failed"; }, never, never, true, never>;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export { SdImageEditor };
|
|
478
|
+
export type { SdImageEditorAspectRatio, SdImageEditorEdits, SdImageEditorError, SdImageEditorErrorCode, SdImageEditorFormat, SdImageEditorLimits, SdImageEditorOption, SdImageEditorOrientation, SdImageEditorOutputOption, SdImageEditorRect, SdImageEditorResult, SdImageEditorRotation, SdImageEditorSize, SdImageEditorSourceInfo, SdImageEditorStatus };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { ElementRef } from '@angular/core';
|
|
3
3
|
import { Color } from '@sdcorejs/utils/models';
|
|
4
|
-
import { SdIconSet } from '@sdcorejs/angular/modules/icon';
|
|
4
|
+
import { SdIconShape, SdIconSet } from '@sdcorejs/angular/modules/icon';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Marker cho vùng action custom chiếu vào <sd-inform>.
|
|
@@ -28,6 +28,8 @@ declare class SdInform {
|
|
|
28
28
|
description: _angular_core.InputSignal<string | undefined>;
|
|
29
29
|
icon: _angular_core.InputSignal<string | undefined>;
|
|
30
30
|
hideIcon: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
31
|
+
/** Hình nền ô icon; bỏ trống thì dùng `defaultShape` của `provideSdIcon` (mặc định `square`). */
|
|
32
|
+
iconShape: _angular_core.InputSignal<SdIconShape | null | undefined>;
|
|
31
33
|
fontSet: _angular_core.InputSignalWithTransform<SdIconSet | undefined, SdIconSet | null | undefined>;
|
|
32
34
|
closable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
33
35
|
actionLabel: _angular_core.InputSignal<string | undefined>;
|
|
@@ -50,6 +52,7 @@ declare class SdInform {
|
|
|
50
52
|
'c-error': boolean;
|
|
51
53
|
}>;
|
|
52
54
|
effectiveIcon: _angular_core.Signal<string | null>;
|
|
55
|
+
resolvedIconShape: _angular_core.Signal<SdIconShape>;
|
|
53
56
|
hasActionSlot: _angular_core.Signal<boolean>;
|
|
54
57
|
clampLines: _angular_core.Signal<number | null>;
|
|
55
58
|
showToggle: _angular_core.Signal<boolean>;
|
|
@@ -61,7 +64,7 @@ declare class SdInform {
|
|
|
61
64
|
onClose(event: Event): void;
|
|
62
65
|
onAction(event: Event): void;
|
|
63
66
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdInform, never>;
|
|
64
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdInform, "sd-inform", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "primary": { "alias": "primary"; "required": false; "isSignal": true; }; "secondary": { "alias": "secondary"; "required": false; "isSignal": true; }; "info": { "alias": "info"; "required": false; "isSignal": true; }; "success": { "alias": "success"; "required": false; "isSignal": true; }; "warning": { "alias": "warning"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "hideIcon": { "alias": "hideIcon"; "required": false; "isSignal": true; }; "fontSet": { "alias": "fontSet"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "lineClamp": { "alias": "lineClamp"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "sdClosed": "sdClosed"; "sdAction": "sdAction"; }, ["actionSlot"], ["[sdInformAction]", "*"], true, never>;
|
|
67
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdInform, "sd-inform", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "primary": { "alias": "primary"; "required": false; "isSignal": true; }; "secondary": { "alias": "secondary"; "required": false; "isSignal": true; }; "info": { "alias": "info"; "required": false; "isSignal": true; }; "success": { "alias": "success"; "required": false; "isSignal": true; }; "warning": { "alias": "warning"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "hideIcon": { "alias": "hideIcon"; "required": false; "isSignal": true; }; "iconShape": { "alias": "iconShape"; "required": false; "isSignal": true; }; "fontSet": { "alias": "fontSet"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "lineClamp": { "alias": "lineClamp"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "sdClosed": "sdClosed"; "sdAction": "sdAction"; }, ["actionSlot"], ["[sdInformAction]", "*"], true, never>;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export { SdInform, SdInformActionDirective };
|
|
@@ -564,5 +564,54 @@ interface SdPdfPrintAdapter {
|
|
|
564
564
|
}
|
|
565
565
|
declare const SD_PDF_PRINT_ADAPTER: InjectionToken<SdPdfPrintAdapter>;
|
|
566
566
|
|
|
567
|
-
|
|
568
|
-
|
|
567
|
+
/** Trạng thái hiển thị của `sd-preview-video`. */
|
|
568
|
+
type SdPreviewVideoStatus = 'empty' | 'loading' | 'ready' | 'error';
|
|
569
|
+
/**
|
|
570
|
+
* Xem trước video bằng `<video>` native (có controls, không autoplay).
|
|
571
|
+
*
|
|
572
|
+
* - `source` là URL hoặc `Blob`/`File`. Blob được đổi thành object URL và thu hồi khi đổi nguồn / huỷ.
|
|
573
|
+
* - URL đi qua `sdIsSafeResourceUrl` (D-033): scheme không an toàn thì không gắn vào `<video>`, hiện lỗi.
|
|
574
|
+
* - Lỗi media hiện thông báo i18n kèm nút thử lại; định dạng không hỗ trợ có thông báo riêng.
|
|
575
|
+
* - Tải xuống qua `SdUtilities.download` (cùng guard URL).
|
|
576
|
+
*/
|
|
577
|
+
declare class SdPreviewVideo {
|
|
578
|
+
#private;
|
|
579
|
+
/** URL (http/https, tương đối, `blob:`) hoặc `Blob`/`File` của video. */
|
|
580
|
+
readonly source: _angular_core.InputSignal<string | Blob | null | undefined>;
|
|
581
|
+
/** Ảnh đại diện hiển thị trước khi phát. Chỉ nhận URL an toàn. */
|
|
582
|
+
readonly poster: _angular_core.InputSignal<string | null | undefined>;
|
|
583
|
+
/** Tên file khi tải xuống và nhãn của video cho screen reader. */
|
|
584
|
+
readonly fileName: _angular_core.InputSignal<string | null | undefined>;
|
|
585
|
+
/** Hiện nút tải xuống (mặc định `true`). */
|
|
586
|
+
readonly downloadable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
587
|
+
readonly autoIdInput: _angular_core.InputSignal<string | null | undefined>;
|
|
588
|
+
/** Phát sau khi người dùng bấm tải xuống và URL qua được guard. */
|
|
589
|
+
readonly download: _angular_core.OutputEmitterRef<{
|
|
590
|
+
fileName: string;
|
|
591
|
+
}>;
|
|
592
|
+
/** Phát khi `<video>` báo lỗi (hoặc URL bị guard từ chối). `null` khi không có `MediaError`. */
|
|
593
|
+
readonly loadError: _angular_core.OutputEmitterRef<MediaError | null>;
|
|
594
|
+
readonly autoId: _angular_core.Signal<string | undefined>;
|
|
595
|
+
readonly autoIdVideo: _angular_core.Signal<string | undefined>;
|
|
596
|
+
readonly autoIdRetry: _angular_core.Signal<string | undefined>;
|
|
597
|
+
readonly autoIdDownload: _angular_core.Signal<string | undefined>;
|
|
598
|
+
readonly autoIdError: _angular_core.Signal<string | undefined>;
|
|
599
|
+
/** URL đang gắn vào `<video>` (object URL khi nguồn là Blob). */
|
|
600
|
+
readonly src: _angular_core.Signal<string | null>;
|
|
601
|
+
readonly status: _angular_core.Signal<SdPreviewVideoStatus>;
|
|
602
|
+
readonly errorKey: _angular_core.Signal<"core.component.preview-video.unsupported" | "core.component.preview-video.error">;
|
|
603
|
+
readonly safePoster: _angular_core.Signal<string | null>;
|
|
604
|
+
readonly canDownload: _angular_core.Signal<boolean>;
|
|
605
|
+
private readonly video;
|
|
606
|
+
constructor();
|
|
607
|
+
onLoaded(): void;
|
|
608
|
+
onMediaError(): void;
|
|
609
|
+
/** Nạp lại video sau lỗi (nút "Thử lại"). */
|
|
610
|
+
retry(): void;
|
|
611
|
+
downloadFile(): void;
|
|
612
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdPreviewVideo, never>;
|
|
613
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdPreviewVideo, "sd-preview-video", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "poster": { "alias": "poster"; "required": false; "isSignal": true; }; "fileName": { "alias": "fileName"; "required": false; "isSignal": true; }; "downloadable": { "alias": "downloadable"; "required": false; "isSignal": true; }; "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "download": "download"; "loadError": "loadError"; }, never, never, true, never>;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export { SD_PDFJS_LIB, SD_PDF_BROWSER_ADAPTER, SD_PDF_PRINT_ADAPTER, SdPreviewImage, SdPreviewPdf, SdPreviewVideo };
|
|
617
|
+
export type { NormalizedImage, PdfErrorEvent, PdfErrorReason, PdfLoadEvent, PdfMeta, PdfOutlineItem, PdfScrollMode, PdfSearchResult, PdfSearchState, PdfSidebarMode, PdfSource, PdfStage, PdfZoomMode, PreviewItem, PreviewStage, PreviewTheme, SdPdfBrowserAdapter, SdPdfDestination, SdPdfDocumentProxy, SdPdfDocumentSpec, SdPdfIntersectionEntry, SdPdfJsLib, SdPdfLoadingTask, SdPdfPageProxy, SdPdfPrintAdapter, SdPdfPrintJob, SdPdfRawOutlineItem, SdPdfReference, SdPdfRenderTask, SdPdfTextContent, SdPdfTextItem, SdPdfViewport, SdPreviewVideoStatus, ThumbnailPosition };
|
|
@@ -137,7 +137,7 @@ type SdQbToday = typeof SD_QB_TODAY;
|
|
|
137
137
|
/** Date value editor mode for a date/datetime rule (derived from the rule value). */
|
|
138
138
|
type SdQbDateMode = 'absolute' | 'now' | 'relative';
|
|
139
139
|
/** Type guard — narrows a rule value to a utils `DateRelative` (offset spec). */
|
|
140
|
-
declare const sdQbIsRelativeDate: (
|
|
140
|
+
declare const sdQbIsRelativeDate: (value: unknown) => value is DateRelative;
|
|
141
141
|
/** Type guard — narrows a rule value to the `'TODAY'` sentinel ("now"/today mode). */
|
|
142
142
|
declare function sdQbIsToday(v: any): v is SdQbToday;
|
|
143
143
|
/** Starting relative value when a rule first switches to "relative" mode. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Color } from '@sdcorejs/utils/models';
|
|
3
|
+
import { SdIconShape } from '@sdcorejs/angular/modules/icon';
|
|
3
4
|
|
|
4
5
|
declare class SdSection {
|
|
5
6
|
#private;
|
|
@@ -7,9 +8,12 @@ declare class SdSection {
|
|
|
7
8
|
subTitle: _angular_core.InputSignal<string | null | undefined>;
|
|
8
9
|
icon: _angular_core.InputSignal<string | null | undefined>;
|
|
9
10
|
iconColor: _angular_core.InputSignal<Color>;
|
|
11
|
+
/** Hình nền ô icon header; bỏ trống thì dùng `defaultShape` của `provideSdIcon` (mặc định `square`). */
|
|
12
|
+
iconShape: _angular_core.InputSignal<SdIconShape | null | undefined>;
|
|
10
13
|
collapsed: _angular_core.ModelSignal<boolean>;
|
|
11
14
|
collapsible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
12
15
|
hideHeader: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
16
|
+
protected readonly resolvedIconShape: _angular_core.Signal<SdIconShape>;
|
|
13
17
|
/** Id của vùng body, để header `aria-controls` trỏ tới khi section collapsible. */
|
|
14
18
|
readonly bodyId: string;
|
|
15
19
|
constructor();
|
|
@@ -18,7 +22,7 @@ declare class SdSection {
|
|
|
18
22
|
protected onCollapseButtonClick: (event: MouseEvent) => void;
|
|
19
23
|
onHeaderKeydown: (event: KeyboardEvent) => void;
|
|
20
24
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdSection, never>;
|
|
21
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdSection, "sd-section", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "subTitle": { "alias": "subTitle"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "iconColor": { "alias": "iconColor"; "required": false; "isSignal": true; }; "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "hideHeader": { "alias": "hideHeader"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; }, never, ["[sdHeaderLeft]", "[sdHeaderRight]", "*", "[sdFooterLeft]", "[sdFooterRight]"], true, never>;
|
|
25
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdSection, "sd-section", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "subTitle": { "alias": "subTitle"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "iconColor": { "alias": "iconColor"; "required": false; "isSignal": true; }; "iconShape": { "alias": "iconShape"; "required": false; "isSignal": true; }; "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "hideHeader": { "alias": "hideHeader"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; }, never, ["[sdHeaderLeft]", "[sdHeaderRight]", "*", "[sdFooterLeft]", "[sdFooterRight]"], true, never>;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
declare class SdSectionItem {
|