@ng-forge/dynamic-forms 1.1.0-next.2 → 1.1.0-next.3

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.
Files changed (26) hide show
  1. package/README.md +4 -1
  2. package/fesm2022/{ng-forge-dynamic-forms-array-field.component-CftX-bCB.mjs → ng-forge-dynamic-forms-array-field.component-DCHrAcfd.mjs} +2 -2
  3. package/fesm2022/{ng-forge-dynamic-forms-array-field.component-CftX-bCB.mjs.map → ng-forge-dynamic-forms-array-field.component-DCHrAcfd.mjs.map} +1 -1
  4. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CFSJLZPZ.mjs → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-DWIWQjjZ.mjs} +2 -2
  5. package/fesm2022/{ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-CFSJLZPZ.mjs.map → ng-forge-dynamic-forms-bootstrap-derivation-orchestrator-DWIWQjjZ.mjs.map} +1 -1
  6. package/fesm2022/{ng-forge-dynamic-forms-container-field.component-B_bQ-f2g.mjs → ng-forge-dynamic-forms-container-field.component-CSYhRBe6.mjs} +2 -2
  7. package/fesm2022/{ng-forge-dynamic-forms-container-field.component-B_bQ-f2g.mjs.map → ng-forge-dynamic-forms-container-field.component-CSYhRBe6.mjs.map} +1 -1
  8. package/fesm2022/{ng-forge-dynamic-forms-group-field.component-Bl9WRPvF.mjs → ng-forge-dynamic-forms-group-field.component-DqhHzVsN.mjs} +2 -2
  9. package/fesm2022/{ng-forge-dynamic-forms-group-field.component-Bl9WRPvF.mjs.map → ng-forge-dynamic-forms-group-field.component-DqhHzVsN.mjs.map} +1 -1
  10. package/fesm2022/ng-forge-dynamic-forms-integration.mjs +17 -67
  11. package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -1
  12. package/fesm2022/ng-forge-dynamic-forms-internal.mjs +41 -35
  13. package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -1
  14. package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms-fMB33l2f.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-BYyZ_cuA.mjs} +49 -135
  15. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-BYyZ_cuA.mjs.map +1 -0
  16. package/fesm2022/{ng-forge-dynamic-forms-page-field.component-C9bQkVjQ.mjs → ng-forge-dynamic-forms-page-field.component-Vvk3fYZp.mjs} +2 -2
  17. package/fesm2022/{ng-forge-dynamic-forms-page-field.component-C9bQkVjQ.mjs.map → ng-forge-dynamic-forms-page-field.component-Vvk3fYZp.mjs.map} +1 -1
  18. package/fesm2022/ng-forge-dynamic-forms-testing.mjs +84 -0
  19. package/fesm2022/ng-forge-dynamic-forms-testing.mjs.map +1 -0
  20. package/fesm2022/ng-forge-dynamic-forms.mjs +1 -1
  21. package/package.json +5 -1
  22. package/types/ng-forge-dynamic-forms-integration.d.ts +6 -54
  23. package/types/ng-forge-dynamic-forms-internal.d.ts +41 -10
  24. package/types/ng-forge-dynamic-forms-testing.d.ts +58 -0
  25. package/types/ng-forge-dynamic-forms.d.ts +1 -1
  26. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-fMB33l2f.mjs.map +0 -1
@@ -392,6 +392,15 @@ function hasCrossFieldWhenCondition(config, context) {
392
392
  }
393
393
  return isCrossFieldExpression(config.when, context);
394
394
  }
395
+ function requiresTreeValidation(config) {
396
+ if (isResourceBasedValidator(config)) {
397
+ return false;
398
+ }
399
+ if (config.type === 'custom') {
400
+ return isCrossFieldValidator(config);
401
+ }
402
+ return isCrossFieldBuiltInValidator(config);
403
+ }
395
404
  function isCrossFieldStateLogic(config, context) {
396
405
  return isCrossFieldExpression(config.condition, context);
397
406
  }
@@ -2250,7 +2259,7 @@ function createDebouncedLogicFunction(expression, debounceMs) {
2250
2259
  }
2251
2260
  }
