Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify disabled-conditions per side for directionalCombo #153

Open
tordans opened this issue Apr 29, 2024 · 1 comment
Open

Allow to specify disabled-conditions per side for directionalCombo #153

tordans opened this issue Apr 29, 2024 · 1 comment

Comments

@tordans
Copy link
Collaborator

tordans commented Apr 29, 2024

The directionalCombo field is great for centerline tagging.

However, for tags that are subtags of other tags, the left|right option should only be active when the given primary tag is present.

Can we maybe add fields to the directionalCombo that allow to disable sides (as in "visible but readonly" based on missing or existing tags?

Examples:

@tordans
Copy link
Collaborator Author

tordans commented May 1, 2024

How could we model this?

The closest we have are the prerequisiteTags and locationSet

Taking parking:both:orientation (id-tagging-schema) as an example. Goal: Have the parking:left:orientation disabled if parking:left==NULL|no|separate

(This issue is related to #137)

a. Add another top level property

"type": "directionalCombo",
// if field is visible 
// See https://github.com/ideditor/schema-builder/issues/137
// the tags array is an "OR" (as in "if any of those keys with matching values is present, allow the field)
"prerequisiteTags": [ 
    { "key": "parking:both", "valueNot": null },
    { "key": "parking:both", "valueNot": "no" }, 
    { "key": "parking:both", "valueNot": "separate" },
    { "key": "parking:left", "valueNot": null },
    { "key": "parking:left", "valueNot": "no" }, 
    { "key": "parking:left", "valueNot": "separate" },
    { "key": "parking:right", "valueNot": null },
    { "key": "parking:right", "valueNot": "no" }, 
    { "key": "parking:right", "valueNot": "separate" }
],
// if field is enabled/disabled
// handles sides separately because type is `directionalCombo`; we don't need to handle the `:both`-case because that is handled by `prerequisiteTags `
// the tags array is an "OR"
"enableTag": {
  left: [
    { "key": "parking:left", "valueNot": null },
    { "key": "parking:left", "valueNot": "no" }, 
    { "key": "parking:left", "valueNot": "separate" }
  ],
  right [
    { "key": "parking:right", "valueNot": null },
    { "key": "parking:right", "valueNot": "no" }, 
    { "key": "parking:right", "valueNot": "separate" }
  ],
},
"locationSet": {
    "include": ["US"],
    "exclude": ["PR", "VI"]
}

a. Redefined enableTag

"type": "directionalCombo",
"prerequisiteTag": {
  // if field is visible 
  // See https://github.com/ideditor/schema-builder/issues/137
  // the tags array is an "OR" (as in "if any of those keys with matching values is present, allow the field)
  "allowed": [ 
      { "key": "parking:both", "valueNot": null },
      { "key": "parking:both", "valueNot": "no" }, 
      { "key": "parking:both", "valueNot": "separate" },
      { "key": "parking:left", "valueNot": null },
      { "key": "parking:left", "valueNot": "no" }, 
      { "key": "parking:left", "valueNot": "separate" },
      { "key": "parking:right", "valueNot": null },
      { "key": "parking:right", "valueNot": "no" }, 
      { "key": "parking:right", "valueNot": "separate" }
  ],
  // if field is enabled/disabled
  // handles sides separately because type is `directionalCombo`; we don't need to handle the `:both`-case because that is handled by `prerequisiteTags `
  "enabled": {
    left: [
      { "key": "parking:left", "valueNot": null },
      { "key": "parking:left", "valueNot": "no" }, 
      { "key": "parking:left", "valueNot": "separate" }
    ],
    right [
      { "key": "parking:right", "valueNot": null },
      { "key": "parking:right", "valueNot": "no" }, 
      { "key": "parking:right", "valueNot": "separate" }
    ],
  },
},
"locationSet": {
    "include": ["US"],
    "exclude": ["PR", "VI"]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant