@solidev/data 0.10.0 → 1.0.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidev/data",
3
- "version": "0.10.0",
3
+ "version": "1.0.0-beta.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22",
6
6
  "@angular/core": "^22",
@@ -4,34 +4,89 @@ import { Toolbar, Editor } from 'ngx-editor';
4
4
  import { FormControl } from '@angular/forms';
5
5
  import { DataModel, BaseFieldManager } from '@solidev/data';
6
6
 
7
+ /**
8
+ * Named toolbar presets for {@link RicheditComponent}, selectable through its
9
+ * `toolbar` input.
10
+ *
11
+ * - `default`: the full set — marks, code and quote, lists, headings, links,
12
+ * colours and alignment.
13
+ * - `light`: a reduced set — basic marks, lists, text colour and alignment.
14
+ * - `none`: empty; the component hides the menu bar entirely for this value.
15
+ *
16
+ * A `Toolbar` can also be passed directly to the component when neither preset
17
+ * fits.
18
+ */
7
19
  declare const RichEditToolbars: {
8
20
  [index: string]: Toolbar;
9
21
  };
10
22
  declare class RicheditComponent<FT, T extends DataModel> implements OnInit, OnDestroy {
23
+ /** Model instance holding the field. */
11
24
  model?: T;
25
+ /** Name of the rich text field to edit. */
12
26
  field?: string;
27
+ /** Whether {@link toggleEdit} is allowed to enable editing. */
13
28
  editable: boolean;
29
+ /** Whether the editor is currently enabled. Defaults to true. */
14
30
  edit: boolean;
31
+ /**
32
+ * Layout, and whether {@link save} persists.
33
+ *
34
+ * `dd` renders a `<dt>`/`<dd>` block and is the only mode that saves to the
35
+ * API; `inline` and `form` render a label plus the editor and leave saving to
36
+ * the caller.
37
+ */
15
38
  mode: "dd" | "inline" | "form";
16
39
  /** Hide label (for inline forms) */
17
40
  hideLabel: boolean;
18
- /** Hide button (for changed usage) */
41
+ /**
42
+ * Hide the built-in save button, for callers driving persistence themselves
43
+ * from the {@link changed} output.
44
+ */
19
45
  hideButton: boolean;
20
- /** Form control, from outside or created */
46
+ /**
47
+ * Form control backing the editor.
48
+ *
49
+ * When supplied, the component uses it as-is and skips its own setup — no
50
+ * field manager lookup, no seeding from the model, and no {@link changed}
51
+ * emissions. When absent, one is created and wired up from `[model]` and
52
+ * `[field]`.
53
+ */
21
54
  fc: FormControl<string | null>;
22
- /** Toolbar mode */
55
+ /** Toolbar preset name from {@link RichEditToolbars}, or an explicit toolbar. */
23
56
  toolbar: "none" | "default" | "light" | Toolbar;
57
+ /** Emits the editor's HTML on every change. Only wired for an internal `fc`. */
24
58
  changed: EventEmitter<string | null>;
25
- /** Field manager */
59
+ /** Field manager for {@link field}; only resolved when `fc` is created here. */
26
60
  manager?: BaseFieldManager<FT>;
27
- /** Computed required */
61
+ /** Whether the manager declares the field required. */
28
62
  required: boolean;
63
+ /** Underlying ngx-editor instance; destroyed with the component. */
29
64
  editor: Editor;
65
+ /** Unused; kept for backwards compatibility. */
30
66
  html: string;
67
+ /** Toolbar actually rendered, resolved from {@link toolbar}. */
31
68
  realToolbar: Toolbar;
69
+ /**
70
+ * Create the editor, resolve the toolbar, and — unless a `[fc]` was given —
71
+ * build a control seeded from the model field, enabled per `[edit]`, and
72
+ * relaying changes to {@link changed}.
73
+ */
32
74
  ngOnInit(): void;
75
+ /** Destroy the ngx-editor instance to release its resources. */
33
76
  ngOnDestroy(): void;
77
+ /**
78
+ * Switch between read-only and editing by enabling or disabling the control.
79
+ * Forces read-only when `[editable]` is false.
80
+ */
34
81
  toggleEdit(): void;
82
+ /**
83
+ * Write the editor content back to the model field, and persist it in `dd`
84
+ * mode only.
85
+ *
86
+ * In `inline` / `form` modes the model is updated in memory but no request is
87
+ * sent, leaving the save to the surrounding form. Does nothing without both a
88
+ * `[model]` and a `[field]`.
89
+ */
35
90
  save(): Promise<void>;
36
91
  static ɵfac: i0.ɵɵFactoryDeclaration<RicheditComponent<any, any>, never>;
37
92
  static ɵcmp: i0.ɵɵComponentDeclaration<RicheditComponent<any, any>, "data-richedit", never, { "model": { "alias": "model"; "required": false; }; "field": { "alias": "field"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; "edit": { "alias": "edit"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "hideLabel": { "alias": "hideLabel"; "required": false; }; "hideButton": { "alias": "hideButton"; "required": false; }; "fc": { "alias": "fc"; "required": false; }; "toolbar": { "alias": "toolbar"; "required": false; }; }, { "changed": "changed"; }, never, ["*"], true, never>;