form-builder-pro 1.3.5 → 1.3.7
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 +9 -1
- package/dist/index.d.mts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +779 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +778 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
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)
|
|
@@ -1435,6 +1435,9 @@ body {
|
|
|
1435
1435
|
.lowercase {
|
|
1436
1436
|
text-transform: lowercase;
|
|
1437
1437
|
}
|
|
1438
|
+
.italic {
|
|
1439
|
+
font-style: italic;
|
|
1440
|
+
}
|
|
1438
1441
|
.leading-none {
|
|
1439
1442
|
line-height: 1;
|
|
1440
1443
|
}
|
|
@@ -2006,6 +2009,11 @@ input[type="radio"]:checked::after {
|
|
|
2006
2009
|
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
2007
2010
|
}
|
|
2008
2011
|
|
|
2012
|
+
.dark\:text-gray-500:is(.dark *) {
|
|
2013
|
+
--tw-text-opacity: 1;
|
|
2014
|
+
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2009
2017
|
.dark\:text-green-400:is(.dark *) {
|
|
2010
2018
|
--tw-text-opacity: 1;
|
|
2011
2019
|
color: rgb(74 222 128 / var(--tw-text-opacity, 1));
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
3
3
|
|
|
4
|
-
type FieldType = 'text' | 'textarea' | 'number' | 'date' | '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;
|
|
8
10
|
interface ValidationRule {
|
|
9
|
-
type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'email' | 'minDate' | 'maxDate' | 'minSelected' | 'maxSelected';
|
|
11
|
+
type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'email' | 'minDate' | 'maxDate' | 'minDateTime' | 'maxDateTime' | 'minSelected' | 'maxSelected';
|
|
10
12
|
value?: string | number | boolean;
|
|
11
13
|
message?: string;
|
|
12
14
|
regex?: string;
|
|
@@ -23,6 +25,8 @@ interface ValidationObject {
|
|
|
23
25
|
maxSelected?: number;
|
|
24
26
|
minDate?: string;
|
|
25
27
|
maxDate?: string;
|
|
28
|
+
minDateTime?: string;
|
|
29
|
+
maxDateTime?: string;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Comprehensive validation configuration for form fields.
|
|
@@ -51,6 +55,8 @@ interface FieldValidations {
|
|
|
51
55
|
maxSelected?: number;
|
|
52
56
|
minDate?: string;
|
|
53
57
|
maxDate?: string;
|
|
58
|
+
minDateTime?: string;
|
|
59
|
+
maxDateTime?: string;
|
|
54
60
|
}
|
|
55
61
|
interface AsyncOptionSource {
|
|
56
62
|
api: string;
|
|
@@ -105,6 +111,7 @@ interface FormField {
|
|
|
105
111
|
lookupSource?: string;
|
|
106
112
|
lookupValueField?: string;
|
|
107
113
|
lookupLabelField?: string;
|
|
114
|
+
lookupParentFieldName?: string | null;
|
|
108
115
|
isd?: ISDConfig;
|
|
109
116
|
imageUrl?: string;
|
|
110
117
|
valueSource?: 'manual' | 'formula';
|
|
@@ -118,6 +125,22 @@ interface FormField {
|
|
|
118
125
|
showWhenValueOffFields?: string[];
|
|
119
126
|
repeatItemLabel?: string;
|
|
120
127
|
repeatIncrementEnabled?: boolean;
|
|
128
|
+
dateConstraints?: DateConstraint;
|
|
129
|
+
nameGeneratorFormat?: NameGeneratorFormat;
|
|
130
|
+
nameGeneratorText?: string;
|
|
131
|
+
nameGeneratorPrefix?: string;
|
|
132
|
+
nameGeneratorSuffix?: string;
|
|
133
|
+
nameGeneratorIdPadding?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Conditional date constraint — evaluated at runtime against the current date or another field's value.
|
|
137
|
+
* Operators: LESS_THAN (<), LESS_THAN_EQUAL (<=), GREATER_THAN (>), GREATER_THAN_EQUAL (>=)
|
|
138
|
+
* compareWith: CURRENT_DATE uses system time; FIELD references another date/datetime field by fieldName or id.
|
|
139
|
+
*/
|
|
140
|
+
interface DateConstraint {
|
|
141
|
+
operator: 'LESS_THAN' | 'LESS_THAN_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_EQUAL';
|
|
142
|
+
compareWith: 'CURRENT_DATE' | 'FIELD';
|
|
143
|
+
fieldName?: string;
|
|
121
144
|
}
|
|
122
145
|
/**
|
|
123
146
|
* ISD (International Subscriber Dialing) configuration for phone fields
|
|
@@ -439,8 +462,17 @@ declare function getNumericFieldsForFormula(schema: FormSchema, excludeFieldId?:
|
|
|
439
462
|
label: string;
|
|
440
463
|
}[];
|
|
441
464
|
|
|
465
|
+
/** Reset counter (for testing or new form load) */
|
|
466
|
+
declare function resetNameGeneratorCounter(): void;
|
|
467
|
+
/**
|
|
468
|
+
* Generate a name based on field configuration.
|
|
469
|
+
* Uses format, prefix, suffix, static text, and padded ID.
|
|
470
|
+
* For USER_INPUT formats, uses empty string as placeholder (caller should pass userInput).
|
|
471
|
+
*/
|
|
472
|
+
declare function generateName(fieldConfig: Pick<FormField, 'nameGeneratorFormat' | 'nameGeneratorText' | 'nameGeneratorPrefix' | 'nameGeneratorSuffix' | 'nameGeneratorIdPadding'>, userInput?: string): string;
|
|
473
|
+
|
|
442
474
|
declare const initFormBuilder: (options: FormBuilderOptions & {
|
|
443
475
|
containerId: string;
|
|
444
476
|
}) => FormBuilder;
|
|
445
477
|
|
|
446
|
-
export { AsyncOptionSource, 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 };
|
|
478
|
+
export { type AsyncOptionSource, type DateConstraint, type FieldType, type FieldValidations, type FieldWidth, FormBuilder, type FormBuilderOptions, type FormField, FormRenderer, type FormSchema, FormSchemaValidation, type FormSection, type ISDConfig, 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,12 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
3
3
|
|
|
4
|
-
type FieldType = 'text' | 'textarea' | 'number' | 'date' | '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;
|
|
8
10
|
interface ValidationRule {
|
|
9
|
-
type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'email' | 'minDate' | 'maxDate' | 'minSelected' | 'maxSelected';
|
|
11
|
+
type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'email' | 'minDate' | 'maxDate' | 'minDateTime' | 'maxDateTime' | 'minSelected' | 'maxSelected';
|
|
10
12
|
value?: string | number | boolean;
|
|
11
13
|
message?: string;
|
|
12
14
|
regex?: string;
|
|
@@ -23,6 +25,8 @@ interface ValidationObject {
|
|
|
23
25
|
maxSelected?: number;
|
|
24
26
|
minDate?: string;
|
|
25
27
|
maxDate?: string;
|
|
28
|
+
minDateTime?: string;
|
|
29
|
+
maxDateTime?: string;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Comprehensive validation configuration for form fields.
|
|
@@ -51,6 +55,8 @@ interface FieldValidations {
|
|
|
51
55
|
maxSelected?: number;
|
|
52
56
|
minDate?: string;
|
|
53
57
|
maxDate?: string;
|
|
58
|
+
minDateTime?: string;
|
|
59
|
+
maxDateTime?: string;
|
|
54
60
|
}
|
|
55
61
|
interface AsyncOptionSource {
|
|
56
62
|
api: string;
|
|
@@ -105,6 +111,7 @@ interface FormField {
|
|
|
105
111
|
lookupSource?: string;
|
|
106
112
|
lookupValueField?: string;
|
|
107
113
|
lookupLabelField?: string;
|
|
114
|
+
lookupParentFieldName?: string | null;
|
|
108
115
|
isd?: ISDConfig;
|
|
109
116
|
imageUrl?: string;
|
|
110
117
|
valueSource?: 'manual' | 'formula';
|
|
@@ -118,6 +125,22 @@ interface FormField {
|
|
|
118
125
|
showWhenValueOffFields?: string[];
|
|
119
126
|
repeatItemLabel?: string;
|
|
120
127
|
repeatIncrementEnabled?: boolean;
|
|
128
|
+
dateConstraints?: DateConstraint;
|
|
129
|
+
nameGeneratorFormat?: NameGeneratorFormat;
|
|
130
|
+
nameGeneratorText?: string;
|
|
131
|
+
nameGeneratorPrefix?: string;
|
|
132
|
+
nameGeneratorSuffix?: string;
|
|
133
|
+
nameGeneratorIdPadding?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Conditional date constraint — evaluated at runtime against the current date or another field's value.
|
|
137
|
+
* Operators: LESS_THAN (<), LESS_THAN_EQUAL (<=), GREATER_THAN (>), GREATER_THAN_EQUAL (>=)
|
|
138
|
+
* compareWith: CURRENT_DATE uses system time; FIELD references another date/datetime field by fieldName or id.
|
|
139
|
+
*/
|
|
140
|
+
interface DateConstraint {
|
|
141
|
+
operator: 'LESS_THAN' | 'LESS_THAN_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_EQUAL';
|
|
142
|
+
compareWith: 'CURRENT_DATE' | 'FIELD';
|
|
143
|
+
fieldName?: string;
|
|
121
144
|
}
|
|
122
145
|
/**
|
|
123
146
|
* ISD (International Subscriber Dialing) configuration for phone fields
|
|
@@ -439,8 +462,17 @@ declare function getNumericFieldsForFormula(schema: FormSchema, excludeFieldId?:
|
|
|
439
462
|
label: string;
|
|
440
463
|
}[];
|
|
441
464
|
|
|
465
|
+
/** Reset counter (for testing or new form load) */
|
|
466
|
+
declare function resetNameGeneratorCounter(): void;
|
|
467
|
+
/**
|
|
468
|
+
* Generate a name based on field configuration.
|
|
469
|
+
* Uses format, prefix, suffix, static text, and padded ID.
|
|
470
|
+
* For USER_INPUT formats, uses empty string as placeholder (caller should pass userInput).
|
|
471
|
+
*/
|
|
472
|
+
declare function generateName(fieldConfig: Pick<FormField, 'nameGeneratorFormat' | 'nameGeneratorText' | 'nameGeneratorPrefix' | 'nameGeneratorSuffix' | 'nameGeneratorIdPadding'>, userInput?: string): string;
|
|
473
|
+
|
|
442
474
|
declare const initFormBuilder: (options: FormBuilderOptions & {
|
|
443
475
|
containerId: string;
|
|
444
476
|
}) => FormBuilder;
|
|
445
477
|
|
|
446
|
-
export { AsyncOptionSource, 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 };
|
|
478
|
+
export { type AsyncOptionSource, type DateConstraint, type FieldType, type FieldValidations, type FieldWidth, FormBuilder, type FormBuilderOptions, type FormField, FormRenderer, type FormSchema, FormSchemaValidation, type FormSection, type ISDConfig, type MasterType, type NameGeneratorFormat, type ValidationObject, type ValidationRule, builderToPlatform, cleanFormSchema, convertValidationObjectToArray, detectCircularDependency, evaluateFormula, formStore, generateName, getColSpanFromWidth, getNumericFieldsForFormula, getValidationConfigForAngular, initFormBuilder, parseFormulaDependencies, parseWidth, platformToBuilder, resetNameGeneratorCounter, validateFormula };
|