@net-advantage/nabs-ui-dynamicform 0.35.0 → 0.36.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.
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type DynamicFormPrimitiveType = "string" | "number" | "integer" | "boolean" | "object";
|
|
3
|
+
export interface DynamicFormSchemaProperty {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
default?: unknown;
|
|
7
|
+
enum?: readonly unknown[];
|
|
8
|
+
type?: DynamicFormPrimitiveType;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
format?: string;
|
|
11
|
+
properties?: Record<string, DynamicFormSchemaProperty>;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface DynamicFormSchema extends DynamicFormSchemaProperty {
|
|
15
|
+
type: "object";
|
|
16
|
+
properties?: Record<string, DynamicFormSchemaProperty>;
|
|
17
|
+
}
|
|
18
|
+
export type DynamicFormValue = Record<string, unknown>;
|
|
19
|
+
export interface DynamicFormProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "onChange"> {
|
|
20
|
+
schema?: DynamicFormSchema;
|
|
21
|
+
value?: DynamicFormValue;
|
|
22
|
+
onChange?: (value: DynamicFormValue) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type FieldMode = "textbox" | "textarea" | "radio" | "bool" | "int" | "decimal" | "double";
|
|
26
|
+
export interface FieldRendererProps {
|
|
27
|
+
schema: DynamicFormSchemaProperty;
|
|
28
|
+
name: string;
|
|
29
|
+
value: unknown;
|
|
30
|
+
onChange: (value: unknown) => void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DynamicFormSchema, DynamicFormSchemaProperty, DynamicFormValue, FieldMode } from './DynamicForm.types';
|
|
2
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
3
|
+
export declare function createInitialValue(schema: DynamicFormSchema): DynamicFormValue;
|
|
4
|
+
export declare function createDefaultValue(propertySchema: DynamicFormSchemaProperty | undefined): unknown;
|
|
5
|
+
export declare function normalizeValue(schema: DynamicFormSchemaProperty | undefined, value: unknown): unknown;
|
|
6
|
+
export declare function getFieldMode(propertySchema: DynamicFormSchemaProperty | undefined): FieldMode;
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@net-advantage/nabs-ui-dynamicform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Reusable schema-driven dynamic form for the Nabs UI library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/nabs-ui-dynamicform.cjs",
|
|
7
7
|
"module": "./dist/nabs-ui-dynamicform.js",
|
|
8
|
+
"types": "./dist/nabs-ui-dynamicform/src/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
11
|
+
"types": "./dist/nabs-ui-dynamicform/src/index.d.ts",
|
|
10
12
|
"import": "./dist/nabs-ui-dynamicform.js",
|
|
11
13
|
"require": "./dist/nabs-ui-dynamicform.cjs"
|
|
12
14
|
},
|