@iapps/ng-dhis2-ui 1.2.139 → 1.2.146

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.
@@ -5843,8 +5843,8 @@ Only proceed if you are certain this is intentional and acceptable according to
5843
5843
  ? `Location outside allowed area (not permitted)`
5844
5844
  : `Location outside allowed area (review required)`;
5845
5845
  // Optional debug logs (keep outside JSX)
5846
- console.log('rawAllowedArea:', rawAllowedArea);
5847
- console.log('safeAllowedAreaGeoJson:', safeAllowedAreaGeoJson);
5846
+ // console.log('rawAllowedArea:', rawAllowedArea);
5847
+ // console.log('safeAllowedAreaGeoJson:', safeAllowedAreaGeoJson);
5848
5848
  return (React__default.createElement(React__default.Fragment, null,
5849
5849
  React__default.createElement(Field, { label: label, name: name, required: required, error: Boolean(combinedErrorMessage), validationText: combinedErrorMessage ?? undefined },
5850
5850
  React__default.createElement("div", { style: {
@@ -7667,7 +7667,7 @@ class FieldCascadeUtil {
7667
7667
  if (!childPath || !parentLeaf)
7668
7668
  return false;
7669
7669
  const token = `${separator}${parentLeaf}`;
7670
- return (childPath.endsWith(token) || childPath.includes(token + separator));
7670
+ return childPath.endsWith(token) || childPath.includes(token + separator);
7671
7671
  }
7672
7672
  /**
7673
7673
  * Safe property getter for "unknown object shapes" (keeps TS happy).
@@ -7692,6 +7692,87 @@ class FieldCascadeUtil {
7692
7692
  }
7693
7693
  return FieldCascadeUtil.normalizePath(raw, merged.optionPathSeparator);
7694
7694
  }
7695
+ // static matchesChildToParent(
7696
+ // childPathRaw: string,
7697
+ // parentEffectiveRaw: string,
7698
+ // mode: ParentMatchMode,
7699
+ // separator = '/'
7700
+ // ): boolean {
7701
+ // const childPath = FieldCascadeUtil.normalizePath(childPathRaw, separator);
7702
+ // console.log("STABILITY::: ", JSON.stringify(childPath));
7703
+ // const parentEffective = FieldCascadeUtil.normalizePath(
7704
+ // parentEffectiveRaw,
7705
+ // separator
7706
+ // );
7707
+ // if (!childPath || !parentEffective) return false;
7708
+ // switch (mode) {
7709
+ // // case ParentMatchMode.PREFIX: {
7710
+ // // // Allow exact node match and boundary-safe prefix
7711
+ // // if (childPath === parentEffective) return true;
7712
+ // // const prefix = parentEffective.endsWith(separator)
7713
+ // // ? parentEffective
7714
+ // // : parentEffective + separator;
7715
+ // // return childPath.startsWith(prefix);
7716
+ // // }
7717
+ // default: {
7718
+ // const leaf = FieldCascadeUtil.getPathLeaf(parentEffective, separator);
7719
+ // return FieldCascadeUtil.containsLeafToken(childPath, leaf, separator);
7720
+ // }
7721
+ // }
7722
+ // }
7723
+ /**
7724
+ * Segment-safe "contains" match:
7725
+ * checks if parent segments appear contiguously anywhere in child segments
7726
+ */
7727
+ static containsPathSegments(childPath, parentPath, separator = '/') {
7728
+ const childSegs = FieldCascadeUtil.splitSegments(childPath, separator);
7729
+ const parentSegs = FieldCascadeUtil.splitSegments(parentPath, separator);
7730
+ if (parentSegs.length === 0 || childSegs.length === 0)
7731
+ return false;
7732
+ if (parentSegs.length > childSegs.length)
7733
+ return false;
7734
+ // sliding window
7735
+ for (let start = 0; start <= childSegs.length - parentSegs.length; start++) {
7736
+ let ok = true;
7737
+ for (let j = 0; j < parentSegs.length; j++) {
7738
+ if (childSegs[start + j] !== parentSegs[j]) {
7739
+ ok = false;
7740
+ break;
7741
+ }
7742
+ }
7743
+ if (ok)
7744
+ return true;
7745
+ }
7746
+ return false;
7747
+ }
7748
+ /** Split normalized path into non-empty segments */
7749
+ static splitSegments(path, separator = '/') {
7750
+ const p = FieldCascadeUtil.normalizePath(path, separator);
7751
+ if (!p)
7752
+ return [];
7753
+ return p
7754
+ .split(separator)
7755
+ .map((s) => s.trim())
7756
+ .filter(Boolean);
7757
+ }
7758
+ /**
7759
+ * Segment-safe "prefix" match:
7760
+ * - exact match OR child starts with parent + separator boundary
7761
+ */
7762
+ static startsWithPathSegments(childPath, parentPath, separator = '/') {
7763
+ const childSegs = FieldCascadeUtil.splitSegments(childPath, separator);
7764
+ const parentSegs = FieldCascadeUtil.splitSegments(parentPath, separator);
7765
+ if (parentSegs.length === 0 || childSegs.length === 0)
7766
+ return false;
7767
+ if (parentSegs.length > childSegs.length)
7768
+ return false;
7769
+ for (let i = 0; i < parentSegs.length; i++) {
7770
+ if (childSegs[i] !== parentSegs[i])
7771
+ return false;
7772
+ }
7773
+ return true;
7774
+ }
7775
+ /** Your requested method: no includes/contains; all segment-safe */
7695
7776
  static matchesChildToParent(childPathRaw, parentEffectiveRaw, mode, separator = '/') {
7696
7777
  const childPath = FieldCascadeUtil.normalizePath(childPathRaw, separator);
7697
7778
  const parentEffective = FieldCascadeUtil.normalizePath(parentEffectiveRaw, separator);
@@ -7699,15 +7780,15 @@ class FieldCascadeUtil {
7699
7780
  return false;
7700
7781
  switch (mode) {
7701
7782
  case ParentMatchMode.PREFIX: {
7702
- // Allow exact node match and boundary-safe prefix
7703
- if (childPath === parentEffective)
7704
- return true;
7705
- const prefix = parentEffective.endsWith(separator)
7706
- ? parentEffective
7707
- : parentEffective + separator;
7708
- return childPath.startsWith(prefix);
7783
+ // exact node match or boundary-safe prefix (segment-based)
7784
+ return FieldCascadeUtil.startsWithPathSegments(childPath, parentEffective, separator);
7785
+ }
7786
+ case ParentMatchMode.CONTAINS: {
7787
+ // boundary-safe contains (segment-based)
7788
+ return FieldCascadeUtil.containsPathSegments(childPath, parentEffective, separator);
7709
7789
  }
7710
7790
  default: {
7791
+ // your existing behavior: match by leaf token, but segment-safe
7711
7792
  const leaf = FieldCascadeUtil.getPathLeaf(parentEffective, separator);
7712
7793
  return FieldCascadeUtil.containsLeafToken(childPath, leaf, separator);
7713
7794
  }
@@ -7723,12 +7804,12 @@ class FieldCascadeUtil {
7723
7804
  if (!parentEffective)
7724
7805
  return true;
7725
7806
  if (merged.parentValueType === ParentValueType.CODE) {
7726
- return (FieldCascadeUtil.getPathLeaf(parentEffective, merged.optionPathSeparator)
7727
- .length === 0);
7807
+ return (FieldCascadeUtil.getPathLeaf(parentEffective, merged.optionPathSeparator).length === 0);
7728
7808
  }
7729
7809
  return false;
7730
7810
  }
7731
7811
  static filterChildOptionsByParentPath(childOptions, cascade, parentValue) {
7812
+ console.log('MERGE::: ', cascade);
7732
7813
  if (!cascade || cascade.kind !== CascadeKind.OPTIONS_PATH) {
7733
7814
  return (childOptions ?? []);
7734
7815
  }
@@ -7748,6 +7829,10 @@ class FieldCascadeUtil {
7748
7829
  const childPath = FieldCascadeUtil.getChildOptionPath(opt, pathField, sep);
7749
7830
  if (!childPath)
7750
7831
  continue;
7832
+ console.log('CHILDPATH::: ', childPath);
7833
+ console.log('PARENTEFFECTIVE::: ', parentEffective);
7834
+ console.log('MODE::: ', mode);
7835
+ console.log('SEP::: ', sep);
7751
7836
  if (FieldCascadeUtil.matchesChildToParent(childPath, parentEffective, mode, sep)) {
7752
7837
  out.push(opt);
7753
7838
  }
@@ -13073,5 +13158,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
13073
13158
  * Generated bundle index. Do not edit.
13074
13159
  */
13075
13160
 
13076
- export { Boolean$1 as Boolean, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, ButtonModule, CheckBox, D2FormModule, DEFAULT_KEYWORD_TO_LEVEL, DataTableUIComponent, DataTableUIModule, DateField, DateRangeValue, Dropdown, EventFormComponent, EventFormModule, FACILITY_KEYWORDS, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FlatFormComponent, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, GLOBAL_TYPE_RULES, HeaderBarComponent, HeaderBarModule, LOWERCASE_FACILITY_KEYWORDS, LevelMatchMode, LevelSelectorMode, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, ORG_UNIT_LEVEL_TO_KEYWORD, OrgUnitLevel, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ProgramEntryFormConfig, ProgramEntryFormMetaData, ProgramEntryFormModule, ProgramEntryFormSection, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, SelectionFiltersComponent, SelectionFiltersUiModule, TrackerFormComponent, TrackerFormModule, TranslationUtil };
13161
+ export { Boolean$1 as Boolean, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, ButtonModule, CascadeKind, CheckBox, D2FormModule, DEFAULT_KEYWORD_TO_LEVEL, DEFAULT_OPTIONS_PATH_CASCADE, DataTableUIComponent, DataTableUIModule, DateField, DateRangeValue, Dropdown, EventFormComponent, EventFormModule, FACILITY_KEYWORDS, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FlatFormComponent, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, GLOBAL_TYPE_RULES, HeaderBarComponent, HeaderBarModule, LOWERCASE_FACILITY_KEYWORDS, LevelMatchMode, LevelSelectorMode, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, ORG_UNIT_LEVEL_TO_KEYWORD, OptionPathField, OrgUnitLevel, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, ParentMatchMode, ParentValueType, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ProgramEntryFormConfig, ProgramEntryFormMetaData, ProgramEntryFormModule, ProgramEntryFormSection, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, SelectionFiltersComponent, SelectionFiltersUiModule, TrackerFormComponent, TrackerFormModule, TranslationUtil };
13077
13162
  //# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map