@stonecrop/stonecrop 0.6.3 → 0.7.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.
@@ -173,7 +173,7 @@ export declare type ComponentProps = {
173
173
  * Indicate whether elements inside the component are read-only
174
174
  * @public
175
175
  */
176
- readonly?: boolean;
176
+ readOnly?: boolean;
177
177
  /**
178
178
  * Set a unique identifier for elements inside the component
179
179
  * @public
@@ -307,7 +307,7 @@ name: string;
307
307
  align?: CanvasTextAlign | undefined;
308
308
  edit?: boolean | undefined;
309
309
  label?: string | undefined;
310
- type?: string | undefined;
310
+ fieldtype?: string | undefined;
311
311
  width?: string | undefined;
312
312
  pinned?: boolean | undefined;
313
313
  resizable?: boolean | undefined;
@@ -331,7 +331,7 @@ name: string;
331
331
  align?: CanvasTextAlign | undefined;
332
332
  edit?: boolean | undefined;
333
333
  label?: string | undefined;
334
- type?: string | undefined;
334
+ fieldtype?: string | undefined;
335
335
  width?: string | undefined;
336
336
  pinned?: boolean | undefined;
337
337
  resizable?: boolean | undefined;
@@ -601,7 +601,7 @@ name: string;
601
601
  align?: CanvasTextAlign | undefined;
602
602
  edit?: boolean | undefined;
603
603
  label?: string | undefined;
604
- type?: string | undefined;
604
+ fieldtype?: string | undefined;
605
605
  width?: string | undefined;
606
606
  pinned?: boolean | undefined;
607
607
  resizable?: boolean | undefined;
@@ -625,7 +625,7 @@ name: string;
625
625
  align?: CanvasTextAlign | undefined;
626
626
  edit?: boolean | undefined;
627
627
  label?: string | undefined;
628
- type?: string | undefined;
628
+ fieldtype?: string | undefined;
629
629
  width?: string | undefined;
630
630
  pinned?: boolean | undefined;
631
631
  resizable?: boolean | undefined;
@@ -895,7 +895,7 @@ name: string;
895
895
  align?: CanvasTextAlign | undefined;
896
896
  edit?: boolean | undefined;
897
897
  label?: string | undefined;
898
- type?: string | undefined;
898
+ fieldtype?: string | undefined;
899
899
  width?: string | undefined;
900
900
  pinned?: boolean | undefined;
901
901
  resizable?: boolean | undefined;
@@ -919,7 +919,7 @@ name: string;
919
919
  align?: CanvasTextAlign | undefined;
920
920
  edit?: boolean | undefined;
921
921
  label?: string | undefined;
922
- type?: string | undefined;
922
+ fieldtype?: string | undefined;
923
923
  width?: string | undefined;
924
924
  pinned?: boolean | undefined;
925
925
  resizable?: boolean | undefined;
@@ -1185,6 +1185,15 @@ updateGanttBar: (event: GanttDragEvent) => void;
1185
1185
  updateRows: (newRows: TableRow[]) => void;
1186
1186
  }, "clearFilter" | "closeModal" | "createConnection" | "deleteConnection" | "getCellData" | "getCellDisplayValue" | "getConnectionsForBar" | "getFormattedValue" | "getHandlesForBar" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "isRowGantt" | "isRowVisible" | "registerConnectionHandle" | "registerGanttBar" | "resizeColumn" | "setCellData" | "setCellText" | "setFilter" | "sortByColumn" | "toggleRowExpand" | "unregisterConnectionHandle" | "unregisterGanttBar" | "updateGanttBar" | "updateRows">>;
1187
1187
 
1188
+ /**
1189
+ * Creates a validator with the given registry
1190
+ * @param registry - Registry instance
1191
+ * @param options - Additional validator options
1192
+ * @returns SchemaValidator instance
1193
+ * @public
1194
+ */
1195
+ export declare function createValidator(registry: Registry, options?: Partial<ValidatorOptions>): SchemaValidator;
1196
+
1188
1197
  /**
1189
1198
  * Cross-tab message payload
1190
1199
  * @public
@@ -2161,6 +2170,48 @@ export declare type Schema = {
2161
2170
  */
2162
2171
  export declare type SchemaTypes = FormSchema | TableSchema | FieldsetSchema;
2163
2172
 
2173
+ /**
2174
+ * Schema validator class
2175
+ * @public
2176
+ */
2177
+ export declare class SchemaValidator {
2178
+ private options;
2179
+ /**
2180
+ * Creates a new SchemaValidator instance
2181
+ * @param options - Validator configuration options
2182
+ */
2183
+ constructor(options?: ValidatorOptions);
2184
+ /**
2185
+ * Validates a complete doctype schema
2186
+ * @param doctype - Doctype name
2187
+ * @param schema - Schema fields (List or Array)
2188
+ * @param workflow - Optional workflow configuration
2189
+ * @param actions - Optional actions map
2190
+ * @returns Validation result
2191
+ */
2192
+ validate(doctype: string, schema: List<SchemaTypes> | SchemaTypes[] | undefined, workflow?: AnyStateNodeConfig, actions?: Map_2<string, string[]> | Map<string, string[]>): ValidationResult;
2193
+ /**
2194
+ * Validates that required schema properties are present
2195
+ * @internal
2196
+ */
2197
+ private validateRequiredProperties;
2198
+ /**
2199
+ * Validates Link field targets exist in registry
2200
+ * @internal
2201
+ */
2202
+ private validateLinkFields;
2203
+ /**
2204
+ * Validates workflow state machine configuration
2205
+ * @internal
2206
+ */
2207
+ private validateWorkflow;
2208
+ /**
2209
+ * Validates that actions are registered in the FieldTriggerEngine
2210
+ * @internal
2211
+ */
2212
+ private validateActionRegistration;
2213
+ }
2214
+
2164
2215
  /**
2165
2216
  * Configure rollback behavior for a specific field trigger
2166
2217
  * @param doctype - The doctype name
@@ -2570,15 +2621,12 @@ export declare interface TableColumn {
2570
2621
  */
2571
2622
  label?: string;
2572
2623
  /**
2573
- * The data-type of the column. Possible values:
2574
- * - `Data` - the column contains text data
2575
- * - `Select` - the column contains a select input
2576
- * - `Date` - the column contains a date input
2577
- * - `component` - the column contains a custom component
2624
+ * The semantic field type of the column. Uses the same StonecropFieldType enum as forms.
2625
+ * Common values: 'Data', 'Text', 'Int', 'Float', 'Date', 'Select', 'Link', 'Check', etc.
2578
2626
  *
2579
- * @beta
2627
+ * @public
2580
2628
  */
2581
- type?: string;
2629
+ fieldtype?: string;
2582
2630
  /**
2583
2631
  * The width of the column. This can be a number (in pixels) or a string (in CSS units).
2584
2632
  *
@@ -3441,6 +3489,84 @@ export declare function useStonecrop(options: {
3441
3489
  */
3442
3490
  export declare function useUndoRedoShortcuts(hstStore: HSTNode, enabled?: boolean): void;
3443
3491
 
3492
+ /**
3493
+ * Quick validation helper
3494
+ * @param doctype - Doctype name
3495
+ * @param schema - Schema fields
3496
+ * @param registry - Registry instance
3497
+ * @param workflow - Optional workflow configuration
3498
+ * @param actions - Optional actions map
3499
+ * @returns Validation result
3500
+ * @public
3501
+ */
3502
+ export declare function validateSchema(doctype: string, schema: List<SchemaTypes> | SchemaTypes[] | undefined, registry: Registry, workflow?: AnyStateNodeConfig, actions?: Map_2<string, string[]> | Map<string, string[]>): ValidationResult;
3503
+
3504
+ /**
3505
+ * Validation issue
3506
+ * @public
3507
+ */
3508
+ export declare interface ValidationIssue {
3509
+ /** Severity level */
3510
+ severity: ValidationSeverity;
3511
+ /** Validation rule that failed */
3512
+ rule: string;
3513
+ /** Human-readable message */
3514
+ message: string;
3515
+ /** Doctype name */
3516
+ doctype?: string;
3517
+ /** Field name if applicable */
3518
+ fieldname?: string;
3519
+ /** Additional context */
3520
+ context?: Record<string, unknown>;
3521
+ }
3522
+
3523
+ /**
3524
+ * Validation result
3525
+ * @public
3526
+ */
3527
+ export declare interface ValidationResult {
3528
+ /** Whether validation passed (no blocking errors) */
3529
+ valid: boolean;
3530
+ /** List of validation issues */
3531
+ issues: ValidationIssue[];
3532
+ /** Count of errors */
3533
+ errorCount: number;
3534
+ /** Count of warnings */
3535
+ warningCount: number;
3536
+ /** Count of info messages */
3537
+ infoCount: number;
3538
+ }
3539
+
3540
+ /**
3541
+ * Validation severity levels
3542
+ * @public
3543
+ */
3544
+ export declare enum ValidationSeverity {
3545
+ /** Blocking error that prevents save */
3546
+ ERROR = "error",
3547
+ /** Advisory warning that allows save */
3548
+ WARNING = "warning",
3549
+ /** Informational message */
3550
+ INFO = "info"
3551
+ }
3552
+
3553
+ /**
3554
+ * Schema validator options
3555
+ * @public
3556
+ */
3557
+ export declare interface ValidatorOptions {
3558
+ /** Registry instance for doctype lookups */
3559
+ registry?: Registry;
3560
+ /** Whether to validate Link field targets */
3561
+ validateLinkTargets?: boolean;
3562
+ /** Whether to validate workflow reachability */
3563
+ validateWorkflows?: boolean;
3564
+ /** Whether to validate action registration */
3565
+ validateActions?: boolean;
3566
+ /** Whether to validate required schema properties */
3567
+ validateRequiredProperties?: boolean;
3568
+ }
3569
+
3444
3570
  /**
3445
3571
  * Batch operation helper
3446
3572
  * Wraps a function execution in a batch operation