@flowgram.ai/form-core 0.2.16 → 0.2.18

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/index.d.mts CHANGED
@@ -6,6 +6,11 @@ import { ContainerModule } from 'inversify';
6
6
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
7
7
  import { Emitter, MaybePromise, Event, DisposableCollection } from '@flowgram.ai/utils';
8
8
 
9
+ /**
10
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
11
+ * SPDX-License-Identifier: MIT
12
+ */
13
+
9
14
  interface ErrorData {
10
15
  error: Error | null;
11
16
  }
@@ -16,16 +21,36 @@ declare class FlowNodeErrorData extends EntityData {
16
21
  getError(): Error;
17
22
  }
18
23
 
24
+ /**
25
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
26
+ * SPDX-License-Identifier: MIT
27
+ */
28
+
19
29
  interface NodeErrorRenderProps {
20
30
  error: Error;
21
31
  context: NodeContext;
22
32
  }
23
33
  type NodeErrorRender = Render<NodeErrorRenderProps>;
24
34
 
35
+ /**
36
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
37
+ * SPDX-License-Identifier: MIT
38
+ */
39
+
25
40
  declare const ErrorContainerModule: ContainerModule;
26
41
 
42
+ /**
43
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
44
+ * SPDX-License-Identifier: MIT
45
+ */
46
+
27
47
  declare function getNodeError(node: FlowNodeEntity): Error;
28
48
 
