@stonecrop/aform 0.11.9 → 0.12.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/dist/aform.d.ts +42 -7
- package/dist/aform.js +1680 -1635
- package/dist/aform.js.map +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/src/directives/mask.d.ts.map +1 -1
- package/dist/src/directives/mask.js +5 -7
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/types/index.d.ts +26 -7
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/utils/deserialize.d.ts +16 -0
- package/dist/src/utils/deserialize.d.ts.map +1 -0
- package/dist/src/utils/deserialize.js +18 -0
- package/package.json +5 -4
- package/src/components/AForm.vue +13 -10
- package/src/components/form/AFormLink.vue +7 -3
- package/src/directives/mask.ts +7 -8
- package/src/index.ts +1 -0
- package/src/types/index.ts +30 -8
- package/src/utils/deserialize.ts +18 -0
package/dist/aform.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import AFormLink from './components/form/AFormLink.vue';
|
|
|
10
10
|
import ANumericInput from './components/form/ANumericInput.vue';
|
|
11
11
|
import type { App } from 'vue';
|
|
12
12
|
import ATextInput from './components/form/ATextInput.vue';
|
|
13
|
+
import type { ColumnSchema } from '@stonecrop/schema';
|
|
13
14
|
import Login from './components/utilities/Login.vue';
|
|
14
15
|
import type { TableColumn } from '@stonecrop/atable';
|
|
15
16
|
import type { TableConfig } from '@stonecrop/atable';
|
|
@@ -83,6 +84,12 @@ export declare type BaseSchema = {
|
|
|
83
84
|
* @public
|
|
84
85
|
*/
|
|
85
86
|
mode?: FormMode;
|
|
87
|
+
/**
|
|
88
|
+
* Hide the field from the form UI while keeping it in the data model.
|
|
89
|
+
* Consumed by AForm — not passed down to field components.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
hidden?: boolean;
|
|
86
93
|
};
|
|
87
94
|
|
|
88
95
|
/**
|
|
@@ -137,6 +144,22 @@ export declare type ComponentProps = {
|
|
|
137
144
|
};
|
|
138
145
|
};
|
|
139
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Deserializes a stringified function expression into a typed callable.
|
|
149
|
+
*
|
|
150
|
+
* Throws if the string cannot be parsed as a function (SyntaxError) or if the
|
|
151
|
+
* resulting expression is not callable (TypeError), or if the expression references
|
|
152
|
+
* an undefined variable (ReferenceError). Callers are responsible for try/catch.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* const fn = deserializeFunction<(x: number) => number>('(x) => x * 2')
|
|
157
|
+
* fn(5) // 10
|
|
158
|
+
* ```
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export declare function deserializeFunction<T extends (...args: any[]) => any>(source: string): T;
|
|
162
|
+
|
|
140
163
|
/**
|
|
141
164
|
* Schema structure for defining fieldsets inside AForm
|
|
142
165
|
* @public
|
|
@@ -226,15 +249,16 @@ export { Login }
|
|
|
226
249
|
export declare type SchemaTypes = FormSchema | TableSchema | FieldsetSchema;
|
|
227
250
|
|
|
228
251
|
/**
|
|
229
|
-
* Schema structure for defining tables inside AForm
|
|
252
|
+
* Schema structure for defining tables inside AForm.
|
|
253
|
+
*
|
|
254
|
+
* Two mutually exclusive forms:
|
|
255
|
+
* - **Columns-based** (no `kind`): caller provides `columns` directly
|
|
256
|
+
* - **Schema-delegated** (`kind: 'table'`): caller provides `schema`; ATable runs
|
|
257
|
+
* `schemaToColumns` to derive columns at render time
|
|
258
|
+
*
|
|
230
259
|
* @public
|
|
231
260
|
*/
|
|
232
261
|
export declare type TableSchema = BaseSchema & {
|
|
233
|
-
/**
|
|
234
|
-
* The columns to display in the table
|
|
235
|
-
* @public
|
|
236
|
-
*/
|
|
237
|
-
columns?: TableColumn[];
|
|
238
262
|
/**
|
|
239
263
|
* The configuration for the table
|
|
240
264
|
* @public
|
|
@@ -245,7 +269,18 @@ export declare type TableSchema = BaseSchema & {
|
|
|
245
269
|
* @public
|
|
246
270
|
*/
|
|
247
271
|
rows?: TableRow[];
|
|
248
|
-
}
|
|
272
|
+
} & ({
|
|
273
|
+
/** Explicit column definitions; `schema` and `kind` must not be set */
|
|
274
|
+
columns?: TableColumn[];
|
|
275
|
+
kind?: never;
|
|
276
|
+
schema?: never;
|
|
277
|
+
} | {
|
|
278
|
+
/** Marks this entry as schema-delegated; ATable derives columns from `schema` */
|
|
279
|
+
kind: 'table';
|
|
280
|
+
/** Child schema passed to ATable's `schema` prop */
|
|
281
|
+
schema: ColumnSchema[];
|
|
282
|
+
columns?: never;
|
|
283
|
+
});
|
|
249
284
|
|
|
250
285
|
|
|
251
286
|
export * from "@stonecrop/atable/types";
|