2252
2261
  const fn = (ctx) => {
2253
- const contextKey = safeReadPathKeys(ctx).join('.');
2262
+ const contextKey = safeReadPathKeys(ctx).join('.');
2254
2263
  let signalPair = cacheService.debouncedSignalStore.get(contextKey);
2255
2264
  if (!signalPair) {
2256
2265
  const immediateValue = signal(false, /* @ts-ignore */
@@ -2539,47 +2548,52 @@ function createDynamicValueFunction(expression) {
2539
2548
  return fn;
2540
2549
  }
2541
2550
 
2542
- function applyEmailValidator(path) {
2543
- email(path);
2551
+ function applyEmailValidator(path, when) {
2552
+ email(path, when ? { when: when } : undefined);
2544
2553
  }
2545
- function applyMinValidator(path, value, expression) {
2554
+ function applyMinValidator(path, value, expression, when) {
2555
+ const opts = when ? { when: when } : undefined;
2546
2556
  if (expression) {
2547
- min(path, createDynamicValueFunction(expression));
2557
+ min(path, createDynamicValueFunction(expression), opts);
2548
2558
  }
2549
2559
  else {
2550
- min(path, value);
2560
+ min(path, value, opts);
2551
2561
  }
2552
2562
  }
2553
- function applyMaxValidator(path, value, expression) {
2563
+ function applyMaxValidator(path, value, expression, when) {
2564
+ const opts = when ? { when: when } : undefined;
2554
2565
  if (expression) {
2555
- max(path, createDynamicValueFunction(expression));
2566
+ max(path, createDynamicValueFunction(expression), opts);
2556
2567
  }
2557
2568
  else {
2558
- max(path, value);
2569
+ max(path, value, opts);
2559
2570
  }
2560
2571
  }
2561
- function applyMinLengthValidator(path, value, expression) {
2572
+ function applyMinLengthValidator(path, value, expression, when) {
2573
+ const opts = when ? { when: when } : undefined;
2562
2574
  if (expression) {
2563
- minLength(path, createDynamicValueFunction(expression));
2575
+ minLength(path, createDynamicValueFunction(expression), opts);
2564
2576
  }
2565
2577
  else {
2566
- minLength(path, value);
2578
+ minLength(path, value, opts);
2567
2579
  }
2568
2580
  }
2569
- function applyMaxLengthValidator(path, value, expression) {
2581
+ function applyMaxLengthValidator(path, value, expression, when) {
2582
+ const opts = when ? { when: when } : undefined;
2570
2583
  if (expression) {
2571
- maxLength(path, createDynamicValueFunction(expression));
2584
+ maxLength(path, createDynamicValueFunction(expression), opts);
2572
2585
  }
2573
2586
  else {
2574
- maxLength(path, value);
2587
+ maxLength(path, value, opts);
2575
2588
  }
2576
2589
  }
2577
- function applyPatternValidator(path, value, expression) {
2590
+ function applyPatternValidator(path, value, expression, when) {
2591
+ const opts = when ? { when: when } : undefined;
2578
2592
  if (expression) {
2579
- pattern(path, createDynamicValueFunction(expression));
2593
+ pattern(path, createDynamicValueFunction(expression), opts);
2580
2594
  }
2581
2595
  else {
2582
- pattern(path, value);
2596
+ pattern(path, value, opts);
2583
2597
  }
2584
2598
  }
2585
2599
  function createConditionalLogic(when) {
@@ -2587,39 +2601,34 @@ function createConditionalLogic(when) {
2587
2601
  }
2588
2602
  function applyValidator(config, fieldPath) {
2589
2603
  const path = fieldPath;
2590
- if (!isResourceBasedValidator(config) && (isCrossFieldBuiltInValidator(config) || hasCrossFieldWhenCondition(config))) {
2604
+ if (requiresTreeValidation(config)) {
2591
2605
  return;
2592
2606
  }
2593
2607
  switch (config.type) {
2594
2608
  case 'required':
2595
- if (config.when) {
2596
- required(path, { when: createLogicFunction(config.when) });
2597
- }
2598
- else {
2599
- required(path);
2600
- }
2609
+ required(path, config.when ? { when: createConditionalLogic(config.when) } : undefined);
2601
2610
  break;
2602
2611
  case 'email':
2603
- applyEmailValidator(fieldPath);
2612
+ applyEmailValidator(fieldPath, createConditionalLogic(config.when));
2604
2613
  break;
2605
2614
  case 'min':
2606
2615
  if (typeof config.value === 'number') {
2607
- applyMinValidator(fieldPath, config.value, config.expression);
2616
+ applyMinValidator(fieldPath, config.value, config.expression, createConditionalLogic(config.when));
2608
2617
  }
2609
2618
  break;
2610
2619
  case 'max':
2611
2620
  if (typeof config.value === 'number') {
2612
- applyMaxValidator(fieldPath, config.value, config.expression);
2621
+ applyMaxValidator(fieldPath, config.value, config.expression, createConditionalLogic(config.when));
2613
2622
  }
2614
2623
  break;
2615
2624
  case 'minLength':
2616
2625
  if (typeof config.value === 'number') {
2617
- applyMinLengthValidator(fieldPath, config.value, config.expression);
2626
+ applyMinLengthValidator(fieldPath, config.value, config.expression, createConditionalLogic(config.when));
2618
2627
  }
2619
2628
  break;
2620
2629
  case 'maxLength':
2621
2630
  if (typeof config.value === 'number') {
2622
- applyMaxLengthValidator(fieldPath, config.value, config.expression);
2631
+ applyMaxLengthValidator(fieldPath, config.value, config.expression, createConditionalLogic(config.when));
2623
2632
  }
2624
2633
  break;
2625
2634
  case 'pattern':
@@ -2636,7 +2645,7 @@ function applyValidator(config, fieldPath) {
2636
2645
  else {
2637
2646
  regexPattern = config.value;
2638
2647
  }
2639
- applyPatternValidator(fieldPath, regexPattern, config.expression);
2648
+ applyPatternValidator(fieldPath, regexPattern, config.expression, createConditionalLogic(config.when));
2640
2649
  }
2641
2650
  break;
2642
2651
  case 'custom':
@@ -2651,9 +2660,6 @@ function applyValidator(config, fieldPath) {
2651
2660
  }
2652
2661
  }
2653
2662
  function applyCustomValidator(config, fieldPath) {
2654
- if (isCrossFieldValidator(config)) {
2655
- return;
2656
- }
2657
2663
  let validatorFn;
2658
2664
  if (config.expression) {
2659
2665
  validatorFn = createExpressionValidator(config);
@@ -3647,5 +3653,5 @@ function createWarningTracker() {
3647
3653
 
3648
3654
 
3649
3655
 
3650
- export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_TYPE_COMPONENT_CACHE, ADDON_TYPE_DEFINITIONS, ADDON_TYPE_REGISTRY, ARRAY_CONTEXT, AsyncConditionFunctionCacheService, ComponentInitializedEvent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DEPRECATION_WARNING_TRACKER, DF_FIELD_TEMPLATES, DfAddonSlot, DynamicFormError, DynamicFormLogger, DynamicTextPipe, DynamicValueFunctionCacheService, EMIT_FORM_VALUE_ON_EVENTS, EXTERNAL_DATA, EventBus, ExpressionParser, ExpressionParserError, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_ID_PREFIX, FORM_OPTIONS, FieldContextRegistryService, FunctionRegistryService, GROUP_CONTEXT, HTTP_CONDITION_CACHE, HttpConditionCache, HttpConditionFunctionCacheService, INITIALIZATION_TIMEOUT_MS, LogicFunctionCacheService, NoopLogger, READONLY_FIELD_TREE_CACHE, RootFormRegistryService, TokenType, WRAPPER_AUTO_ASSOCIATIONS, WRAPPER_COMPONENT_CACHE, WRAPPER_REGISTRY, applyMetaToElement, applyValidator, applyValidators, arrayFieldMapper, assertNever, baseFieldMapper, buildBaseInputs, compareValues, containerFieldMapper, createAddonActionRegistry, createDebouncedLogicFunction, createDefaultDerivationLogConfig, createDynamicValueFunction, createFormFieldStateMap, createInitializationTracker, createLogicFunction, createWarningTracker, deepMergeDefaults, derivedFromDeferred, detectFormMode, dynamicTextToObservable, evaluateCondition, evaluateNonFieldDisabled, evaluateNonFieldHidden, extractExpressionDependencies, extractStringDependencies, getArrayLength, getChangedKeys, getFieldValueHandling, getNestedValue, groupFieldMapper, hasChildFields, hasCrossFieldWhenCondition, hasFormValue, hasNestedProperty, hasTargetProperty, injectAddonTypeRegistry, injectFieldSignalContext, injectFieldsSupportingAddons, injectNonFieldEvaluationContext, interpolateParams, isArrayField, isCheckedField, isContainerField, isCrossFieldBuiltInValidator, isCrossFieldExpression, isCrossFieldSchema, isCrossFieldStateLogic, isCrossFieldValidator, isDerivationLogicConfig, isDisplayOnlyField, isEqual, isFieldBoundContext, isFormStateCondition, isFunctionHttpValidator, isGenericContainerField, isGroupField, isHiddenField, isLeafField, isNonPagedForm, isPageField, isPagedForm, isResourceBasedValidator, isRowField, isSimplifiedArrayField, isStateLogicConfig, isValidNonPagedForm, isValidPagedForm, isValueBearingField, isValueField, isWrapperTypeDefinition, keyBy, mapValues, memoize, normalizeFieldsArray, omit, pageFieldMapper, readFieldStateInfo, resolveDynamicValue, resolveHttpRequest, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled, resolveTokens, rowFieldMapper, runPresetAction, setupInitializationTracking, shouldLog, textFieldMapper, toReadonlyFieldTree, toReadonlyFieldTreeCached, validatePageNesting, withPreviousValue, writeToFieldValue };
3656
+ export { ADDON_ACTION_HANDLERS, ADDON_ACTION_REGISTRY, ADDON_TYPE_COMPONENT_CACHE, ADDON_TYPE_DEFINITIONS, ADDON_TYPE_REGISTRY, ARRAY_CONTEXT, AsyncConditionFunctionCacheService, ComponentInitializedEvent, DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, DEFAULT_WRAPPERS, DEPRECATION_WARNING_TRACKER, DF_FIELD_TEMPLATES, DfAddonSlot, DynamicFormError, DynamicFormLogger, DynamicTextPipe, DynamicValueFunctionCacheService, EMIT_FORM_VALUE_ON_EVENTS, EXTERNAL_DATA, EventBus, ExpressionParser, ExpressionParserError, FIELD_REGISTRY, FIELD_SIGNAL_CONTEXT, FORM_ID_PREFIX, FORM_OPTIONS, FieldContextRegistryService, FunctionRegistryService, GROUP_CONTEXT, HTTP_CONDITION_CACHE, HttpConditionCache, HttpConditionFunctionCacheService, INITIALIZATION_TIMEOUT_MS, LogicFunctionCacheService, NoopLogger, READONLY_FIELD_TREE_CACHE, RootFormRegistryService, TokenType, WRAPPER_AUTO_ASSOCIATIONS, WRAPPER_COMPONENT_CACHE, WRAPPER_REGISTRY, applyMetaToElement, applyValidator, applyValidators, arrayFieldMapper, assertNever, baseFieldMapper, buildBaseInputs, buildClassName, compareValues, containerFieldMapper, createAddonActionRegistry, createDebouncedLogicFunction, createDefaultDerivationLogConfig, createDynamicValueFunction, createFormFieldStateMap, createInitializationTracker, createLogicFunction, createWarningTracker, deepMergeDefaults, derivedFromDeferred, detectFormMode, dynamicTextToObservable, evaluateCondition, evaluateNonFieldDisabled, evaluateNonFieldHidden, extractExpressionDependencies, extractStringDependencies, getArrayLength, getChangedKeys, getFieldValueHandling, getGridClassString, getNestedValue, groupFieldMapper, hasChildFields, hasCrossFieldWhenCondition, hasFormValue, hasNestedProperty, hasTargetProperty, injectAddonTypeRegistry, injectFieldSignalContext, injectFieldsSupportingAddons, injectNonFieldEvaluationContext, interpolateParams, isArrayField, isCheckedField, isContainerField, isCrossFieldBuiltInValidator, isCrossFieldExpression, isCrossFieldSchema, isCrossFieldStateLogic, isCrossFieldValidator, isDerivationLogicConfig, isDisplayOnlyField, isEqual, isFieldBoundContext, isFormStateCondition, isFunctionHttpValidator, isGenericContainerField, isGroupField, isHiddenField, isLeafField, isNonPagedForm, isPageField, isPagedForm, isResourceBasedValidator, isRowField, isSimplifiedArrayField, isStateLogicConfig, isValidNonPagedForm, isValidPagedForm, isValueBearingField, isValueField, isWrapperTypeDefinition, keyBy, mapValues, memoize, normalizeFieldsArray, omit, pageFieldMapper, readFieldStateInfo, requiresTreeValidation, resolveDynamicValue, resolveHttpRequest, resolveNextButtonDisabled, resolveNonFieldDisabled, resolveNonFieldHidden, resolveSubmitButtonDisabled, resolveTokens, rowFieldMapper, runPresetAction, setupInitializationTracking, shouldLog, textFieldMapper, toReadonlyFieldTree, toReadonlyFieldTreeCached, validatePageNesting, withPreviousValue, writeToFieldValue };
3651
3657
  //# sourceMappingURL=ng-forge-dynamic-forms-internal.mjs.map