@mk-kit/ui 0.41.0 → 0.43.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 +4 -4
- package/THIRD_PARTY_NOTICES.md +4 -2
- package/fesm2022/mk-kit-ui-block-editor.mjs +4 -2
- package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-checkbox.mjs +4 -2
- package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-core.mjs +218 -1
- package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-data.mjs +801 -16
- package/fesm2022/mk-kit-ui-data.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-datetime.mjs +90 -52
- package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-directives.mjs +395 -2
- package/fesm2022/mk-kit-ui-directives.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-dnd.mjs +183 -29
- package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-dynamic-form.mjs +149 -2
- package/fesm2022/mk-kit-ui-dynamic-form.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-feedback.mjs +1 -1
- package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-forms.mjs +331 -81
- package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-icon-extended.mjs +425 -0
- package/fesm2022/mk-kit-ui-icon-extended.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-icon.mjs +296 -459
- package/fesm2022/mk-kit-ui-icon.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-query-builder.mjs +1 -1
- package/fesm2022/mk-kit-ui-query-builder.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-rich-text.mjs +4 -2
- package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-table.mjs +36 -8
- package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
- package/fesm2022/mk-kit-ui.mjs +1 -0
- package/fesm2022/mk-kit-ui.mjs.map +1 -1
- package/package.json +5 -1
- package/schematics/migrate-primeng/transform.js +4 -1
- package/schematics/ng-add/index.js +30 -2
- package/schematics/ng-add/schema.json +6 -0
- package/styles/mk-kit.css +604 -0
- package/types/mk-kit-ui-block-editor.d.ts +2 -0
- package/types/mk-kit-ui-checkbox.d.ts +2 -0
- package/types/mk-kit-ui-core.d.ts +119 -2
- package/types/mk-kit-ui-data.d.ts +359 -3
- package/types/mk-kit-ui-datetime.d.ts +41 -19
- package/types/mk-kit-ui-directives.d.ts +234 -3
- package/types/mk-kit-ui-dnd.d.ts +96 -14
- package/types/mk-kit-ui-dynamic-form.d.ts +44 -1
- package/types/mk-kit-ui-forms.d.ts +160 -20
- package/types/mk-kit-ui-icon-extended.d.ts +83 -0
- package/types/mk-kit-ui-icon.d.ts +100 -17
- package/types/mk-kit-ui-rich-text.d.ts +2 -0
- package/types/mk-kit-ui-table.d.ts +38 -21
- package/types/mk-kit-ui.d.ts +1 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ValidatorFn, AbstractControl, FormGroup, FormControl, FormArray } from '@angular/forms';
|
|
2
|
+
import { Schema } from '@angular/forms/signals';
|
|
2
3
|
import * as _mk_kit_ui_core from '@mk-kit/ui/core';
|
|
3
4
|
import * as _angular_core from '@angular/core';
|
|
4
5
|
import { TemplateRef } from '@angular/core';
|
|
@@ -154,6 +155,48 @@ declare function mkDynamicFlatten(fields: readonly MkDynamicField[], prefix?: st
|
|
|
154
155
|
/** Column span a field takes in a grid of `columns`. */
|
|
155
156
|
declare function mkDynamicSpan(field: MkDynamicField, columns: number): number;
|
|
156
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Converts an `mk-dynamic-form` schema into a Signal Forms `Schema`, so the
|
|
160
|
+
* same JSON definition can drive `form()` from `@angular/forms/signals`:
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* const definition: MkDynamicSchema = { fields: [ … ] };
|
|
164
|
+
* const model = signal(mkDynamicDefaults(definition.fields));
|
|
165
|
+
* const f = form(model, mkDynamicFormToSignalSchema(definition));
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* What maps:
|
|
169
|
+
* - `required` → `required()` (for `checkbox` / `switch` this means "must be
|
|
170
|
+
* on", as Signal Forms treats `false` as empty — the `requiredTrue`
|
|
171
|
+
* behaviour of the renderer);
|
|
172
|
+
* - `validators.min` / `max` / `minLength` / `maxLength` / `pattern` / `email`
|
|
173
|
+
* (and `type: 'email'`) → the matching built-in rules, so the field's
|
|
174
|
+
* `min()` / `maxLength()` / `pattern()` state is set as well;
|
|
175
|
+
* - `validators.custom` → `validate()` running each `ValidatorFn` against a
|
|
176
|
+
* throw-away `FormControl` holding the field's value; the reactive error
|
|
177
|
+
* keys become error `kind`s with their payload attached, so
|
|
178
|
+
* `mk-form-field` renders them through the same i18n table;
|
|
179
|
+
* - `disabled: true` and `disabledWhen` → `disabled()`, `showWhen` →
|
|
180
|
+
* `hidden()` — the condition is evaluated against the form value exactly as
|
|
181
|
+
* the renderer does it (dotted paths, `and` / `or` / `not`, and inside an
|
|
182
|
+
* array item the item's own value with the root under `$root` and the
|
|
183
|
+
* position under `$index`);
|
|
184
|
+
* - `group` → the nested fields under the group's key, `array` → `applyEach`
|
|
185
|
+
* over the items plus `minItems` / `maxItems` errors from `min` / `max`.
|
|
186
|
+
*
|
|
187
|
+
* What differs from the renderer: a hidden Signal Forms field is skipped for
|
|
188
|
+
* validation and touched / dirty state but **keeps its value in the model**
|
|
189
|
+
* (the model is your data — nothing is stripped), so remove hidden controls
|
|
190
|
+
* from the template with `@if (!f.company().hidden())` and drop the value
|
|
191
|
+
* yourself before saving if it must not be sent. Layout properties (`span`,
|
|
192
|
+
* `columns`), `options`, `props` and `section` entries have no schema
|
|
193
|
+
* equivalent and are ignored.
|
|
194
|
+
*
|
|
195
|
+
* @param definition The dynamic-form schema, or just its `fields`.
|
|
196
|
+
* @template TModel The model type the schema binds to (defaults to a loose record).
|
|
197
|
+
*/
|
|
198
|
+
declare function mkDynamicFormToSignalSchema<TModel extends object = Record<string, unknown>>(definition: MkDynamicSchema | readonly MkDynamicField[]): Schema<TModel>;
|
|
199
|
+
|
|
157
200
|
/** Context handed to a custom field template. */
|
|
158
201
|
interface MkDynamicFieldContext {
|
|
159
202
|
$implicit: MkDynamicFieldBase;
|
|
@@ -301,5 +344,5 @@ declare class MkDynamicForm {
|
|
|
301
344
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkDynamicForm, "mk-dynamic-form", never, { "schema": { "alias": "schema"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "formSubmit": "formSubmit"; "invalidSubmit": "invalidSubmit"; }, ["defs"], ["*"], true, never>;
|
|
302
345
|
}
|
|
303
346
|
|
|
304
|
-
export { MkDynamicFieldDef, MkDynamicFields, MkDynamicForm, mkDynamicCondition, mkDynamicControl, mkDynamicDefaults, mkDynamicEmptyValue, mkDynamicFlatten, mkDynamicForm, mkDynamicGroup, mkDynamicSpan, mkDynamicValidators, mkIsArray, mkIsGroup, mkIsSection, mkIsValueField };
|
|
347
|
+
export { MkDynamicFieldDef, MkDynamicFields, MkDynamicForm, mkDynamicCondition, mkDynamicControl, mkDynamicDefaults, mkDynamicEmptyValue, mkDynamicFlatten, mkDynamicForm, mkDynamicFormToSignalSchema, mkDynamicGroup, mkDynamicSpan, mkDynamicValidators, mkIsArray, mkIsGroup, mkIsSection, mkIsValueField };
|
|
305
348
|
export type { MkDynamicArray, MkDynamicCondition, MkDynamicField, MkDynamicFieldBase, MkDynamicFieldContext, MkDynamicFieldType, MkDynamicGroup, MkDynamicGroup as MkDynamicGroupField, MkDynamicOption, MkDynamicSchema, MkDynamicSection, MkDynamicValidators };
|