@simplysm/angular 14.0.4 → 14.0.5
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 +318 -0
- package/docs/commons-and-configuration.md +34 -0
- package/docs/data-display-components.md +146 -0
- package/docs/directives.md +158 -0
- package/docs/event-plugins.md +109 -0
- package/docs/form-components.md +362 -0
- package/docs/hooks-and-utilities.md +175 -0
- package/docs/layout-components.md +140 -0
- package/docs/navigation-components.md +200 -0
- package/docs/overlay-components.md +193 -0
- package/docs/pipes.md +25 -0
- package/docs/providers.md +448 -0
- package/docs/setup-functions.md +66 -0
- package/docs/visual-components.md +89 -0
- package/package.json +7 -6
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Event Plugins
|
|
2
|
+
|
|
3
|
+
All event plugins are automatically registered by `provideSdAngular`.
|
|
4
|
+
|
|
5
|
+
## `SdOptionEventPlugin`
|
|
6
|
+
|
|
7
|
+
Adds `.capture`, `.passive`, `.once` modifiers to native DOM events in Angular templates.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
@Injectable({ providedIn: null })
|
|
11
|
+
class SdOptionEventPlugin extends EventManagerPlugin {
|
|
12
|
+
supports(eventName: string): boolean;
|
|
13
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (event: Event) => void): () => void;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Usage in template:
|
|
18
|
+
```html
|
|
19
|
+
<div (click.capture)="onCapture($event)"></div>
|
|
20
|
+
<div (scroll.passive)="onScroll($event)"></div>
|
|
21
|
+
<div (click.once)="onClickOnce($event)"></div>
|
|
22
|
+
<div (click.capture.once)="onCaptureOnce($event)"></div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## `SdResizeEventPlugin`
|
|
26
|
+
|
|
27
|
+
Provides `(sdResize)` event binding via `ResizeObserver`.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
@Injectable({ providedIn: null })
|
|
31
|
+
class SdResizeEventPlugin extends EventManagerPlugin {
|
|
32
|
+
supports(eventName: string): boolean; // "sdResize"
|
|
33
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (entry: ISdResizeEvent) => void): () => void;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `ISdResizeEvent`
|
|
38
|
+
|
|
39
|
+
| Field | Type | Description |
|
|
40
|
+
|-------|------|-------------|
|
|
41
|
+
| `heightChanged` | `boolean` | Whether height changed since last event |
|
|
42
|
+
| `widthChanged` | `boolean` | Whether width changed since last event |
|
|
43
|
+
| `target` | `Element` | The observed element |
|
|
44
|
+
| `contentRect` | `DOMRectReadOnly` | Content rectangle of the element |
|
|
45
|
+
|
|
46
|
+
## `SdIntersectionEventPlugin`
|
|
47
|
+
|
|
48
|
+
Provides `(sdIntersection)` event binding via `IntersectionObserver`.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
@Injectable({ providedIn: null })
|
|
52
|
+
class SdIntersectionEventPlugin extends EventManagerPlugin {
|
|
53
|
+
supports(eventName: string): boolean; // "sdIntersection"
|
|
54
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (entry: ISdIntersectionEvent) => void): () => void;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `ISdIntersectionEvent`
|
|
59
|
+
|
|
60
|
+
| Field | Type | Description |
|
|
61
|
+
|-------|------|-------------|
|
|
62
|
+
| `entry` | `IntersectionObserverEntry` | The intersection observer entry |
|
|
63
|
+
|
|
64
|
+
## `SdSaveCommandEventPlugin`
|
|
65
|
+
|
|
66
|
+
Provides `(sdSaveCommand)` event binding that triggers on Ctrl+S. Respects modal stacking (only fires for the topmost open modal).
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
@Injectable({ providedIn: null })
|
|
70
|
+
class SdSaveCommandEventPlugin extends EventManagerPlugin {
|
|
71
|
+
supports(eventName: string): boolean; // "sdSaveCommand"
|
|
72
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (event: Event) => void): () => void;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## `SdRefreshCommandEventPlugin`
|
|
77
|
+
|
|
78
|
+
Provides `(sdRefreshCommand)` event binding that triggers on Ctrl+Alt+L. Respects modal stacking.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
@Injectable({ providedIn: null })
|
|
82
|
+
class SdRefreshCommandEventPlugin extends EventManagerPlugin {
|
|
83
|
+
supports(eventName: string): boolean; // "sdRefreshCommand"
|
|
84
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (event: Event) => void): () => void;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## `SdInsertCommandEventPlugin`
|
|
89
|
+
|
|
90
|
+
Provides `(sdInsertCommand)` event binding that triggers on Ctrl+Insert. Respects modal stacking.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
@Injectable({ providedIn: null })
|
|
94
|
+
class SdInsertCommandEventPlugin extends EventManagerPlugin {
|
|
95
|
+
supports(eventName: string): boolean; // "sdInsertCommand"
|
|
96
|
+
addEventListener(element: HTMLElement, eventName: string, handler: (event: Event) => void): () => void;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## `SdGlobalErrorHandlerPlugin`
|
|
101
|
+
|
|
102
|
+
Global error handler implementing Angular's `ErrorHandler`. Handles `PromiseRejectionEvent`, `ErrorEvent`, `Error`, and unknown errors. Displays error overlay and destroys the application on unrecoverable errors.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
@Injectable({ providedIn: null })
|
|
106
|
+
class SdGlobalErrorHandlerPlugin implements ErrorHandler {
|
|
107
|
+
handleError(event: any): false;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Form Components
|
|
2
|
+
|
|
3
|
+
## `SdButtonControl`
|
|
4
|
+
|
|
5
|
+
Themed button with ripple effect.
|
|
6
|
+
|
|
7
|
+
Selector: `sd-button`
|
|
8
|
+
|
|
9
|
+
| Input | Type | Description |
|
|
10
|
+
|-------|------|-------------|
|
|
11
|
+
| `type` | `"button" \| "submit"` | Button type (default: `"button"`) |
|
|
12
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray" \| "link" \| "link-primary" \| "link-secondary" \| "link-info" \| "link-success" \| "link-warning" \| "link-danger" \| "link-gray" \| "link-blue-gray" \| "link-rev"` | Visual theme |
|
|
13
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
14
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
15
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
16
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
17
|
+
| `buttonStyle` | `string` | Inline style for the inner button |
|
|
18
|
+
| `buttonClass` | `string` | CSS class for the inner button |
|
|
19
|
+
|
|
20
|
+
## `SdAnchorControl`
|
|
21
|
+
|
|
22
|
+
Inline clickable anchor element with theme coloring and hover underline.
|
|
23
|
+
|
|
24
|
+
Selector: `sd-anchor`
|
|
25
|
+
|
|
26
|
+
| Input | Type | Description |
|
|
27
|
+
|-------|------|-------------|
|
|
28
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
29
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray"` | Color theme (default: `"primary"`) |
|
|
30
|
+
|
|
31
|
+
## `SdAdditionalButtonControl`
|
|
32
|
+
|
|
33
|
+
Content area with adjacent action buttons (anchors or buttons projected via content).
|
|
34
|
+
|
|
35
|
+
Selector: `sd-additional-button`
|
|
36
|
+
|
|
37
|
+
| Input | Type | Description |
|
|
38
|
+
|-------|------|-------------|
|
|
39
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
40
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
41
|
+
|
|
42
|
+
## `SdModalSelectButtonControl`
|
|
43
|
+
|
|
44
|
+
Button that opens a modal for item selection. Supports single/multi mode with erase functionality.
|
|
45
|
+
|
|
46
|
+
Selector: `sd-modal-select-button`
|
|
47
|
+
|
|
48
|
+
| Input/Model | Type | Description |
|
|
49
|
+
|-------------|------|-------------|
|
|
50
|
+
| `selectMode` | `"single" \| "multi"` | Selection mode (default: `"single"`) |
|
|
51
|
+
| `value` (model) | `TSelectModeValue<any>` | Selected value(s) |
|
|
52
|
+
| `selectedItems` (model) | `Record<string, unknown>[]` | Selected item records (default: `[]`) |
|
|
53
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
54
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
55
|
+
| `modal` | `TSdSelectModalInfo<any>` | Modal info for opening selection modal |
|
|
56
|
+
| `modalOptions` | `ISdModalOptions` | Modal display options |
|
|
57
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
58
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
59
|
+
|
|
60
|
+
### `ISdSelectModal`
|
|
61
|
+
|
|
62
|
+
| Field | Type | Description |
|
|
63
|
+
|-------|------|-------------|
|
|
64
|
+
| `selectMode` | `InputSignal<"single" \| "multi">` | Selection mode input |
|
|
65
|
+
| `selectedItemKeys` | `InputSignal<T[]>` | Currently selected keys input |
|
|
66
|
+
|
|
67
|
+
Extends `ISdModal<ISelectModalOutputResult<T>>`.
|
|
68
|
+
|
|
69
|
+
### `ISelectModalOutputResult`
|
|
70
|
+
|
|
71
|
+
| Field | Type | Description |
|
|
72
|
+
|-------|------|-------------|
|
|
73
|
+
| `selectedItemKeys` | `T[]` | Selected item keys |
|
|
74
|
+
| `selectedItems` | `Record<string, unknown>[]` | Selected item records |
|
|
75
|
+
|
|
76
|
+
### `TSdSelectModalInfo`
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
type TSdSelectModalInfo<T extends ISdSelectModal<any>> = Omit<ISdModalInfo<T>, "inputs"> & {
|
|
80
|
+
inputs: Omit<TDirectiveInputSignals<T>, "initialized" | "close" | "actionTplRef" | "selectMode" | "selectedItemKeys">;
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## `SdTextfieldControl`
|
|
85
|
+
|
|
86
|
+
Text/number/date/time input field with inset/readonly/disabled modes.
|
|
87
|
+
|
|
88
|
+
Selector: `sd-textfield`
|
|
89
|
+
|
|
90
|
+
| Input/Model | Type | Description |
|
|
91
|
+
|-------------|------|-------------|
|
|
92
|
+
| `value` (model) | `TSdTextfieldTypes[K]` | Current value |
|
|
93
|
+
| `type` | `K` (required) | Input type key |
|
|
94
|
+
| `placeholder` | `string` | Placeholder text |
|
|
95
|
+
| `title` | `string` | Title attribute |
|
|
96
|
+
| `inputStyle` | `string` | Inline style for the input element |
|
|
97
|
+
| `inputClass` | `string` | CSS class for the input element |
|
|
98
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
99
|
+
| `readonly` | `boolean` (booleanAttribute) | Read-only state (default: `false`) |
|
|
100
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
101
|
+
| `min` | `TSdTextfieldTypes[K]` | Minimum value |
|
|
102
|
+
| `max` | `TSdTextfieldTypes[K]` | Maximum value |
|
|
103
|
+
| `format` | `string` | Display format pattern |
|
|
104
|
+
| `step` | `number` | Step increment |
|
|
105
|
+
| `autocomplete` | `string` | Autocomplete attribute |
|
|
106
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
107
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
108
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
109
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray"` | Background theme |
|
|
110
|
+
|
|
111
|
+
### `TSdTextfieldTypes`
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
type TSdTextfieldTypes = {
|
|
115
|
+
"number": number;
|
|
116
|
+
"text": string;
|
|
117
|
+
"password": string;
|
|
118
|
+
"color": string;
|
|
119
|
+
"email": string;
|
|
120
|
+
"format": string;
|
|
121
|
+
"date": DateOnly;
|
|
122
|
+
"month": DateOnly;
|
|
123
|
+
"year": DateOnly;
|
|
124
|
+
"datetime": DateTime;
|
|
125
|
+
"datetime-sec": DateTime;
|
|
126
|
+
"time": Time;
|
|
127
|
+
"time-sec": Time;
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `sdTextfieldTypes`
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
const sdTextfieldTypes: (keyof TSdTextfieldTypes)[];
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## `SdTextareaControl`
|
|
138
|
+
|
|
139
|
+
Multi-line text input with inset/readonly/disabled modes.
|
|
140
|
+
|
|
141
|
+
Selector: `sd-textarea`
|
|
142
|
+
|
|
143
|
+
| Input/Model | Type | Description |
|
|
144
|
+
|-------------|------|-------------|
|
|
145
|
+
| `value` (model) | `string` | Current text value |
|
|
146
|
+
| `placeholder` | `string` | Placeholder text |
|
|
147
|
+
| `title` | `string` | Title attribute |
|
|
148
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
149
|
+
| `readonly` | `boolean` (booleanAttribute) | Read-only state (default: `false`) |
|
|
150
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
151
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
152
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
153
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
154
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray"` | Background theme |
|
|
155
|
+
| `inputStyle` | `string` | Inline style for the textarea |
|
|
156
|
+
| `inputClass` | `string` | CSS class for the textarea |
|
|
157
|
+
|
|
158
|
+
## `SdNumpadControl`
|
|
159
|
+
|
|
160
|
+
On-screen numeric keypad for number input.
|
|
161
|
+
|
|
162
|
+
Selector: `sd-numpad`
|
|
163
|
+
|
|
164
|
+
| Input/Model | Type | Description |
|
|
165
|
+
|-------------|------|-------------|
|
|
166
|
+
| `value` (model) | `number` | Current numeric value |
|
|
167
|
+
| `placeholder` | `string` | Placeholder text |
|
|
168
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
169
|
+
| `inputDisabled` | `boolean` (booleanAttribute) | Disable text input (default: `false`) |
|
|
170
|
+
| `useEnterButton` | `boolean` (booleanAttribute) | Show enter button (default: `false`) |
|
|
171
|
+
| `useMinusButton` | `boolean` (booleanAttribute) | Show minus button (default: `false`) |
|
|
172
|
+
|
|
173
|
+
| Output | Type | Description |
|
|
174
|
+
|--------|------|-------------|
|
|
175
|
+
| `enterButtonClick` | `void` | Emitted when enter button is clicked |
|
|
176
|
+
|
|
177
|
+
## `SdRangeControl`
|
|
178
|
+
|
|
179
|
+
From-to range input pair using two `SdTextfieldControl` instances.
|
|
180
|
+
|
|
181
|
+
Selector: `sd-range`
|
|
182
|
+
|
|
183
|
+
| Input/Model | Type | Description |
|
|
184
|
+
|-------------|------|-------------|
|
|
185
|
+
| `type` | `K` (required) | Textfield type key |
|
|
186
|
+
| `from` (model) | `TSdTextfieldTypes[K]` | Start value |
|
|
187
|
+
| `to` (model) | `TSdTextfieldTypes[K]` | End value |
|
|
188
|
+
| `inputStyle` | `string` | Inline style for both inputs |
|
|
189
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
190
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
191
|
+
|
|
192
|
+
## `SdDateRangePicker`
|
|
193
|
+
|
|
194
|
+
Date range picker with period type selector (day/month/range).
|
|
195
|
+
|
|
196
|
+
Selector: `sd-date-range-picker`
|
|
197
|
+
|
|
198
|
+
| Input/Model | Type | Description |
|
|
199
|
+
|-------------|------|-------------|
|
|
200
|
+
| `periodType` (model) | `"day" \| "month" \| "range"` | Period type (default: `"range"`) |
|
|
201
|
+
| `from` (model) | `DateOnly` | Start date |
|
|
202
|
+
| `to` (model) | `DateOnly` | End date |
|
|
203
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
204
|
+
|
|
205
|
+
Note: Period type labels are in Korean: "일" (day), "월" (month), "범위" (range).
|
|
206
|
+
|
|
207
|
+
## `SdCheckboxControl`
|
|
208
|
+
|
|
209
|
+
Checkbox with optional radio mode, ripple effect, and model hook guard.
|
|
210
|
+
|
|
211
|
+
Selector: `sd-checkbox`
|
|
212
|
+
|
|
213
|
+
| Input/Model | Type | Description |
|
|
214
|
+
|-------------|------|-------------|
|
|
215
|
+
| `value` (model) | `boolean` | Checked state (default: `false`) |
|
|
216
|
+
| `canChangeFn` | `(item: boolean) => boolean \| Promise<boolean>` | Guard function before change (default: `() => true`) |
|
|
217
|
+
| `icon` | `string` | Check icon SVG (default: tabler check icon) |
|
|
218
|
+
| `radio` | `boolean` (booleanAttribute) | Radio mode -- can only set to true (default: `false`) |
|
|
219
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
220
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
221
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
222
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
223
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray" \| "white"` | Color theme |
|
|
224
|
+
| `contentStyle` | `string` | Inline style for content area |
|
|
225
|
+
|
|
226
|
+
## `SdSwitchControl`
|
|
227
|
+
|
|
228
|
+
Toggle switch component.
|
|
229
|
+
|
|
230
|
+
Selector: `sd-switch`
|
|
231
|
+
|
|
232
|
+
| Input/Model | Type | Description |
|
|
233
|
+
|-------------|------|-------------|
|
|
234
|
+
| `value` (model) | `boolean` | On/off state (default: `false`) |
|
|
235
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
236
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
237
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
238
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
239
|
+
| `theme` | `"primary" \| "secondary" \| "info" \| "success" \| "warning" \| "danger" \| "gray" \| "blue-gray"` | Color theme |
|
|
240
|
+
|
|
241
|
+
## `SdCheckboxGroupControl`
|
|
242
|
+
|
|
243
|
+
Group container for checkbox items. Manages a multi-select value array.
|
|
244
|
+
|
|
245
|
+
Selector: `sd-checkbox-group`
|
|
246
|
+
|
|
247
|
+
| Input/Model | Type | Description |
|
|
248
|
+
|-------------|------|-------------|
|
|
249
|
+
| `value` (model) | `T[]` | Selected values (default: `[]`) |
|
|
250
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
251
|
+
|
|
252
|
+
## `SdCheckboxGroupItemControl`
|
|
253
|
+
|
|
254
|
+
Individual item in a checkbox group. Toggles its value in the parent group's array.
|
|
255
|
+
|
|
256
|
+
Selector: `sd-checkbox-group-item`
|
|
257
|
+
|
|
258
|
+
| Input | Type | Description |
|
|
259
|
+
|-------|------|-------------|
|
|
260
|
+
| `value` | `T` (required) | Item value |
|
|
261
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
262
|
+
|
|
263
|
+
## `SdSelectControl`
|
|
264
|
+
|
|
265
|
+
Dropdown select supporting single and multi selection modes with dropdown popup.
|
|
266
|
+
|
|
267
|
+
Selector: `sd-select`
|
|
268
|
+
|
|
269
|
+
| Input/Model | Type | Description |
|
|
270
|
+
|-------------|------|-------------|
|
|
271
|
+
| `selectMode` | `"single" \| "multi"` | Selection mode (default: `"single"`) |
|
|
272
|
+
| `value` (model) | `TSelectModeValue<T>` | Selected value(s) |
|
|
273
|
+
| `placeholder` | `string` | Placeholder text |
|
|
274
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
275
|
+
| `inline` | `boolean` (booleanAttribute) | Inline display (default: `false`) |
|
|
276
|
+
| `inset` | `boolean` (booleanAttribute) | Borderless inset style (default: `false`) |
|
|
277
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
278
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
279
|
+
| `hideSelectAll` | `boolean` (booleanAttribute) | Hide select/deselect all bar in multi mode (default: `false`) |
|
|
280
|
+
| `multiSelectionDisplayDirection` | `"vertical"` | Display direction for multi selections |
|
|
281
|
+
| `items` | `T[]` | Items for itemOf template rendering |
|
|
282
|
+
| `getChildrenFn` | `(item: T) => T[] \| undefined` | Children accessor for tree items |
|
|
283
|
+
| `contentClass` | `string` | CSS class for the content area |
|
|
284
|
+
| `contentStyle` | `string` | Inline style for the content area |
|
|
285
|
+
|
|
286
|
+
### `TSelectModeValue`
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
type TSelectModeValue<T> = T | T[] | undefined;
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## `SdSelectItemControl`
|
|
293
|
+
|
|
294
|
+
Item inside `SdSelectControl`. Renders content and handles click/keyboard selection.
|
|
295
|
+
|
|
296
|
+
Selector: `sd-select-item`
|
|
297
|
+
|
|
298
|
+
| Input | Type | Description |
|
|
299
|
+
|-------|------|-------------|
|
|
300
|
+
| `value` | `T` (required) | Item value |
|
|
301
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
302
|
+
| `hidden` | `boolean` (booleanAttribute) | Hidden state (default: `false`) |
|
|
303
|
+
|
|
304
|
+
## `SdSelectButtonControl`
|
|
305
|
+
|
|
306
|
+
Additional button slot rendered inline next to the select dropdown trigger. Has ripple effect.
|
|
307
|
+
|
|
308
|
+
Selector: `sd-select-button`
|
|
309
|
+
|
|
310
|
+
No inputs.
|
|
311
|
+
|
|
312
|
+
## `SdTiptapEditorControl`
|
|
313
|
+
|
|
314
|
+
Rich text editor powered by Tiptap. Includes toolbar with formatting commands (headings, bold, italic, underline, strike, colors, lists, alignment, links, images, tables).
|
|
315
|
+
|
|
316
|
+
Selector: `sd-tiptap-editor`
|
|
317
|
+
|
|
318
|
+
| Input/Model | Type | Description |
|
|
319
|
+
|-------------|------|-------------|
|
|
320
|
+
| `value` (model) | `string` | HTML content |
|
|
321
|
+
| `disabled` | `boolean` (booleanAttribute) | Disabled state (default: `false`) |
|
|
322
|
+
| `readonly` | `boolean` (booleanAttribute) | Read-only state (default: `false`) |
|
|
323
|
+
| `required` | `boolean` (booleanAttribute) | Required validation (default: `false`) |
|
|
324
|
+
| `placeholder` | `string` | Placeholder text |
|
|
325
|
+
| `validatorFn` | `(value: string \| undefined) => string \| undefined` | Custom validation function |
|
|
326
|
+
| `extensions` | `AnyExtension[]` | Additional Tiptap extensions |
|
|
327
|
+
|
|
328
|
+
## `SdStatePresetControl`
|
|
329
|
+
|
|
330
|
+
Save and load named state presets. Persists presets via system config.
|
|
331
|
+
|
|
332
|
+
Selector: `sd-state-preset`
|
|
333
|
+
|
|
334
|
+
| Input/Model | Type | Description |
|
|
335
|
+
|-------------|------|-------------|
|
|
336
|
+
| `key` | `string` (required) | Config key for preset storage |
|
|
337
|
+
| `state` (model) | `any` | Current state to save/restore |
|
|
338
|
+
| `size` | `"sm" \| "lg"` | Size variant |
|
|
339
|
+
|
|
340
|
+
### `ISdStatePreset`
|
|
341
|
+
|
|
342
|
+
| Field | Type | Description |
|
|
343
|
+
|-------|------|-------------|
|
|
344
|
+
| `name` | `string` | Preset display name |
|
|
345
|
+
| `state` | `any` | Stored state value |
|
|
346
|
+
|
|
347
|
+
## `SdFormControl`
|
|
348
|
+
|
|
349
|
+
Form wrapper with submit handling and validation. Prevents default form submission, validates, and emits appropriate events.
|
|
350
|
+
|
|
351
|
+
Selector: `sd-form`
|
|
352
|
+
|
|
353
|
+
| Output | Type | Description |
|
|
354
|
+
|--------|------|-------------|
|
|
355
|
+
| `formSubmit` | `SubmitEvent` | Emitted on valid form submission |
|
|
356
|
+
| `formInvalid` | `void` | Emitted when form validation fails |
|
|
357
|
+
|
|
358
|
+
Public methods:
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
requestSubmit(): void; // Programmatically trigger form submission
|
|
362
|
+
```
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Hooks & Utilities
|
|
2
|
+
|
|
3
|
+
Hook functions (prefixed with `use`) must be called within Angular injection context (constructor or `runInInjectionContext`).
|
|
4
|
+
|
|
5
|
+
## `usePermsSignal`
|
|
6
|
+
|
|
7
|
+
Returns a signal of permitted keys for the given view codes. Filters `permKeys` by checking the app structure's permission record.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
function usePermsSignal<K extends string>(viewCodes: string[], keys: K[]): Signal<K[]>;
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## `useSdSystemConfigResource`
|
|
14
|
+
|
|
15
|
+
Creates a resource for reading and writing system configuration values, scoped by the host element's tag name.
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
function useSdSystemConfigResource<T>(options: {
|
|
19
|
+
key: Signal<string | undefined>;
|
|
20
|
+
}): {
|
|
21
|
+
value: Signal<T | undefined>;
|
|
22
|
+
isLoading: Signal<boolean>;
|
|
23
|
+
status: Signal<ResourceStatus>;
|
|
24
|
+
hasValue(): boolean;
|
|
25
|
+
reload(): void;
|
|
26
|
+
set(value: T | undefined): void;
|
|
27
|
+
update(fn: (prev: T | undefined) => T | undefined): void;
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## `useCurrentPageCodeSignal`
|
|
32
|
+
|
|
33
|
+
Returns a signal of the current page code derived from the activated route's URL segments (joined by `.`). Returns `undefined` if no ActivatedRoute is available.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
function useCurrentPageCodeSignal(): Signal<string> | undefined;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## `useFullPageCodeSignal`
|
|
40
|
+
|
|
41
|
+
Returns a signal of the full page code derived from the router's current URL. Updated on every `NavigationEnd`.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
function useFullPageCodeSignal(): Signal<string>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## `useViewTitleSignal`
|
|
48
|
+
|
|
49
|
+
Returns a signal of the current view's title. Uses modal title if inside a modal, otherwise derives from app structure using the page code.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
function useViewTitleSignal(): Signal<string>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## `useViewTypeSignal`
|
|
56
|
+
|
|
57
|
+
Returns a signal indicating whether the current view is displayed as a page, modal, or embedded control.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
function useViewTypeSignal(getComp: () => object): Signal<TSdViewType>;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `TSdViewType`
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
type TSdViewType = "page" | "modal" | "control";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## `useExpandingManager`
|
|
70
|
+
|
|
71
|
+
Manages tree expand/collapse state for hierarchical data. Computes flattened display items, tracks expanded items, and provides toggle/visibility methods.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
function useExpandingManager<T>(binding: {
|
|
75
|
+
items: Signal<T[]>;
|
|
76
|
+
expandedItems: WritableSignal<T[]>;
|
|
77
|
+
getChildrenFn: Signal<((item: T, index: number) => T[] | undefined) | undefined>;
|
|
78
|
+
sort: (items: T[]) => T[];
|
|
79
|
+
}): {
|
|
80
|
+
displayItems: Signal<T[]>;
|
|
81
|
+
hasExpandable: Signal<boolean>;
|
|
82
|
+
isAllExpanded: Signal<boolean>;
|
|
83
|
+
toggle(item: T): void;
|
|
84
|
+
toggleAll(): void;
|
|
85
|
+
isVisible(item: T): boolean;
|
|
86
|
+
def(item: T): IExpandItemDef<T>;
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `IExpandItemDef`
|
|
91
|
+
|
|
92
|
+
| Field | Type | Description |
|
|
93
|
+
|-------|------|-------------|
|
|
94
|
+
| `item` | `T` | The data item |
|
|
95
|
+
| `parentDef` | `IExpandItemDef<T> \| undefined` | Parent definition (for tree traversal) |
|
|
96
|
+
| `hasChildren` | `boolean` | Whether item has children |
|
|
97
|
+
| `depth` | `number` | Nesting depth (0-based) |
|
|
98
|
+
|
|
99
|
+
## `useSelectionManager`
|
|
100
|
+
|
|
101
|
+
Manages item selection state (single or multi mode). Provides select/deselect/toggle operations and computed selection state.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
function useSelectionManager<T>(options: {
|
|
105
|
+
displayItems: Signal<T[]>;
|
|
106
|
+
selectedItems: WritableSignal<T[]>;
|
|
107
|
+
selectMode: Signal<"single" | "multi" | undefined>;
|
|
108
|
+
getItemSelectableFn: Signal<((item: T) => boolean | string) | undefined>;
|
|
109
|
+
}): {
|
|
110
|
+
hasSelectable: Signal<boolean>;
|
|
111
|
+
isAllSelected: Signal<boolean>;
|
|
112
|
+
getSelectable(item: T): true | string | undefined;
|
|
113
|
+
getCanChangeFn(item: T): () => boolean;
|
|
114
|
+
select(item: T): void;
|
|
115
|
+
deselect(item: T): void;
|
|
116
|
+
toggle(item: T): void;
|
|
117
|
+
toggleAll(): void;
|
|
118
|
+
isSelected(item: T): boolean;
|
|
119
|
+
};
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## `useSortingManager`
|
|
123
|
+
|
|
124
|
+
Manages column sorting state with single and multi-column support. Toggle cycles through: ascending, descending, removed.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
function useSortingManager(options: {
|
|
128
|
+
sorts: WritableSignal<ISortingDef[]>;
|
|
129
|
+
}): {
|
|
130
|
+
defMap: Signal<Map<string, { indexText?: string; desc: boolean }>>;
|
|
131
|
+
toggle(key: string, multiple: boolean): void;
|
|
132
|
+
sort<T>(items: T[]): T[];
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `ISortingDef`
|
|
137
|
+
|
|
138
|
+
| Field | Type | Description |
|
|
139
|
+
|-------|------|-------------|
|
|
140
|
+
| `key` | `string` | Column/property key to sort by |
|
|
141
|
+
| `desc` | `boolean` | Whether sort is descending |
|
|
142
|
+
|
|
143
|
+
## `setSafeStyle`
|
|
144
|
+
|
|
145
|
+
Safely sets multiple CSS style properties on an element via Renderer2.
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
function setSafeStyle(
|
|
149
|
+
renderer: Renderer2,
|
|
150
|
+
el: HTMLElement,
|
|
151
|
+
style: Partial<CSSStyleDeclaration>,
|
|
152
|
+
): void;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## `TDirectiveInputSignals`
|
|
156
|
+
|
|
157
|
+
Utility type that extracts `InputSignal` value types from a component/directive. Non-InputSignal properties are excluded. Properties with `undefined` in their type become optional.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
type TDirectiveInputSignals<T> = TUndefToOptional<{
|
|
161
|
+
[P in keyof T as T[P] extends InputSignal<any> ? P : never]: T[P] extends InputSignal<infer V> ? V : never;
|
|
162
|
+
}>;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## `TUndefToOptional`
|
|
166
|
+
|
|
167
|
+
Utility type that converts properties containing `undefined` in their type to optional properties.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
type TUndefToOptional<T> = {
|
|
171
|
+
[K in keyof T as undefined extends T[K] ? never : K]: T[K];
|
|
172
|
+
} & {
|
|
173
|
+
[K in keyof T as undefined extends T[K] ? K : never]?: Exclude<T[K], undefined>;
|
|
174
|
+
};
|
|
175
|
+
```
|