49
+ /**
50
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
51
+ * SPDX-License-Identifier: MIT
52
+ */
53
+
29
54
  interface NodeContext {
30
55
  node: FlowNodeEntity;
31
56
  playgroundContext: PlaygroundContext;
@@ -39,6 +64,11 @@ interface NodeRenderProps {
39
64
  }
40
65
  type NodeRenderHoc = (Component: React.JSXElementConstructor<NodeRenderProps>) => React.JSXElementConstructor<NodeRenderProps>;
41
66
 
67
+ /**
68
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
69
+ * SPDX-License-Identifier: MIT
70
+ */
71
+
42
72
  declare enum MaterialRenderKey {
43
73
  CustomNodeError = "Material_CustomNodeError"
44
74
  }
@@ -58,18 +88,36 @@ declare class NodeManager {
58
88
  protected init(): void;
59
89
  }
60
90
 
91
+ /**
92
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
93
+ * SPDX-License-Identifier: MIT
94
+ */
95
+
61
96
  declare const NodeContribution: unique symbol;
62
97
  interface NodeContribution {
63
98
  onRegister?(nodeManager: NodeManager): void;
64
99
  }
65
100
 
101
+ /**
102
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
103
+ * SPDX-License-Identifier: MIT
104
+ */
105
+
66
106
  declare const NodeContainerModule: ContainerModule;
67
107
 
108
+ /**
109
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
110
+ * SPDX-License-Identifier: MIT
111
+ */
68
112
  declare const PLUGIN_KEY: {
69
113
  FORM: string;
70
114
  ERROR: string;
71
115
  };
72
116
 
117
+ /**
118
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
119
+ * SPDX-License-Identifier: MIT
120
+ */
73
121
  declare const MATERIAL_KEY: {
74
122
  NODE_ERROR_RENDER: string;
75
123
  NODE_PLACEHOLDER_RENDER: string;
@@ -98,13 +146,27 @@ declare class NodeEngineContext {
98
146
  private updateJSON;
99
147
  }
100
148
 
149
+ /**
150
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
151
+ * SPDX-License-Identifier: MIT
152
+ */
153
+
101
154
  declare class NodeEngine {
102
155
  nodeManager: NodeManager;
103
156
  context: NodeEngineContext;
104
157
  }
105
158
 
159
+ /**
160
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
161
+ * SPDX-License-Identifier: MIT
162
+ */
163
+
106
164
  declare const FormCoreContainerModule: ContainerModule;
107
165
 
166
+ /**
167
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
168
+ * SPDX-License-Identifier: MIT
169
+ */
108
170
  interface FormItemAbility {
109
171
  type: string;
110
172
  /**
@@ -117,6 +179,10 @@ interface AbilityClass {
117
179
  new (): FormItemAbility;
118
180
  }
119
181
 
182
+ /**
183
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
184
+ * SPDX-License-Identifier: MIT
185
+ */
120
186
  interface IFormItem<T = any> {
121
187
  value: T;
122
188
  }
@@ -140,6 +206,11 @@ interface FormItemDomRef {
140
206
  current: HTMLElement | null;
141
207
  }
142
208
 
209
+ /**
210
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
211
+ * SPDX-License-Identifier: MIT
212
+ */
213
+
143
214
  interface FormItemAbilityMeta<Options = any> {
144
215
  type: string;
145
216
  options: Options;
@@ -191,6 +262,11 @@ interface FormItemHooks<T> {
191
262
  onValidate?: (params: FormItemHookParams & T) => void;
192
263
  }
193
264
 
265
+ /**
266
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
267
+ * SPDX-License-Identifier: MIT
268
+ */
269
+
194
270
  type FormDataTypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
195
271
  type FormDataType = string | number | boolean | FormDataObject | DataArray | null;
196
272
  interface FormDataObject {
@@ -248,7 +324,7 @@ interface IFormMeta {
248
324
  /**
249
325
  * 表单树结构root
250
326
  */
251
- root: IFormItemMeta;
327
+ root?: IFormItemMeta;
252
328
  /**
253
329
  * 表单全局配置
254
330
  */
@@ -271,6 +347,11 @@ interface FormMetaGeneratorParams<PlaygroundContext, FormValue = any> {
271
347
  type FormMetaGenerator<PlaygroundContext = any, FormValue = any> = (params: FormMetaGeneratorParams<FormValue, FormValue>) => MaybePromise<IFormMeta>;
272
348
  type FormMetaOrFormMetaGenerator = FormMetaGenerator | IFormMeta;
273
349
 
350
+ /**
351
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
352
+ * SPDX-License-Identifier: MIT
353
+ */
354
+
274
355
  type FormModelFactory = (entity: FlowNodeEntity) => FormModel;
275
356
  declare const FormModelFactory: unique symbol;
276
357
  declare const FormModelEntity: unique symbol;
@@ -289,7 +370,7 @@ declare abstract class FormModel {
289
370
  * @deprecated
290
371
  */
291
372
  abstract get formManager(): FormManager;
292
- abstract get formMeta(): IFormMeta;
373
+ abstract get formMeta(): any;
293
374
  abstract get initialized(): boolean;
294
375
  abstract get valid(): FormModelValid;
295
376
  abstract updateFormValues(value: any): void;
@@ -339,6 +420,11 @@ declare abstract class FormItem {
339
420
  dispose(): void;
340
421
  }
341
422
 
423
+ /**
424
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
425
+ * SPDX-License-Identifier: MIT
426
+ */
427
+
342
428
  interface FormMetaTraverseParams {
343
429
  formItemMeta: IFormItemMeta;
344
430
  parentPath?: string;
@@ -356,6 +442,10 @@ declare class FormMeta implements IFormMeta {
356
442
  static traverse({ formItemMeta, parentPath, handle }: FormMetaTraverseParams): void;
357
443
  }
358
444
 
445
+ /**
446
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
447
+ * SPDX-License-Identifier: MIT
448
+ */
359
449
  interface Extension {
360
450
  key: string;
361
451
  }
@@ -367,6 +457,11 @@ declare class FormAbilityExtensionRegistry {
367
457
  get collection(): Extension[];
368
458
  }
369
459
 
460
+ /**
461
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
462
+ * SPDX-License-Identifier: MIT
463
+ */
464
+
370
465
  interface FormItemMaterialContext {
371
466
  /**
372
467
  * 当前表单项的meta
@@ -407,16 +502,31 @@ interface FormItemMaterialContext {
407
502
  index?: number | undefined;
408
503
  }
409
504
 
505
+ /**
506
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
507
+ * SPDX-License-Identifier: MIT
508
+ */
509
+
410
510
  declare class SetterAbility implements FormItemAbility {
411
511
  static readonly type = "setter";
412
512
  get type(): string;
413
513
  }
414
514
 
515
+ /**
516
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
517
+ * SPDX-License-Identifier: MIT
518
+ */
519
+
415
520
  declare class ValidationAbility implements FormItemAbility {
416
521
  static readonly type = "validation";
417
522
  get type(): string;
418
523
  }
419
524
 
525
+ /**
526
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
527
+ * SPDX-License-Identifier: MIT
528
+ */
529
+
420
530
  interface IValidateResult {
421
531
  type: 'error' | 'warning';
422
532
  message: string;
@@ -443,6 +553,11 @@ interface ValidationExtension {
443
553
  validator: ValidatorFunction;
444
554
  }
445
555
 
556
+ /**
557
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
558
+ * SPDX-License-Identifier: MIT
559
+ */
560
+
446
561
  interface SetterAbilityOptions {
447
562
  /**
448
563
  * 已注册的setter的唯一标识
@@ -474,11 +589,21 @@ interface SetterExtension {
474
589
  }
475
590
  type SetterHoc = (Component: React.JSXElementConstructor<SetterComponentProps>) => React.JSXElementConstructor<SetterComponentProps>;
476
591
 
592
+ /**
593
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
594
+ * SPDX-License-Identifier: MIT
595
+ */
596
+
477
597
  declare class DecoratorAbility implements FormItemAbility {
478
598
  static readonly type = "decorator";
479
599
  get type(): string;
480
600
  }
481
601
 
602
+ /**
603
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
604
+ * SPDX-License-Identifier: MIT
605
+ */
606
+
482
607
  interface DecoratorAbilityOptions {
483
608
  /**
484
609
  * 已注册的decorator的唯一标识
@@ -496,6 +621,11 @@ interface DecoratorExtension {
496
621
  component: (props: DecoratorComponentProps) => any;
497
622
  }
498
623
 
624
+ /**
625
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
626
+ * SPDX-License-Identifier: MIT
627
+ */
628
+
499
629
  interface VisibilityAbilityOptions {
500
630
  /**
501
631
  * 是否隐藏
@@ -511,11 +641,21 @@ declare class VisibilityAbility implements FormItemAbility {
511
641
  get type(): string;
512
642
  }
513
643
 
644
+ /**
645
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
646
+ * SPDX-License-Identifier: MIT
647
+ */
648
+
514
649
  declare class EffectAbility implements FormItemAbility {
515
650
  static readonly type = "effect";
516
651
  get type(): string;
517
652
  }
518
653
 
654
+ /**
655
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
656
+ * SPDX-License-Identifier: MIT
657
+ */
658
+
519
659
  interface EffectAbilityOptions {
520
660
  /**
521
661
  * 已注册的effect 唯一标识
@@ -548,11 +688,21 @@ interface EffectExtension {
548
688
  effect: EffectFunction;
549
689
  }
550
690
 
691
+ /**
692
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
693
+ * SPDX-License-Identifier: MIT
694
+ */
695
+
551
696
  declare class DefaultAbility implements FormItemAbility {
552
697
  static readonly type = "default";
553
698
  get type(): string;
554
699
  }
555
700
 
701
+ /**
702
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
703
+ * SPDX-License-Identifier: MIT
704
+ */
705
+
556
706
  interface GetDefaultValueProps extends FormItemContext {
557
707
  options: DefaultAbilityOptions;
558
708
  context: FormItemMaterialContext;
@@ -561,6 +711,10 @@ interface DefaultAbilityOptions<T = any> {
561
711
  getDefaultValue: (params: GetDefaultValueProps) => T;
562
712
  }
563
713
 
714
+ /**
715
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
716
+ * SPDX-License-Identifier: MIT
717
+ */
564
718
  declare class FormPathService {
565
719
  static readonly ROOT = "/";
566
720
  static readonly DIVIDER = "/";
@@ -578,6 +732,11 @@ declare class FormPathService {
578
732
  simplify(path: string): string;
579
733
  }
580
734
 
735
+ /**
736
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
737
+ * SPDX-License-Identifier: MIT
738
+ */
739
+
581
740
  declare class FormContextMaker {
582
741
  readonly nodeEngineContext: NodeEngineContext;
583
742
  readonly playgroundContext: PlaygroundContext;
@@ -617,6 +776,11 @@ declare class FormManager {
617
776
  protected init(): void;
618
777
  }
619
778
 
779
+ /**
780
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
781
+ * SPDX-License-Identifier: MIT
782
+ */
783
+
620
784
  declare const FormContribution: unique symbol;
621
785
  interface FormContribution {
622
786
  onRegister?(formManager: FormManager): void;
@@ -666,22 +830,61 @@ declare class FlowNodeFormData extends EntityData {
666
830
  fireDetaiChange(detailChangeEvent: DetailChangeEvent): void;
667
831
  }
668
832
 
833
+ /**
834
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
835
+ * SPDX-License-Identifier: MIT
836
+ */
837
+
669
838
  declare function isNodeFormReady(node: FlowNodeEntity): boolean;
670
839
  declare function getFormModel(node: FlowNodeEntity): FormModel;
671
840
 
841
+ /**
842
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
843
+ * SPDX-License-Identifier: MIT
844
+ */
672
845
  declare function createNodeContainerModules(): inversify.ContainerModule[];
673
846
 
847
+ /**
848
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
849
+ * SPDX-License-Identifier: MIT
850
+ */
851
+
674
852
  declare const NodeRender: React.MemoExoticComponent<({ node }: NodeRenderProps) => React.JSX.Element>;
675
853
 
854
+ /**
855
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
856
+ * SPDX-License-Identifier: MIT
857
+ */
858
+
676
859
  declare function registerNodeErrorRender(nodeManager: NodeManager, render: Render): void;
677
860
  declare function registerNodePlaceholderRender(nodeManager: NodeManager, render: NodePlaceholderRender): void;
678
861
 
862
+ /**
863
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
864
+ * SPDX-License-Identifier: MIT
865
+ */
866
+
679
867
  declare function createNodeEntityDatas(): EntityDataRegistry[];
680
868
 
869
+ /**
870
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
871
+ * SPDX-License-Identifier: MIT
872
+ */
873
+
681
874
  declare function useNodeEngineContext(): NodeEngineContext;
682
875
 
876
+ /**
877
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
878
+ * SPDX-License-Identifier: MIT
879
+ */
880
+
683
881
  declare function useFormItem(path: string): IFormItem | undefined;
684
882
 
883
+ /**
884
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
885
+ * SPDX-License-Identifier: MIT
886
+ */
887
+
685
888
  declare const NodeEngineReactContext: React.Context<INodeEngineContext>;
686
889
 
687
890
  export { type AbilityClass, type DataArray, DecoratorAbility, type DecoratorAbilityOptions, type DecoratorComponentProps, type DecoratorExtension, DefaultAbility, type DefaultAbilityOptions, type DetailChangeEvent, EffectAbility, type EffectAbilityOptions, type EffectEvent, type EffectExtension, type EffectFunction, type EffectProps, ErrorContainerModule, type ErrorData, type Extension, FORM_VOID, type FeedbackStatus, type FeedbackText, FlowNodeErrorData, FlowNodeFormData, FormAbilityExtensionRegistry, FormContextMaker, FormContribution, FormCoreContainerModule, type FormDataObject, type FormDataType, type FormDataTypeName, type FormFeedback, FormItem, type FormItemAbility, type FormItemAbilityMeta, type FormItemContext, type FormItemDomRef, FormItemEventName, type FormItemFeedback, type FormItemHookParams, type FormItemHooks, type FormItemMaterialContext, FormManager, FormMeta, type FormMetaGenerator, type FormMetaGeneratorParams, type FormMetaOrFormMetaGenerator, type FormMetaTraverseParams, FormModel, FormModelEntity, FormModelFactory, type FormModelValid, FormPathService, type GetDefaultValueProps, type IFormItem, type IFormItemMeta, type IFormMeta, type IFormMetaOptions, type INodeEngineContext, type IValidateResult, MATERIAL_KEY, MaterialRenderKey, NodeContainerModule, type NodeContext, NodeContribution, NodeEngine, NodeEngineContext, NodeEngineReactContext, type NodeErrorRender, type NodeErrorRenderProps, type NodeFormContext, NodeManager, type NodePlaceholderRender, type NodePluginRender, NodeRender, type NodeRenderHoc, type NodeRenderProps, type OnFormValuesChangePayload, PLUGIN_KEY, type Render, SetterAbility, type SetterAbilityOptions, type SetterComponentProps, type SetterExtension, type SetterHoc, type SetterOrDecoratorContext, type TreeNode, ValidationAbility, type ValidationAbilityOptions, type ValidationExtension, type ValidatorFunction, type ValidatorFunctionResponse, type ValidatorProps, VisibilityAbility, type VisibilityAbilityOptions, createNodeContainerModules, createNodeEntityDatas, getFormModel, getNodeError, isNodeFormReady, registerNodeErrorRender, registerNodePlaceholderRender, useFormItem, useNodeEngineContext };