form-builder-pro 1.3.6 → 1.3.8

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.css CHANGED
@@ -105,7 +105,7 @@
105
105
  --tw-contain-paint: ;
106
106
  --tw-contain-style: ;
107
107
  }/*
108
- ! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com
108
+ ! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
109
109
  *//*
110
110
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
111
111
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
package/dist/index.d.mts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import * as zustand_vanilla from 'zustand/vanilla';
3
3
 
4
- type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'datetime' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'binary_choice' | 'repeater' | 'file' | 'image' | 'email' | 'phone';
4
+ type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'datetime' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'binary_choice' | 'repeater' | 'file' | 'image' | 'email' | 'phone' | 'name_generator';
5
+ /** Name generator format options for name_generator field type */
6
+ type NameGeneratorFormat = 'TEXT_HYPHEN_ID' | 'TEXT_UNDERSCORE_ID' | 'TEXT_SLASH_ID' | 'TEXT_ID' | 'ID_HYPHEN_TEXT' | 'ID_UNDERSCORE_TEXT' | 'TEXT_YEAR_ID' | 'TEXT_MONTH_ID' | 'TEXT_YEAR_MONTH_ID' | 'TEXT_ACCOUNT_CODE_ID' | 'TEXT_BRANCH_ID' | 'PREFIX_TEXT_ID' | 'TEXT_ID_SUFFIX' | 'TEXT_RANDOM_4' | 'TEXT_YEAR_MONTH_DAY_ID' | 'TEXT_HYPHEN_USER_INPUT' | 'TEXT_UNDERSCORE_USER_INPUT' | 'TEXT_SLASH_USER_INPUT' | 'USER_INPUT_HYPHEN_TEXT' | 'USER_INPUT_UNDERSCORE_TEXT';
5
7
  type FieldWidth = '25%' | '33%' | '50%' | '66%' | '75%' | '100%' | number;
6
8
  declare function parseWidth(width: FieldWidth): number;
7
9
  declare function getColSpanFromWidth(width: FieldWidth): string;
@@ -62,6 +64,8 @@ interface AsyncOptionSource {
62
64
  labelKey: string;
63
65
  valueKey: string;
64
66
  }
