jedison 1.5.0 → 1.5.1

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.
@@ -3904,6 +3904,8 @@ class EditorObjectCategories extends EditorObject {
3904
3904
  const categoriesMap = /* @__PURE__ */ new Map();
3905
3905
  this.instance.children.forEach((child) => {
3906
3906
  if (!child.isActive) return;
3907
+ const hidden = getSchemaXOption(child.schema, "hidden");
3908
+ if (isSet(hidden) && hidden === true) return;
3907
3909
  const childSchemaType = getSchemaType(child.schema);
3908
3910
  const xCategory = getSchemaXOption(child.schema, "category");
3909
3911
  let categoryName;
@@ -3963,6 +3965,22 @@ class EditorObjectNav extends EditorObject {
3963
3965
  super.init();
3964
3966
  this.activeTabIndex = 0;
3965
3967
  }
3968
+ isChildVisible(child) {
3969
+ if (!child.isActive) return false;
3970
+ const hidden = getSchemaXOption(child.schema, "hidden");
3971
+ return !(isSet(hidden) && hidden === true);
3972
+ }
3973
+ getVisibleChildIndices() {
3974
+ return this.instance.children.reduce((indices, child, index2) => {
3975
+ if (this.isChildVisible(child)) indices.push(index2);
3976
+ return indices;
3977
+ }, []);
3978
+ }
3979
+ ensureActiveTabIsVisible(visibleIndices) {
3980
+ if (!visibleIndices.includes(this.activeTabIndex)) {
3981
+ this.activeTabIndex = visibleIndices[0] ?? 0;
3982
+ }
3983
+ }
3966
3984
  refreshEditors() {
3967
3985
  while (this.control.childrenSlot.firstChild) {
3968
3986
  this.control.childrenSlot.removeChild(this.control.childrenSlot.lastChild);
@@ -3984,31 +4002,32 @@ class EditorObjectNav extends EditorObject {
3984
4002
  row.appendChild(tabContentCol);
3985
4003
  tabListCol.appendChild(tabList);
3986
4004
  tabContentCol.appendChild(tabContent);
4005
+ const visibleIndices = this.getVisibleChildIndices();
4006
+ this.ensureActiveTabIsVisible(visibleIndices);
3987
4007
  this.instance.children.forEach((child, index2) => {
3988
- if (child.isActive) {
3989
- const active = index2 === this.activeTabIndex;
3990
- const id = pathToAttribute(child.path);
3991
- const schemaTitle = getSchemaTitle(child.schema);
3992
- const navWarning = getSchemaXOption(this.instance.schema, "navWarning") ?? true;
3993
- const navWarningMessage = getSchemaXOption(this.instance.schema, "navWarningMessage");
3994
- const tab = this.theme.getTab({
3995
- hasErrors: navWarning && child.hasNestedValidationErrors(),
3996
- navWarningMessage,
3997
- title: isSet(schemaTitle) ? schemaTitle : child.getKey(),
3998
- id,
3999
- active
4000
- });
4001
- tab.list.addEventListener("click", () => {
4002
- this.activeTabIndex = index2;
4003
- });
4004
- this.theme.setTabPaneAttributes(child.ui.control.container, active, id);
4005
- tabList.appendChild(tab.list);
4006
- tabContent.appendChild(child.ui.control.container);
4007
- if (this.disabled || this.instance.isReadOnly()) {
4008
- child.ui.disable();
4009
- } else {
4010
- child.ui.enable();
4011
- }
4008
+ if (!this.isChildVisible(child)) return;
4009
+ const active = index2 === this.activeTabIndex;
4010
+ const id = pathToAttribute(child.path);
4011
+ const schemaTitle = getSchemaTitle(child.schema);
4012
+ const navWarning = getSchemaXOption(this.instance.schema, "navWarning") ?? true;
4013
+ const navWarningMessage = getSchemaXOption(this.instance.schema, "navWarningMessage");
4014
+ const tab = this.theme.getTab({
4015
+ hasErrors: navWarning && child.hasNestedValidationErrors(),
4016
+ navWarningMessage,
4017
+ title: isSet(schemaTitle) ? schemaTitle : child.getKey(),
4018
+ id,
4019
+ active
4020
+ });
4021
+ tab.list.addEventListener("click", () => {
4022
+ this.activeTabIndex = index2;
4023
+ });
4024
+ this.theme.setTabPaneAttributes(child.ui.control.container, active, id);
4025
+ tabList.appendChild(tab.list);
4026
+ tabContent.appendChild(child.ui.control.container);
4027
+ if (this.disabled || this.instance.isReadOnly()) {
4028
+ child.ui.disable();
4029
+ } else {
4030
+ child.ui.enable();
4012
4031
  }
4013
4032
  });
4014
4033
  }