@form-eng/core 1.2.0 → 1.3.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/adapter-utils.d.mts +107 -0
- package/dist/adapter-utils.d.ts +107 -0
- package/dist/adapter-utils.js +146 -0
- package/dist/adapter-utils.js.map +1 -0
- package/dist/adapter-utils.mjs +33 -0
- package/dist/adapter-utils.mjs.map +1 -0
- package/dist/chunk-F57MYSS6.mjs +133 -0
- package/dist/chunk-F57MYSS6.mjs.map +1 -0
- package/dist/chunk-YMUYHDWI.mjs +57 -0
- package/dist/chunk-YMUYHDWI.mjs.map +1 -0
- package/dist/index-BrfbmVFA.d.mts +24 -0
- package/dist/index-BrfbmVFA.d.ts +24 -0
- package/dist/index.d.mts +4 -127
- package/dist/index.d.ts +4 -127
- package/dist/index.mjs +27 -162
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +30 -0
- package/dist/testing.d.ts +30 -0
- package/dist/testing.js +231 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +157 -0
- package/dist/testing.mjs.map +1 -0
- package/package.json +15 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Generic dictionary type */
|
|
2
|
+
type Dictionary<T> = Record<string, T>;
|
|
3
|
+
/** Entity data type */
|
|
4
|
+
type IEntityData = Record<string, unknown>;
|
|
5
|
+
/** Sub-entity value type */
|
|
6
|
+
type SubEntityType = string | number | boolean | Date | object | null | undefined;
|
|
7
|
+
declare function isEmpty(value: unknown): boolean;
|
|
8
|
+
declare function isNull(value: unknown): value is null | undefined;
|
|
9
|
+
declare function isStringEmpty(value: string | null | undefined): boolean;
|
|
10
|
+
declare function deepCopy<T>(obj: T): T;
|
|
11
|
+
declare function convertBooleanToYesOrNoText(value: boolean | null | undefined): string;
|
|
12
|
+
/** Sort options alphabetically by label */
|
|
13
|
+
declare function sortDropdownOptions(a: {
|
|
14
|
+
label?: string;
|
|
15
|
+
}, b: {
|
|
16
|
+
label?: string;
|
|
17
|
+
}): number;
|
|
18
|
+
/** Create an option from a value string (value and label are the same) */
|
|
19
|
+
declare function createOption(value: string): {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { type Dictionary as D, type IEntityData as I, type SubEntityType as S, createOption as a, isNull as b, convertBooleanToYesOrNoText as c, deepCopy as d, isStringEmpty as e, isEmpty as i, sortDropdownOptions as s };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { I as IEntityData, S as SubEntityType, D as Dictionary } from './index-BrfbmVFA.mjs';
|
|
2
|
+
export { c as convertBooleanToYesOrNoText, a as createOption, d as deepCopy, i as isEmpty, b as isNull, e as isStringEmpty, s as sortDropdownOptions } from './index-BrfbmVFA.mjs';
|
|
1
3
|
import * as react_hook_form from 'react-hook-form';
|
|
2
4
|
import { FieldError, UseFormSetValue } from 'react-hook-form';
|
|
5
|
+
export { DocumentLinksStrings, FieldClassName, GetFieldDataTestId, IDateRangeConfig, IDateRangeValue, IDateTimeConfig, IFileUploadConfig, IPhoneInputConfig, IRatingConfig, MAX_FILE_SIZE_MB_DEFAULT, ellipsifyText, extractDigits, formatDateRange, formatDateTime, formatDateTimeValue, formatPhone, getFieldState, getFileNames } from './adapter-utils.mjs';
|
|
3
6
|
import React from 'react';
|
|
4
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
8
|
|
|
@@ -121,29 +124,6 @@ interface IRule {
|
|
|
121
124
|
priority?: number;
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
/** Generic dictionary type */
|
|
125
|
-
type Dictionary<T> = Record<string, T>;
|
|
126
|
-
/** Entity data type */
|
|
127
|
-
type IEntityData = Record<string, unknown>;
|
|
128
|
-
/** Sub-entity value type */
|
|
129
|
-
type SubEntityType = string | number | boolean | Date | object | null | undefined;
|
|
130
|
-
declare function isEmpty(value: unknown): boolean;
|
|
131
|
-
declare function isNull(value: unknown): value is null | undefined;
|
|
132
|
-
declare function isStringEmpty(value: string | null | undefined): boolean;
|
|
133
|
-
declare function deepCopy<T>(obj: T): T;
|
|
134
|
-
declare function convertBooleanToYesOrNoText(value: boolean | null | undefined): string;
|
|
135
|
-
/** Sort options alphabetically by label */
|
|
136
|
-
declare function sortDropdownOptions(a: {
|
|
137
|
-
label?: string;
|
|
138
|
-
}, b: {
|
|
139
|
-
label?: string;
|
|
140
|
-
}): number;
|
|
141
|
-
/** Create an option from a value string (value and label are the same) */
|
|
142
|
-
declare function createOption(value: string): {
|
|
143
|
-
value: string;
|
|
144
|
-
label: string;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
127
|
/**
|
|
148
128
|
* Static configuration for a single form field (v2 schema).
|
|
149
129
|
*
|
|
@@ -598,41 +578,6 @@ interface IFormEngineSharedProps {
|
|
|
598
578
|
parentEntity?: IEntityData;
|
|
599
579
|
}
|
|
600
580
|
|
|
601
|
-
/**
|
|
602
|
-
* Shared field config interfaces used by adapter packages.
|
|
603
|
-
* These define the shape of the `config` prop (IFieldProps.config) for specific field types.
|
|
604
|
-
*/
|
|
605
|
-
/** Config for Rating field */
|
|
606
|
-
interface IRatingConfig {
|
|
607
|
-
max?: number;
|
|
608
|
-
allowHalf?: boolean;
|
|
609
|
-
}
|
|
610
|
-
/** Config for DateRange field */
|
|
611
|
-
interface IDateRangeConfig {
|
|
612
|
-
minDate?: string;
|
|
613
|
-
maxDate?: string;
|
|
614
|
-
}
|
|
615
|
-
/** Value shape for DateRange field */
|
|
616
|
-
interface IDateRangeValue {
|
|
617
|
-
start: string;
|
|
618
|
-
end: string;
|
|
619
|
-
}
|
|
620
|
-
/** Config for DateTime field */
|
|
621
|
-
interface IDateTimeConfig {
|
|
622
|
-
minDateTime?: string;
|
|
623
|
-
maxDateTime?: string;
|
|
624
|
-
}
|
|
625
|
-
/** Config for FileUpload field */
|
|
626
|
-
interface IFileUploadConfig {
|
|
627
|
-
multiple?: boolean;
|
|
628
|
-
accept?: string;
|
|
629
|
-
maxSizeMb?: number;
|
|
630
|
-
}
|
|
631
|
-
/** Config for PhoneInput field */
|
|
632
|
-
interface IPhoneInputConfig {
|
|
633
|
-
format?: "us" | "international" | "raw";
|
|
634
|
-
}
|
|
635
|
-
|
|
636
581
|
declare const FIELD_PARENT_PREFIX = "Parent.";
|
|
637
582
|
/** Component type constants */
|
|
638
583
|
declare const ComponentTypes: {
|
|
@@ -1450,74 +1395,6 @@ declare function serializeFormState(data: IEntityData): string;
|
|
|
1450
1395
|
*/
|
|
1451
1396
|
declare function deserializeFormState(json: string): IEntityData;
|
|
1452
1397
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Generates a consistent data-testid for field components.
|
|
1455
|
-
* Used by all adapter packages for test attribute generation.
|
|
1456
|
-
*/
|
|
1457
|
-
declare const GetFieldDataTestId: (fieldName: string, programName?: string, entityType?: string, entityId?: string) => string;
|
|
1458
|
-
/**
|
|
1459
|
-
* Appends "error" to a className when a field has a validation error.
|
|
1460
|
-
* Used by Fluent and MUI adapters for error styling.
|
|
1461
|
-
*/
|
|
1462
|
-
declare const FieldClassName: (className: string, error?: FieldError) => string;
|
|
1463
|
-
/**
|
|
1464
|
-
* Returns a field state string based on the current field props.
|
|
1465
|
-
* Used by headless adapter for data-state attributes.
|
|
1466
|
-
*/
|
|
1467
|
-
declare function getFieldState(props: {
|
|
1468
|
-
error?: FieldError;
|
|
1469
|
-
required?: boolean;
|
|
1470
|
-
readOnly?: boolean;
|
|
1471
|
-
disabled?: boolean;
|
|
1472
|
-
}): string | undefined;
|
|
1473
|
-
/**
|
|
1474
|
-
* Formats an ISO date string for display.
|
|
1475
|
-
* Returns short date (e.g. "Jan 15, 2024") or date+time (e.g. "Jan 15, 2024, 02:30 PM").
|
|
1476
|
-
*/
|
|
1477
|
-
declare function formatDateTime(dateStr: string, options?: {
|
|
1478
|
-
hideTimestamp?: boolean;
|
|
1479
|
-
}): string;
|
|
1480
|
-
/**
|
|
1481
|
-
* Safely formats a value as a date+time string, falling back to String() on error.
|
|
1482
|
-
*/
|
|
1483
|
-
declare function formatDateTimeValue(value: unknown): string;
|
|
1484
|
-
/**
|
|
1485
|
-
* Formats a date range value for read-only display.
|
|
1486
|
-
* Returns "start – end", or just the one that exists.
|
|
1487
|
-
*/
|
|
1488
|
-
declare function formatDateRange(value: unknown): string;
|
|
1489
|
-
/**
|
|
1490
|
-
* Extracts display names from File or File[] values.
|
|
1491
|
-
*/
|
|
1492
|
-
declare function getFileNames(value: unknown): string;
|
|
1493
|
-
/**
|
|
1494
|
-
* Strips all non-digit characters from a string.
|
|
1495
|
-
*/
|
|
1496
|
-
declare function extractDigits(value: string): string;
|
|
1497
|
-
/**
|
|
1498
|
-
* Formats a digit string as a phone number.
|
|
1499
|
-
* Supports US "(XXX) XXX-XXXX", international "+X XXX XXX XXXX", and raw digits.
|
|
1500
|
-
*/
|
|
1501
|
-
declare function formatPhone(digits: string, format: "us" | "international" | "raw"): string;
|
|
1502
|
-
/**
|
|
1503
|
-
* Truncates text with "..." if it exceeds maxChars.
|
|
1504
|
-
*/
|
|
1505
|
-
declare function ellipsifyText(value: string, maxChars: number): string;
|
|
1506
|
-
/** Default max file size in MB for FileUpload fields */
|
|
1507
|
-
declare const MAX_FILE_SIZE_MB_DEFAULT = 10;
|
|
1508
|
-
/** Shared strings for DocumentLinks component */
|
|
1509
|
-
declare const DocumentLinksStrings: {
|
|
1510
|
-
link: string;
|
|
1511
|
-
addLink: string;
|
|
1512
|
-
addAnotherLink: string;
|
|
1513
|
-
deleteLink: string;
|
|
1514
|
-
confirmDeleteLink: string;
|
|
1515
|
-
delete: string;
|
|
1516
|
-
cancel: string;
|
|
1517
|
-
saveChanges: string;
|
|
1518
|
-
save: string;
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
1398
|
declare function evaluateExpression(expression: string, values: IEntityData, fieldName?: string, parentEntity?: IEntityData, currentUserId?: string): unknown;
|
|
1522
1399
|
/**
|
|
1523
1400
|
* Extracts field names referenced in an expression via $values.fieldName or $root.fieldName.
|
|
@@ -1600,4 +1477,4 @@ declare function getTimeline(): ITimelineEvent[];
|
|
|
1600
1477
|
*/
|
|
1601
1478
|
declare function clearTimeline(): void;
|
|
1602
1479
|
|
|
1603
|
-
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal,
|
|
1480
|
+
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValidatorMetadata, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createPatternRule, createRequiredIfRule, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getAllValidatorMetadata, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorMetadata, getValidatorRegistry, getValueFunction, getVisibleSteps, isFieldCondition, isLogicalCondition, isRuleTracingEnabled, isStepValid, logEvent, registerLocale, registerValidatorMetadata, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorMetadataRegistry, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { I as IEntityData, S as SubEntityType, D as Dictionary } from './index-BrfbmVFA.js';
|
|
2
|
+
export { c as convertBooleanToYesOrNoText, a as createOption, d as deepCopy, i as isEmpty, b as isNull, e as isStringEmpty, s as sortDropdownOptions } from './index-BrfbmVFA.js';
|
|
1
3
|
import * as react_hook_form from 'react-hook-form';
|
|
2
4
|
import { FieldError, UseFormSetValue } from 'react-hook-form';
|
|
5
|
+
export { DocumentLinksStrings, FieldClassName, GetFieldDataTestId, IDateRangeConfig, IDateRangeValue, IDateTimeConfig, IFileUploadConfig, IPhoneInputConfig, IRatingConfig, MAX_FILE_SIZE_MB_DEFAULT, ellipsifyText, extractDigits, formatDateRange, formatDateTime, formatDateTimeValue, formatPhone, getFieldState, getFileNames } from './adapter-utils.js';
|
|
3
6
|
import React from 'react';
|
|
4
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
8
|
|
|
@@ -121,29 +124,6 @@ interface IRule {
|
|
|
121
124
|
priority?: number;
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
/** Generic dictionary type */
|
|
125
|
-
type Dictionary<T> = Record<string, T>;
|
|
126
|
-
/** Entity data type */
|
|
127
|
-
type IEntityData = Record<string, unknown>;
|
|
128
|
-
/** Sub-entity value type */
|
|
129
|
-
type SubEntityType = string | number | boolean | Date | object | null | undefined;
|
|
130
|
-
declare function isEmpty(value: unknown): boolean;
|
|
131
|
-
declare function isNull(value: unknown): value is null | undefined;
|
|
132
|
-
declare function isStringEmpty(value: string | null | undefined): boolean;
|
|
133
|
-
declare function deepCopy<T>(obj: T): T;
|
|
134
|
-
declare function convertBooleanToYesOrNoText(value: boolean | null | undefined): string;
|
|
135
|
-
/** Sort options alphabetically by label */
|
|
136
|
-
declare function sortDropdownOptions(a: {
|
|
137
|
-
label?: string;
|
|
138
|
-
}, b: {
|
|
139
|
-
label?: string;
|
|
140
|
-
}): number;
|
|
141
|
-
/** Create an option from a value string (value and label are the same) */
|
|
142
|
-
declare function createOption(value: string): {
|
|
143
|
-
value: string;
|
|
144
|
-
label: string;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
127
|
/**
|
|
148
128
|
* Static configuration for a single form field (v2 schema).
|
|
149
129
|
*
|
|
@@ -598,41 +578,6 @@ interface IFormEngineSharedProps {
|
|
|
598
578
|
parentEntity?: IEntityData;
|
|
599
579
|
}
|
|
600
580
|
|
|
601
|
-
/**
|
|
602
|
-
* Shared field config interfaces used by adapter packages.
|
|
603
|
-
* These define the shape of the `config` prop (IFieldProps.config) for specific field types.
|
|
604
|
-
*/
|
|
605
|
-
/** Config for Rating field */
|
|
606
|
-
interface IRatingConfig {
|
|
607
|
-
max?: number;
|
|
608
|
-
allowHalf?: boolean;
|
|
609
|
-
}
|
|
610
|
-
/** Config for DateRange field */
|
|
611
|
-
interface IDateRangeConfig {
|
|
612
|
-
minDate?: string;
|
|
613
|
-
maxDate?: string;
|
|
614
|
-
}
|
|
615
|
-
/** Value shape for DateRange field */
|
|
616
|
-
interface IDateRangeValue {
|
|
617
|
-
start: string;
|
|
618
|
-
end: string;
|
|
619
|
-
}
|
|
620
|
-
/** Config for DateTime field */
|
|
621
|
-
interface IDateTimeConfig {
|
|
622
|
-
minDateTime?: string;
|
|
623
|
-
maxDateTime?: string;
|
|
624
|
-
}
|
|
625
|
-
/** Config for FileUpload field */
|
|
626
|
-
interface IFileUploadConfig {
|
|
627
|
-
multiple?: boolean;
|
|
628
|
-
accept?: string;
|
|
629
|
-
maxSizeMb?: number;
|
|
630
|
-
}
|
|
631
|
-
/** Config for PhoneInput field */
|
|
632
|
-
interface IPhoneInputConfig {
|
|
633
|
-
format?: "us" | "international" | "raw";
|
|
634
|
-
}
|
|
635
|
-
|
|
636
581
|
declare const FIELD_PARENT_PREFIX = "Parent.";
|
|
637
582
|
/** Component type constants */
|
|
638
583
|
declare const ComponentTypes: {
|
|
@@ -1450,74 +1395,6 @@ declare function serializeFormState(data: IEntityData): string;
|
|
|
1450
1395
|
*/
|
|
1451
1396
|
declare function deserializeFormState(json: string): IEntityData;
|
|
1452
1397
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Generates a consistent data-testid for field components.
|
|
1455
|
-
* Used by all adapter packages for test attribute generation.
|
|
1456
|
-
*/
|
|
1457
|
-
declare const GetFieldDataTestId: (fieldName: string, programName?: string, entityType?: string, entityId?: string) => string;
|
|
1458
|
-
/**
|
|
1459
|
-
* Appends "error" to a className when a field has a validation error.
|
|
1460
|
-
* Used by Fluent and MUI adapters for error styling.
|
|
1461
|
-
*/
|
|
1462
|
-
declare const FieldClassName: (className: string, error?: FieldError) => string;
|
|
1463
|
-
/**
|
|
1464
|
-
* Returns a field state string based on the current field props.
|
|
1465
|
-
* Used by headless adapter for data-state attributes.
|
|
1466
|
-
*/
|
|
1467
|
-
declare function getFieldState(props: {
|
|
1468
|
-
error?: FieldError;
|
|
1469
|
-
required?: boolean;
|
|
1470
|
-
readOnly?: boolean;
|
|
1471
|
-
disabled?: boolean;
|
|
1472
|
-
}): string | undefined;
|
|
1473
|
-
/**
|
|
1474
|
-
* Formats an ISO date string for display.
|
|
1475
|
-
* Returns short date (e.g. "Jan 15, 2024") or date+time (e.g. "Jan 15, 2024, 02:30 PM").
|
|
1476
|
-
*/
|
|
1477
|
-
declare function formatDateTime(dateStr: string, options?: {
|
|
1478
|
-
hideTimestamp?: boolean;
|
|
1479
|
-
}): string;
|
|
1480
|
-
/**
|
|
1481
|
-
* Safely formats a value as a date+time string, falling back to String() on error.
|
|
1482
|
-
*/
|
|
1483
|
-
declare function formatDateTimeValue(value: unknown): string;
|
|
1484
|
-
/**
|
|
1485
|
-
* Formats a date range value for read-only display.
|
|
1486
|
-
* Returns "start – end", or just the one that exists.
|
|
1487
|
-
*/
|
|
1488
|
-
declare function formatDateRange(value: unknown): string;
|
|
1489
|
-
/**
|
|
1490
|
-
* Extracts display names from File or File[] values.
|
|
1491
|
-
*/
|
|
1492
|
-
declare function getFileNames(value: unknown): string;
|
|
1493
|
-
/**
|
|
1494
|
-
* Strips all non-digit characters from a string.
|
|
1495
|
-
*/
|
|
1496
|
-
declare function extractDigits(value: string): string;
|
|
1497
|
-
/**
|
|
1498
|
-
* Formats a digit string as a phone number.
|
|
1499
|
-
* Supports US "(XXX) XXX-XXXX", international "+X XXX XXX XXXX", and raw digits.
|
|
1500
|
-
*/
|
|
1501
|
-
declare function formatPhone(digits: string, format: "us" | "international" | "raw"): string;
|
|
1502
|
-
/**
|
|
1503
|
-
* Truncates text with "..." if it exceeds maxChars.
|
|
1504
|
-
*/
|
|
1505
|
-
declare function ellipsifyText(value: string, maxChars: number): string;
|
|
1506
|
-
/** Default max file size in MB for FileUpload fields */
|
|
1507
|
-
declare const MAX_FILE_SIZE_MB_DEFAULT = 10;
|
|
1508
|
-
/** Shared strings for DocumentLinks component */
|
|
1509
|
-
declare const DocumentLinksStrings: {
|
|
1510
|
-
link: string;
|
|
1511
|
-
addLink: string;
|
|
1512
|
-
addAnotherLink: string;
|
|
1513
|
-
deleteLink: string;
|
|
1514
|
-
confirmDeleteLink: string;
|
|
1515
|
-
delete: string;
|
|
1516
|
-
cancel: string;
|
|
1517
|
-
saveChanges: string;
|
|
1518
|
-
save: string;
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
1398
|
declare function evaluateExpression(expression: string, values: IEntityData, fieldName?: string, parentEntity?: IEntityData, currentUserId?: string): unknown;
|
|
1522
1399
|
/**
|
|
1523
1400
|
* Extracts field names referenced in an expression via $values.fieldName or $root.fieldName.
|
|
@@ -1600,4 +1477,4 @@ declare function getTimeline(): ITimelineEvent[];
|
|
|
1600
1477
|
*/
|
|
1601
1478
|
declare function clearTimeline(): void;
|
|
1602
1479
|
|
|
1603
|
-
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal,
|
|
1480
|
+
export { CheckAsyncFieldValidationRules, CheckDefaultValues, CheckFieldValidationRules, CheckValidDropdownOptions, ComponentTypes, ConfirmInputsModal, Dictionary, ExecuteComputedValue, FIELD_PARENT_PREFIX, FieldArray, FieldWrapper, FormConstants, FormDevTools, FormEngine, FormErrorBoundary, FormFields, FormStrings, GetChildEntity, GetComputedValuesOnCreate, GetComputedValuesOnDirtyFields, GetConfirmInputModalProps, GetFieldsToRender, type IAnalyticsCallbacks, type IClearRulesAction, type ICondition, type IConfigValidationError, type IConfirmInputModalProps, type ICoreLocaleStrings, type ICycleError, type IDraftPersistenceOptions, type IDraftState, IEntityData, type IFieldArrayProps, type IFieldCondition, type IFieldConfig, type IFieldEffect, type IFieldProps, type IFieldToRender, type IFormAnalytics, type IFormConfig, type IFormDevToolsProps, type IFormEngineSharedProps, type IFormSettings, type IInjectedFieldProvider, type IJsonSchemaNode, type ILogicalCondition, type IOption, type IRjsfConvertOptions, type IRjsfUiSchema, type IRule, type IRuleTraceEvent, type IRulesEngineProvider, type IRulesEngineState, type IRuntimeFieldState, type IRuntimeFormState, type ISetRulesAction, type ITimelineEvent, type IUpdateRulesAction, type IUseDraftPersistenceResult, type IValidationContext, type IValidationRule, type IValidatorMetadata, type IValueFunctionContext, type IWizardConfig, type IWizardFormProps, type IWizardNavigationProps, type IWizardStep, type IWizardStepHeaderProps, InitOnCreateFormState, InitOnEditFormState, InjectedFieldProvider, IsExpandVisible, _default as RenderField, type RulesEngineAction, RulesEngineActionType, RulesEngineProvider, ShowField, SortOptions as SortDropdownOptions, SortOptions$1 as SortOptions, SubEntityType, type TimelineEventType, type TypedFieldConfig, UseInjectedFieldContext, UseRulesEngineContext, type ValidatorFn, type ValueFunction, WizardForm, buildDefaultFieldStates, buildDependencyGraph, clearRuleTraceLog, clearTimeline, createLazyFieldRegistry, createMaxLengthRule, createMinLengthRule, createNumericRangeRule, createPatternRule, createRequiredIfRule, defineFormConfig, deserializeFormState, detectDependencyCycles, detectSelfDependencies, disableRuleTracing, enableRuleTracing, evaluateAffectedFields, evaluateAllRules, evaluateCondition, evaluateExpression, executeValueFunction, extractConditionDependencies, extractExpressionDependencies, extractFunctionDependencies, flushRenderCycle, fromRjsfSchema, getAllValidatorMetadata, getCurrentLocale, getLastRenderedFields, getLocaleString, getRenderCounts, getRuleTraceLog, getStepFieldOrder, getStepFields, getStepIndex, getTimeline, getTotalFormRenders, getValidator, getValidatorMetadata, getValidatorRegistry, getValueFunction, getVisibleSteps, isFieldCondition, isLogicalCondition, isRuleTracingEnabled, isStepValid, logEvent, registerLocale, registerValidatorMetadata, registerValidators, registerValueFunctions, resetLocale, resetRenderTracker, resetValidatorMetadataRegistry, resetValidatorRegistry, resetValueFunctionRegistry, runSyncValidations, runValidations, serializeFormState, toRjsfSchema, topologicalSort, traceRuleEvent, trackRender, useBeforeUnload, useDraftPersistence, useFormAnalytics, validateDependencyGraph, validateFieldConfigs, validateStepFields, zodSchemaToFieldConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DocumentLinksStrings,
|
|
3
|
+
FieldClassName,
|
|
4
|
+
GetFieldDataTestId,
|
|
5
|
+
MAX_FILE_SIZE_MB_DEFAULT,
|
|
6
|
+
convertBooleanToYesOrNoText,
|
|
7
|
+
createOption,
|
|
8
|
+
deepCopy,
|
|
9
|
+
ellipsifyText,
|
|
10
|
+
extractDigits,
|
|
11
|
+
formatDateRange,
|
|
12
|
+
formatDateTime,
|
|
13
|
+
formatDateTimeValue,
|
|
14
|
+
formatPhone,
|
|
15
|
+
getFieldState,
|
|
16
|
+
getFileNames,
|
|
17
|
+
isEmpty,
|
|
18
|
+
isNull,
|
|
19
|
+
isStringEmpty,
|
|
20
|
+
sortDropdownOptions
|
|
21
|
+
} from "./chunk-F57MYSS6.mjs";
|
|
22
|
+
import {
|
|
23
|
+
ComponentTypes,
|
|
24
|
+
FIELD_PARENT_PREFIX,
|
|
25
|
+
FormConstants
|
|
26
|
+
} from "./chunk-YMUYHDWI.mjs";
|
|
27
|
+
|
|
1
28
|
// src/types/ICondition.ts
|
|
2
29
|
function isLogicalCondition(condition) {
|
|
3
30
|
const op = condition.operator;
|
|
@@ -20,88 +47,6 @@ function defineFormConfig(fields) {
|
|
|
20
47
|
return fields;
|
|
21
48
|
}
|
|
22
49
|
|
|
23
|
-
// src/utils/index.ts
|
|
24
|
-
function isEmpty(value) {
|
|
25
|
-
if (value == null) return true;
|
|
26
|
-
if (typeof value === "string") return value.trim() === "";
|
|
27
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
28
|
-
if (typeof value === "object") return Object.keys(value).length === 0;
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
function isNull(value) {
|
|
32
|
-
return value == null;
|
|
33
|
-
}
|
|
34
|
-
function isStringEmpty(value) {
|
|
35
|
-
return value == null || value.trim() === "";
|
|
36
|
-
}
|
|
37
|
-
function deepCopy(obj) {
|
|
38
|
-
return structuredClone(obj);
|
|
39
|
-
}
|
|
40
|
-
function convertBooleanToYesOrNoText(value) {
|
|
41
|
-
if (value === true) return "Yes";
|
|
42
|
-
if (value === false) return "No";
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
function sortDropdownOptions(a, b) {
|
|
46
|
-
const aText = a.label ? a.label.toLowerCase() : "";
|
|
47
|
-
const bText = b.label ? b.label.toLowerCase() : "";
|
|
48
|
-
return aText < bText ? -1 : aText > bText ? 1 : 0;
|
|
49
|
-
}
|
|
50
|
-
function createOption(value) {
|
|
51
|
-
return { value, label: value };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/constants.ts
|
|
55
|
-
var FIELD_PARENT_PREFIX = "Parent.";
|
|
56
|
-
var ComponentTypes = {
|
|
57
|
-
Textbox: "Textbox",
|
|
58
|
-
Dropdown: "Dropdown",
|
|
59
|
-
Toggle: "Toggle",
|
|
60
|
-
Number: "Number",
|
|
61
|
-
MultiSelect: "Multiselect",
|
|
62
|
-
DateControl: "DateControl",
|
|
63
|
-
Slider: "Slider",
|
|
64
|
-
Fragment: "DynamicFragment",
|
|
65
|
-
SimpleDropdown: "SimpleDropdown",
|
|
66
|
-
MultiSelectSearch: "MultiSelectSearch",
|
|
67
|
-
PopOutEditor: "PopOutEditor",
|
|
68
|
-
RichText: "RichText",
|
|
69
|
-
Textarea: "Textarea",
|
|
70
|
-
DocumentLinks: "DocumentLinks",
|
|
71
|
-
StatusDropdown: "StatusDropdown",
|
|
72
|
-
ReadOnly: "ReadOnly",
|
|
73
|
-
ReadOnlyArray: "ReadOnlyArray",
|
|
74
|
-
ReadOnlyDateTime: "ReadOnlyDateTime",
|
|
75
|
-
ReadOnlyCumulativeNumber: "ReadOnlyCumulativeNumber",
|
|
76
|
-
ReadOnlyRichText: "ReadOnlyRichText",
|
|
77
|
-
ReadOnlyWithButton: "ReadOnlyWithButton",
|
|
78
|
-
ChoiceSet: "ChoiceSet",
|
|
79
|
-
FieldArray: "FieldArray",
|
|
80
|
-
RadioGroup: "RadioGroup",
|
|
81
|
-
CheckboxGroup: "CheckboxGroup",
|
|
82
|
-
Rating: "Rating",
|
|
83
|
-
ColorPicker: "ColorPicker",
|
|
84
|
-
Autocomplete: "Autocomplete",
|
|
85
|
-
FileUpload: "FileUpload",
|
|
86
|
-
DateRange: "DateRange",
|
|
87
|
-
DateTime: "DateTime",
|
|
88
|
-
PhoneInput: "PhoneInput"
|
|
89
|
-
};
|
|
90
|
-
var FormConstants = {
|
|
91
|
-
defaultExpandCutoffCount: 12,
|
|
92
|
-
loadingShimmerCount: 12,
|
|
93
|
-
loadingFieldShimmerHeight: 32,
|
|
94
|
-
na: "n/a",
|
|
95
|
-
panelActionKeys: {
|
|
96
|
-
cancel: "Cancel",
|
|
97
|
-
close: "Close",
|
|
98
|
-
create: "Create",
|
|
99
|
-
update: "Update"
|
|
100
|
-
},
|
|
101
|
-
urlRegex: /(http(s?)):\/\//i,
|
|
102
|
-
errorColor: "#a4262c"
|
|
103
|
-
};
|
|
104
|
-
|
|
105
50
|
// src/helpers/LocaleRegistry.ts
|
|
106
51
|
var defaultStrings = {
|
|
107
52
|
// Form status
|
|
@@ -4191,86 +4136,6 @@ function useBeforeUnload(shouldWarn, message, onAbandonment) {
|
|
|
4191
4136
|
}, [shouldWarn, message]);
|
|
4192
4137
|
}
|
|
4193
4138
|
|
|
4194
|
-
// src/helpers/FieldUtils.ts
|
|
4195
|
-
var GetFieldDataTestId = (fieldName, programName, entityType, entityId) => {
|
|
4196
|
-
return `${programName}-${entityType}-${entityId}-${fieldName}`;
|
|
4197
|
-
};
|
|
4198
|
-
var FieldClassName = (className, error) => {
|
|
4199
|
-
return error ? `${className} error` : className;
|
|
4200
|
-
};
|
|
4201
|
-
function getFieldState(props) {
|
|
4202
|
-
if (props.error) return "error";
|
|
4203
|
-
if (props.required) return "required";
|
|
4204
|
-
if (props.readOnly) return "readonly";
|
|
4205
|
-
if (props.disabled) return "disabled";
|
|
4206
|
-
return void 0;
|
|
4207
|
-
}
|
|
4208
|
-
function formatDateTime(dateStr, options) {
|
|
4209
|
-
if (!dateStr) return "";
|
|
4210
|
-
const date = new Date(dateStr);
|
|
4211
|
-
if (isNaN(date.getTime())) return dateStr;
|
|
4212
|
-
if (options?.hideTimestamp) {
|
|
4213
|
-
return date.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
4214
|
-
}
|
|
4215
|
-
return date.toLocaleString(void 0, { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
4216
|
-
}
|
|
4217
|
-
function formatDateTimeValue(value) {
|
|
4218
|
-
if (!value) return "";
|
|
4219
|
-
try {
|
|
4220
|
-
return formatDateTime(value);
|
|
4221
|
-
} catch {
|
|
4222
|
-
return String(value);
|
|
4223
|
-
}
|
|
4224
|
-
}
|
|
4225
|
-
function formatDateRange(value) {
|
|
4226
|
-
if (!value) return "";
|
|
4227
|
-
const v = value;
|
|
4228
|
-
if (!v.start && !v.end) return "";
|
|
4229
|
-
if (v.start && v.end) return `${v.start} \u2013 ${v.end}`;
|
|
4230
|
-
return v.start || v.end;
|
|
4231
|
-
}
|
|
4232
|
-
function getFileNames(value) {
|
|
4233
|
-
if (!value) return "";
|
|
4234
|
-
if (Array.isArray(value)) return value.map((f) => f.name).join(", ");
|
|
4235
|
-
return value.name ?? "";
|
|
4236
|
-
}
|
|
4237
|
-
function extractDigits(value) {
|
|
4238
|
-
return value.replace(/\D/g, "");
|
|
4239
|
-
}
|
|
4240
|
-
function formatPhone(digits, format) {
|
|
4241
|
-
if (format === "raw") return digits;
|
|
4242
|
-
if (format === "international") {
|
|
4243
|
-
const d2 = digits.slice(0, 12);
|
|
4244
|
-
if (d2.length === 0) return "";
|
|
4245
|
-
if (d2.length <= 1) return `+${d2}`;
|
|
4246
|
-
if (d2.length <= 4) return `+${d2[0]} ${d2.slice(1)}`;
|
|
4247
|
-
if (d2.length <= 7) return `+${d2[0]} ${d2.slice(1, 4)} ${d2.slice(4)}`;
|
|
4248
|
-
return `+${d2[0]} ${d2.slice(1, 4)} ${d2.slice(4, 7)} ${d2.slice(7)}`;
|
|
4249
|
-
}
|
|
4250
|
-
const d = digits.slice(0, 10);
|
|
4251
|
-
if (d.length === 0) return "";
|
|
4252
|
-
if (d.length <= 3) return `(${d}`;
|
|
4253
|
-
if (d.length <= 6) return `(${d.slice(0, 3)}) ${d.slice(3)}`;
|
|
4254
|
-
return `(${d.slice(0, 3)}) ${d.slice(3, 6)}-${d.slice(6)}`;
|
|
4255
|
-
}
|
|
4256
|
-
function ellipsifyText(value, maxChars) {
|
|
4257
|
-
if (!value || value.length <= maxChars) return value ?? "";
|
|
4258
|
-
const cutoff = maxChars - 3;
|
|
4259
|
-
return `${value.substring(0, cutoff)}...`;
|
|
4260
|
-
}
|
|
4261
|
-
var MAX_FILE_SIZE_MB_DEFAULT = 10;
|
|
4262
|
-
var DocumentLinksStrings = {
|
|
4263
|
-
link: "Link",
|
|
4264
|
-
addLink: "Add Link",
|
|
4265
|
-
addAnotherLink: "Add Another Link",
|
|
4266
|
-
deleteLink: "Delete Link",
|
|
4267
|
-
confirmDeleteLink: "Are you sure you want to delete",
|
|
4268
|
-
delete: "Delete",
|
|
4269
|
-
cancel: "Cancel",
|
|
4270
|
-
saveChanges: "Save Changes",
|
|
4271
|
-
save: "Save"
|
|
4272
|
-
};
|
|
4273
|
-
|
|
4274
4139
|
// src/helpers/RuleTracer.ts
|
|
4275
4140
|
var traceEnabled = false;
|
|
4276
4141
|
var traceLog = [];
|