67
+ /** Lookup (Entity Fields) — source category for optionSource LOOKUP */
68
+ type LookupSourceType = 'MODULE' | 'MASTER_TYPE' | 'SETTINGS';
65
69
  interface FormField {
66
70
  id: string;
67
71
  type: FieldType;
@@ -96,6 +100,8 @@ interface FormField {
96
100
  masterTypeName?: string;
97
101
  enabled?: boolean;
98
102
  visible?: boolean;
103
+ /** When true, host/backend may enforce uniqueness for this field’s value */
104
+ isUnique?: boolean;
99
105
  order?: number;
100
106
  css?: {
101
107
  class?: string;
@@ -105,10 +111,11 @@ interface FormField {
105
111
  multiselect?: boolean;
106
112
  multiSelect?: boolean;
107
113
  optionSource?: 'STATIC' | 'MASTER' | 'LOOKUP';
108
- lookupSourceType?: 'MODULE' | 'MASTER_TYPE';
114
+ lookupSourceType?: LookupSourceType;
109
115
  lookupSource?: string;
110
116
  lookupValueField?: string;
111
117
  lookupLabelField?: string;
118
+ lookupParentFieldName?: string | null;
112
119
  isd?: ISDConfig;
113
120
  imageUrl?: string;
114
121
  valueSource?: 'manual' | 'formula';
@@ -123,6 +130,11 @@ interface FormField {
123
130
  repeatItemLabel?: string;
124
131
  repeatIncrementEnabled?: boolean;
125
132
  dateConstraints?: DateConstraint;
133
+ nameGeneratorFormat?: NameGeneratorFormat;
134
+ nameGeneratorText?: string;
135
+ nameGeneratorPrefix?: string;
136
+ nameGeneratorSuffix?: string;
137
+ nameGeneratorIdPadding?: number;
126
138
  }
127
139
  /**
128
140
  * Conditional date constraint — evaluated at runtime against the current date or another field's value.
@@ -209,6 +221,12 @@ declare const FormSchemaValidation: z.ZodObject<{
209
221
  }[];
210
222
  }>;
211
223
 
224
+ /** Labels for Lookup Source Type (Entity Fields) — values are the API `sourceType` strings */
225
+ declare const LOOKUP_SOURCE_TYPE_OPTIONS: {
226
+ value: LookupSourceType;
227
+ label: string;
228
+ }[];
229
+
212
230
  interface MasterType {
213
231
  id: string;
214
232
  name: string;
@@ -296,6 +314,11 @@ interface FormBuilderOptions {
296
314
  }[];
297
315
  };
298
316
  moduleList?: string[];
317
+ /** Settings entity registry (sourceKey + display label) — same list the host uses for Legal Entities, Operating Units, User Groups, etc. */
318
+ settingsEntities?: {
319
+ label: string;
320
+ value: string;
321
+ }[];
299
322
  lookupFieldOptionsMap?: {
300
323
  [lookupSource: string]: string[];
301
324
  };
@@ -309,7 +332,7 @@ interface FormBuilderOptions {
309
332
  }) => void;
310
333
  onLookupSourceChange?: (event: {
311
334
  fieldId: string;
312
- lookupSourceType: 'MODULE' | 'MASTER_TYPE';
335
+ lookupSourceType: LookupSourceType;
313
336
  lookupSource: string;
314
337
  }) => void;
315
338
  onProfileClick?: () => void;
@@ -454,8 +477,17 @@ declare function getNumericFieldsForFormula(schema: FormSchema, excludeFieldId?:
454
477
  label: string;
455
478
  }[];
456
479
 
480
+ /** Reset counter (for testing or new form load) */
481
+ declare function resetNameGeneratorCounter(): void;
482
+ /**
483
+ * Generate a name based on field configuration.
484
+ * Uses format, prefix, suffix, static text, and padded ID.
485
+ * For USER_INPUT formats, uses empty string as placeholder (caller should pass userInput).
486
+ */
487
+ declare function generateName(fieldConfig: Pick<FormField, 'nameGeneratorFormat' | 'nameGeneratorText' | 'nameGeneratorPrefix' | 'nameGeneratorSuffix' | 'nameGeneratorIdPadding'>, userInput?: string): string;
488
+
457
489
  declare const initFormBuilder: (options: FormBuilderOptions & {
458
490
  containerId: string;
459
491
  }) => FormBuilder;
460
492
 
461
- export { AsyncOptionSource, DateConstraint, FieldType, FieldValidations, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ISDConfig, MasterType, ValidationObject, ValidationRule, builderToPlatform, cleanFormSchema, convertValidationObjectToArray, detectCircularDependency, evaluateFormula, formStore, getColSpanFromWidth, getNumericFieldsForFormula, getValidationConfigForAngular, initFormBuilder, parseFormulaDependencies, parseWidth, platformToBuilder, validateFormula };
493
+ export { type AsyncOptionSource, type DateConstraint, type FieldType, type FieldValidations, type FieldWidth, FormBuilder, type FormBuilderOptions, type FormField, FormRenderer, type FormSchema, FormSchemaValidation, type FormSection, type ISDConfig, LOOKUP_SOURCE_TYPE_OPTIONS, type LookupSourceType, type MasterType, type NameGeneratorFormat, type ValidationObject, type ValidationRule, builderToPlatform, cleanFormSchema, convertValidationObjectToArray, detectCircularDependency, evaluateFormula, formStore, generateName, getColSpanFromWidth, getNumericFieldsForFormula, getValidationConfigForAngular, initFormBuilder, parseFormulaDependencies, parseWidth, platformToBuilder, resetNameGeneratorCounter, validateFormula };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import * as zustand_vanilla from 'zustand/vanilla';
3
3
 
4
- type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'datetime' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'binary_choice' | 'repeater' | 'file' | 'image' | 'email' | 'phone';
4
+ type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'datetime' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'binary_choice' | 'repeater' | 'file' | 'image' | 'email' | 'phone' | 'name_generator';
5
+ /** Name generator format options for name_generator field type */
6
+ type NameGeneratorFormat = 'TEXT_HYPHEN_ID' | 'TEXT_UNDERSCORE_ID' | 'TEXT_SLASH_ID' | 'TEXT_ID' | 'ID_HYPHEN_TEXT' | 'ID_UNDERSCORE_TEXT' | 'TEXT_YEAR_ID' | 'TEXT_MONTH_ID' | 'TEXT_YEAR_MONTH_ID' | 'TEXT_ACCOUNT_CODE_ID' | 'TEXT_BRANCH_ID' | 'PREFIX_TEXT_ID' | 'TEXT_ID_SUFFIX' | 'TEXT_RANDOM_4' | 'TEXT_YEAR_MONTH_DAY_ID' | 'TEXT_HYPHEN_USER_INPUT' | 'TEXT_UNDERSCORE_USER_INPUT' | 'TEXT_SLASH_USER_INPUT' | 'USER_INPUT_HYPHEN_TEXT' | 'USER_INPUT_UNDERSCORE_TEXT';
5
7
  type FieldWidth = '25%' | '33%' | '50%' | '66%' | '75%' | '100%' | number;
6
8
  declare function parseWidth(width: FieldWidth): number;
7
9
  declare function getColSpanFromWidth(width: FieldWidth): string;
@@ -62,6 +64,8 @@ interface AsyncOptionSource {
62
64
  labelKey: string;
63
65
  valueKey: string;
64
66
  }
67
+ /** Lookup (Entity Fields) — source category for optionSource LOOKUP */
68
+ type LookupSourceType = 'MODULE' | 'MASTER_TYPE' | 'SETTINGS';
65
69
  interface FormField {
66
70
  id: string;
67
71
  type: FieldType;
@@ -96,6 +100,8 @@ interface FormField {
96
100
  masterTypeName?: string;
97
101
  enabled?: boolean;
98
102
  visible?: boolean;
103
+ /** When true, host/backend may enforce uniqueness for this field’s value */
104
+ isUnique?: boolean;
99
105
  order?: number;
100
106
  css?: {
101
107
  class?: string;
@@ -105,10 +111,11 @@ interface FormField {
105
111
  multiselect?: boolean;
106
112
  multiSelect?: boolean;
107
113
  optionSource?: 'STATIC' | 'MASTER' | 'LOOKUP';
108
- lookupSourceType?: 'MODULE' | 'MASTER_TYPE';
114
+ lookupSourceType?: LookupSourceType;
109
115
  lookupSource?: string;
110
116
  lookupValueField?: string;
111
117
  lookupLabelField?: string;
118
+ lookupParentFieldName?: string | null;
112
119
  isd?: ISDConfig;
113
120
  imageUrl?: string;
114
121
  valueSource?: 'manual' | 'formula';
@@ -123,6 +130,11 @@ interface FormField {
123
130
  repeatItemLabel?: string;
124
131
  repeatIncrementEnabled?: boolean;
125
132
  dateConstraints?: DateConstraint;
133
+ nameGeneratorFormat?: NameGeneratorFormat;
134
+ nameGeneratorText?: string;
135
+ nameGeneratorPrefix?: string;
136
+ nameGeneratorSuffix?: string;
137
+ nameGeneratorIdPadding?: number;
126
138
  }
127
139
  /**
128
140
  * Conditional date constraint — evaluated at runtime against the current date or another field's value.
@@ -209,6 +221,12 @@ declare const FormSchemaValidation: z.ZodObject<{
209
221
  }[];
210
222
  }>;
211
223
 
224
+ /** Labels for Lookup Source Type (Entity Fields) — values are the API `sourceType` strings */
225
+ declare const LOOKUP_SOURCE_TYPE_OPTIONS: {
226
+ value: LookupSourceType;
227
+ label: string;
228
+ }[];
229
+
212
230
  interface MasterType {
213
231
  id: string;
214
232
  name: string;
@@ -296,6 +314,11 @@ interface FormBuilderOptions {
296
314
  }[];
297
315
  };
298
316
  moduleList?: string[];
317
+ /** Settings entity registry (sourceKey + display label) — same list the host uses for Legal Entities, Operating Units, User Groups, etc. */
318
+ settingsEntities?: {
319
+ label: string;
320
+ value: string;
321
+ }[];
299
322
  lookupFieldOptionsMap?: {
300
323
  [lookupSource: string]: string[];
301
324
  };
@@ -309,7 +332,7 @@ interface FormBuilderOptions {
309
332
  }) => void;
310
333
  onLookupSourceChange?: (event: {
311
334
  fieldId: string;
312
- lookupSourceType: 'MODULE' | 'MASTER_TYPE';
335
+ lookupSourceType: LookupSourceType;
313
336
  lookupSource: string;
314
337
  }) => void;
315
338
  onProfileClick?: () => void;
@@ -454,8 +477,17 @@ declare function getNumericFieldsForFormula(schema: FormSchema, excludeFieldId?:
454
477
  label: string;
455
478
  }[];
456
479
 
480
+ /** Reset counter (for testing or new form load) */
481
+ declare function resetNameGeneratorCounter(): void;
482
+ /**
483
+ * Generate a name based on field configuration.
484
+ * Uses format, prefix, suffix, static text, and padded ID.
485
+ * For USER_INPUT formats, uses empty string as placeholder (caller should pass userInput).
486
+ */
487
+ declare function generateName(fieldConfig: Pick<FormField, 'nameGeneratorFormat' | 'nameGeneratorText' | 'nameGeneratorPrefix' | 'nameGeneratorSuffix' | 'nameGeneratorIdPadding'>, userInput?: string): string;
488
+
457
489
  declare const initFormBuilder: (options: FormBuilderOptions & {
458
490
  containerId: string;
459
491
  }) => FormBuilder;
460
492
 
461
- export { AsyncOptionSource, DateConstraint, FieldType, FieldValidations, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ISDConfig, MasterType, ValidationObject, ValidationRule, builderToPlatform, cleanFormSchema, convertValidationObjectToArray, detectCircularDependency, evaluateFormula, formStore, getColSpanFromWidth, getNumericFieldsForFormula, getValidationConfigForAngular, initFormBuilder, parseFormulaDependencies, parseWidth, platformToBuilder, validateFormula };
493
+ export { type AsyncOptionSource, type DateConstraint, type FieldType, type FieldValidations, type FieldWidth, FormBuilder, type FormBuilderOptions, type FormField, FormRenderer, type FormSchema, FormSchemaValidation, type FormSection, type ISDConfig, LOOKUP_SOURCE_TYPE_OPTIONS, type LookupSourceType, type MasterType, type NameGeneratorFormat, type ValidationObject, type ValidationRule, builderToPlatform, cleanFormSchema, convertValidationObjectToArray, detectCircularDependency, evaluateFormula, formStore, generateName, getColSpanFromWidth, getNumericFieldsForFormula, getValidationConfigForAngular, initFormBuilder, parseFormulaDependencies, parseWidth, platformToBuilder, resetNameGeneratorCounter, validateFormula };