@uzum-tech/ui 1.12.16 → 1.12.18

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 (42) hide show
  1. package/dist/index.js +166 -31
  2. package/dist/index.prod.js +3 -3
  3. package/es/data-table/src/DataTable.d.ts +2 -0
  4. package/es/data-table/src/DataTable.js +1 -0
  5. package/es/data-table/src/TableParts/Body.d.ts +1 -0
  6. package/es/data-table/src/TableParts/Body.js +3 -2
  7. package/es/data-table/src/TableParts/Cell.d.ts +2 -0
  8. package/es/data-table/src/TableParts/Cell.js +62 -9
  9. package/es/data-table/src/interface.d.ts +2 -0
  10. package/es/data-table/src/interface.js +1 -1
  11. package/es/header/src/Header.d.ts +43 -12
  12. package/es/header/src/Header.js +32 -9
  13. package/es/header/src/HeaderNavigation.d.ts +19 -0
  14. package/es/header/src/HeaderNavigation.js +47 -12
  15. package/es/header/src/interface.d.ts +4 -2
  16. package/es/header/src/styles/index.cssr.js +2 -0
  17. package/es/header/src/utils.d.ts +1 -0
  18. package/es/header/src/utils.js +34 -0
  19. package/es/version.d.ts +1 -1
  20. package/es/version.js +1 -1
  21. package/lib/data-table/src/DataTable.d.ts +2 -0
  22. package/lib/data-table/src/DataTable.js +1 -0
  23. package/lib/data-table/src/TableParts/Body.d.ts +1 -0
  24. package/lib/data-table/src/TableParts/Body.js +3 -2
  25. package/lib/data-table/src/TableParts/Cell.d.ts +2 -0
  26. package/lib/data-table/src/TableParts/Cell.js +62 -9
  27. package/lib/data-table/src/interface.d.ts +2 -0
  28. package/lib/data-table/src/interface.js +1 -1
  29. package/lib/header/src/Header.d.ts +43 -12
  30. package/lib/header/src/Header.js +32 -9
  31. package/lib/header/src/HeaderNavigation.d.ts +19 -0
  32. package/lib/header/src/HeaderNavigation.js +45 -10
  33. package/lib/header/src/interface.d.ts +4 -2
  34. package/lib/header/src/styles/index.cssr.js +2 -0
  35. package/lib/header/src/utils.d.ts +1 -0
  36. package/lib/header/src/utils.js +35 -0
  37. package/lib/version.d.ts +1 -1
  38. package/lib/version.js +1 -1
  39. package/package.json +1 -1
  40. package/volar.d.ts +22 -22
  41. package/web-types.json +48 -33
  42. package/README.md +0 -73
package/dist/index.js CHANGED
@@ -63971,6 +63971,7 @@
63971
63971
  },
63972
63972
  scrollbarProps: Object,
63973
63973
  renderCell: Function,
63974
+ defaultEmptyValue: [String, Function],
63974
63975
  renderExpandIcon: Function,
63975
63976
  spinProps: {
63976
63977
  type: Object,
@@ -83477,7 +83478,8 @@
83477
83478
  type: Object,
83478
83479
  required: true
83479
83480
  },
83480
- renderCell: Function
83481
+ renderCell: Function,
83482
+ defaultEmptyValue: [String, Function]
83481
83483
  },
83482
83484
  render() {
83483
83485
  const { isSummary, column, row, renderCell } = this;
@@ -83488,12 +83490,25 @@
83488
83490
  const isEditable = typeof editable === "function" ? editable(row) : editable;
83489
83491
  if (render && !isSummary) {
83490
83492
  let cellValue = render(row, this.index);
83491
- if (mask && cellValue !== null && cellValue !== void 0) {
83492
- if (typeof cellValue === "string" || typeof cellValue === "number") {
83493
- cellValue = processMaskedValue(cellValue, mask);
83493
+ if (cellValue == null || cellValue === false) {
83494
+ const { defaultEmptyValue } = this;
83495
+ if (defaultEmptyValue !== void 0) {
83496
+ if (typeof defaultEmptyValue === "function") {
83497
+ cell = defaultEmptyValue();
83498
+ } else {
83499
+ cell = defaultEmptyValue;
83500
+ }
83501
+ } else {
83502
+ cell = "";
83503
+ }
83504
+ } else {
83505
+ if (mask && cellValue !== null && cellValue !== void 0) {
83506
+ if (typeof cellValue === "string" || typeof cellValue === "number") {
83507
+ cellValue = processMaskedValue(cellValue, mask);
83508
+ }
83494
83509
  }
83510
+ cell = cellValue;
83495
83511
  }
83496
- cell = cellValue;
83497
83512
  } else if (isEditable && !isSummary) {
83498
83513
  const { placeholder } = column;
83499
83514
  const rawValue = String(row[key] || "");
@@ -83603,16 +83618,42 @@
83603
83618
  if (mask && cellValue !== null && cellValue !== void 0) {
83604
83619
  cellValue = processMaskedValue(String(cellValue), mask);
83605
83620
  }
83606
- cell = String(cellValue);
83621
+ if (cellValue === null || cellValue === void 0 || cellValue === false) {
83622
+ const { defaultEmptyValue } = this;
83623
+ if (defaultEmptyValue !== void 0) {
83624
+ if (typeof defaultEmptyValue === "function") {
83625
+ cell = defaultEmptyValue();
83626
+ } else {
83627
+ cell = defaultEmptyValue;
83628
+ }
83629
+ } else {
83630
+ cell = "";
83631
+ }
83632
+ } else {
83633
+ cell = String(cellValue);
83634
+ }
83607
83635
  } else {
83608
83636
  let cellValue = renderCell ? renderCell(get(row, key), row, column) : get(row, key);
83609
83637
  if (cellValue && typeof cellValue === "object" && "type" in cellValue) {
83610
83638
  cell = cellValue;
83611
83639
  } else {
83612
- if (mask && cellValue !== null && cellValue !== void 0) {
83613
- cellValue = processMaskedValue(cellValue, mask);
83640
+ if (cellValue === null || cellValue === void 0 || cellValue === false) {
83641
+ const { defaultEmptyValue } = this;
83642
+ if (defaultEmptyValue !== void 0) {
83643
+ if (typeof defaultEmptyValue === "function") {
83644
+ cell = defaultEmptyValue();
83645
+ } else {
83646
+ cell = defaultEmptyValue;
83647
+ }
83648
+ } else {
83649
+ cell = "";
83650
+ }
83651
+ } else {
83652
+ if (mask && cellValue !== null && cellValue !== void 0) {
83653
+ cellValue = processMaskedValue(cellValue, mask);
83654
+ }
83655
+ cell = String(cellValue);
83614
83656
  }
83615
- cell = String(cellValue);
83616
83657
  }
83617
83658
  }
83618
83659
  }
@@ -83977,6 +84018,7 @@
83977
84018
  doCheck,
83978
84019
  doUncheck,
83979
84020
  renderCell,
84021
+ defaultEmptyValueRef,
83980
84022
  emptyPropsRef
83981
84023
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
83982
84024
  } = vue.inject(dataTableInjectionKey);
@@ -84252,6 +84294,7 @@
84252
84294
  handleRadioUpdateChecked,
84253
84295
  handleUpdateExpanded,
84254
84296
  renderCell,
84297
+ defaultEmptyValueRef,
84255
84298
  emptyPropsRef,
84256
84299
  ...exposedMethods
84257
84300
  };
@@ -84606,6 +84649,7 @@
84606
84649
  isSummary,
84607
84650
  mergedTheme: mergedTheme2,
84608
84651
  renderCell: this.renderCell,
84652
+ defaultEmptyValue: this.defaultEmptyValueRef,
84609
84653
  onEdit: (value, row2, key) => {
84610
84654
  this.$emit("edit", value, row2, key);
84611
84655
  }
@@ -86643,6 +86687,7 @@
86643
86687
  handleTableBodyScroll,
86644
86688
  setHeaderScrollLeft,
86645
86689
  renderCell: vue.toRef(props, "renderCell"),
86690
+ defaultEmptyValueRef: vue.toRef(props, "defaultEmptyValue"),
86646
86691
  emptyPropsRef: vue.toRef(props, "emptyProps"),
86647
86692
  handleEdit
86648
86693
  });
@@ -124706,6 +124751,8 @@
124706
124751
  cursor: not-allowed;
124707
124752
  pointer-events: none;
124708
124753
  opacity: .5;
124754
+ `), c$1("& .u-tabs-tab--checked", `
124755
+ color: var(--u-header-tab-text-color-active);
124709
124756
  `), c$1("& .u-tabs-tab:hover", `
124710
124757
  color: var(--u-header-tab-text-color-hover);
124711
124758
  `), c$1("& .u-tabs-bar", `
@@ -125248,6 +125295,33 @@
125248
125295
  function isLeafMenuOption(option) {
125249
125296
  return option.type !== "column";
125250
125297
  }
125298
+ function isMenuValueInChildren(children, value) {
125299
+ if (!children || children.length === 0) return false;
125300
+ for (const child of children) {
125301
+ if (isDividerOption(child)) continue;
125302
+ if (isColumnOption(child)) {
125303
+ if (isMenuValueInChildren(child.children, value)) return true;
125304
+ continue;
125305
+ }
125306
+ if (child.key === value) return true;
125307
+ if (isGroupOption(child) || hasChildren(child)) {
125308
+ if (isMenuValueInChildren(child.children, value)) return true;
125309
+ }
125310
+ }
125311
+ return false;
125312
+ }
125313
+ function resolveTopLevelMenuKey(menuOptions, activeMenuKey) {
125314
+ if (activeMenuKey === null || activeMenuKey === void 0) return null;
125315
+ for (let index = 0; index < menuOptions.length; index++) {
125316
+ const option = menuOptions[index];
125317
+ const optionKey = getMenuItemKey(option, index);
125318
+ if (optionKey === activeMenuKey) return optionKey;
125319
+ if (isMenuValueInChildren(option.children, activeMenuKey)) {
125320
+ return optionKey;
125321
+ }
125322
+ }
125323
+ return null;
125324
+ }
125251
125325
 
125252
125326
  const headerNavigationProps = {
125253
125327
  menuOptions: {
@@ -125283,8 +125357,13 @@
125283
125357
  type: String,
125284
125358
  required: true
125285
125359
  },
125360
+ activeMenuKey: {
125361
+ type: [String, Number],
125362
+ default: null
125363
+ },
125286
125364
  "onUpdate:menuValue": [Function, Array],
125287
- onUpdateMenuValue: [Function, Array]
125365
+ onUpdateMenuValue: [Function, Array],
125366
+ onUpdateActiveMenuKey: Function
125288
125367
  };
125289
125368
  var HeaderNavigation = vue.defineComponent({
125290
125369
  name: "HeaderNavigation",
@@ -125301,11 +125380,15 @@
125301
125380
  navRef.value = el;
125302
125381
  };
125303
125382
  const hoveredKeyRef = vue.ref(null);
125383
+ const activeMenuKeyRef = vue.toRef(props, "activeMenuKey");
125304
125384
  const tabRefs = vue.ref({});
125305
125385
  const indicatorStyleRef = vue.ref({
125306
125386
  width: "0px",
125307
125387
  transform: "translateX(0)"
125308
125388
  });
125389
+ const checkedTopMenuKey = vue.computed(() => {
125390
+ return resolveTopLevelMenuKey(props.menuOptions, activeMenuKeyRef.value) ?? void 0;
125391
+ });
125309
125392
  function updateIndicator() {
125310
125393
  const navEl = navRef.value;
125311
125394
  if (!navEl) return;
@@ -125338,6 +125421,15 @@
125338
125421
  if (onUpdateMenuValue) call(onUpdateMenuValue, value);
125339
125422
  if (_onUpdateMenuValue) call(_onUpdateMenuValue, value);
125340
125423
  }
125424
+ function setActiveMenuKey(key = null) {
125425
+ if (props.onUpdateActiveMenuKey) {
125426
+ props.onUpdateActiveMenuKey(key);
125427
+ }
125428
+ }
125429
+ function handleMenuItemClick(option) {
125430
+ setActiveMenuKey(option?.key);
125431
+ if (option.onClick) option?.onClick();
125432
+ }
125341
125433
  vue.onMounted(async () => {
125342
125434
  await vue.nextTick(updateIndicator);
125343
125435
  window.addEventListener("resize", updateIndicator);
@@ -125377,7 +125469,10 @@
125377
125469
  navRef,
125378
125470
  setTabRef,
125379
125471
  indicatorStyle: indicatorStyleRef,
125380
- hoveredKey: hoveredKeyRef
125472
+ hoveredKey: hoveredKeyRef,
125473
+ setActiveMenuKey,
125474
+ handleMenuItemClick,
125475
+ checkedTopMenuKey
125381
125476
  };
125382
125477
  },
125383
125478
  render() {
@@ -125409,7 +125504,10 @@
125409
125504
  ],
125410
125505
  role: "button",
125411
125506
  tabindex: option.disabled ? void 0 : 0,
125412
- onClick: option.onClick,
125507
+ onClick: (event) => {
125508
+ event.stopPropagation();
125509
+ this.handleMenuItemClick(option);
125510
+ },
125413
125511
  ...$props
125414
125512
  },
125415
125513
  /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-main` }, icon ? /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-icon` }, icon) : null, /* @__PURE__ */ vue.h("span", { class: `${blockClass}__menu-item-label` }, renderOptionLabel(option))),
@@ -125460,7 +125558,10 @@
125460
125558
  class: `${blockClass}__menu-column-title`,
125461
125559
  role: option.onClick ? "button" : void 0,
125462
125560
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125463
- onClick: option.onClick
125561
+ onClick: (event) => {
125562
+ event.stopPropagation();
125563
+ this.handleMenuItemClick(option);
125564
+ }
125464
125565
  },
125465
125566
  renderOptionLabel(option)
125466
125567
  ));
@@ -125477,7 +125578,10 @@
125477
125578
  class: `${blockClass}__menu-column-title`,
125478
125579
  role: option.onClick ? "button" : void 0,
125479
125580
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125480
- onClick: option.onClick
125581
+ onClick: (event) => {
125582
+ event.stopPropagation();
125583
+ this.handleMenuItemClick(option);
125584
+ }
125481
125585
  },
125482
125586
  renderOptionLabel(option)
125483
125587
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125488,7 +125592,10 @@
125488
125592
  class: `${blockClass}__menu-column-title`,
125489
125593
  role: option.onClick ? "button" : void 0,
125490
125594
  tabindex: option.onClick && !option.disabled ? 0 : void 0,
125491
- onClick: option.onClick
125595
+ onClick: (event) => {
125596
+ event.stopPropagation();
125597
+ this.handleMenuItemClick(option);
125598
+ }
125492
125599
  },
125493
125600
  renderOptionLabel(option)
125494
125601
  ), /* @__PURE__ */ vue.h("div", { class: `${blockClass}__menu-column-list` }, content));
@@ -125612,6 +125719,7 @@
125612
125719
  /* @__PURE__ */ vue.h("div", { class: "u-tabs-pad", style: { width: tabsPaddingValue } }),
125613
125720
  menuItems.map((item, index) => {
125614
125721
  const isActive = activeValue === item.key;
125722
+ const isChecked = this.checkedTopMenuKey === item.key;
125615
125723
  const isOpen = isHoverTrigger ? this.hoveredKey === item.key : isActive;
125616
125724
  const isDisabled = !!item.option.disabled;
125617
125725
  const icon = typeof item.option.icon === "function" ? item.option.icon() : item.option.icon;
@@ -125624,7 +125732,8 @@
125624
125732
  "u-tabs-tab",
125625
125733
  `${blockClass}__tab`,
125626
125734
  isActive && "u-tabs-tab--active",
125627
- isDisabled && "u-tabs-tab--disabled"
125735
+ isDisabled && "u-tabs-tab--disabled",
125736
+ isChecked && "u-tabs-tab--checked"
125628
125737
  ],
125629
125738
  ref: this.setTabRef(item.key),
125630
125739
  role: "tab",
@@ -125645,9 +125754,7 @@
125645
125754
  if (!isHoverTrigger) {
125646
125755
  emitUpdate(item.key);
125647
125756
  }
125648
- if (item.option.onClick) {
125649
- item.option.onClick();
125650
- }
125757
+ this.handleMenuItemClick(item.option);
125651
125758
  } : void 0
125652
125759
  },
125653
125760
  icon ? /* @__PURE__ */ vue.h("span", { class: `${blockClass}__tab-icon` }, icon) : null,
@@ -126492,7 +126599,9 @@
126492
126599
  type: Array,
126493
126600
  default: () => defaultLangOptions
126494
126601
  },
126495
- defaultLang: [String, Number],
126602
+ defaultLang: {
126603
+ type: [String, Number]
126604
+ },
126496
126605
  menuPlacement: {
126497
126606
  type: String,
126498
126607
  default: "horizontal"
@@ -126501,8 +126610,13 @@
126501
126610
  type: String,
126502
126611
  default: "hover"
126503
126612
  },
126504
- menuValue: [String, Number],
126505
- defaultMenuValue: [String, Number],
126613
+ menuValue: {
126614
+ type: [String, Number]
126615
+ },
126616
+ activeMenuKey: {
126617
+ type: [String, Number],
126618
+ default: null
126619
+ },
126506
126620
  menuTabsProps: {
126507
126621
  type: Object,
126508
126622
  default: () => ({})
@@ -126553,7 +126667,9 @@
126553
126667
  },
126554
126668
  onSearch: Function,
126555
126669
  "onUpdate:menuValue": [Function, Array],
126556
- onUpdateMenuValue: [Function, Array]
126670
+ onUpdateMenuValue: [Function, Array],
126671
+ "onUpdate:activeMenuKey": [Function, Array],
126672
+ onUpdateActiveMenuKey: [Function, Array]
126557
126673
  };
126558
126674
  var Header = vue.defineComponent({
126559
126675
  name: "Header",
@@ -126566,7 +126682,8 @@
126566
126682
  "language-select",
126567
126683
  "logo-click",
126568
126684
  "mobile-primary-action",
126569
- "mobile-secondary-action"
126685
+ "mobile-secondary-action",
126686
+ "update:activeMenuKey"
126570
126687
  ],
126571
126688
  setup(props, { emit }) {
126572
126689
  const { mergedClsPrefixRef } = useConfig(props);
@@ -126581,6 +126698,12 @@
126581
126698
  const isMobileRef = vue.toRef(props, "isMobile");
126582
126699
  const mobileMenuVisibleRef = vue.ref(false);
126583
126700
  const searchVisibleRef = vue.ref(false);
126701
+ const controlledActiveMenuKeyRef = vue.toRef(props, "activeMenuKey");
126702
+ const uncontrolledActiveMenuKeyRef = vue.ref(null);
126703
+ const mergedActiveMenuKeyRef = useMergedState(
126704
+ controlledActiveMenuKeyRef,
126705
+ uncontrolledActiveMenuKeyRef
126706
+ );
126584
126707
  vue.onBeforeMount(() => {
126585
126708
  headerMobileMenuStyle.mount({
126586
126709
  id: `${mergedClsPrefixRef.value}-header-mobile-menu`,
@@ -126603,9 +126726,7 @@
126603
126726
  props.langOptions?.find((opt) => opt.key === props.defaultLang) || props.langOptions?.[0] || defaultLangOptions[0]
126604
126727
  );
126605
126728
  const controlledMenuValueRef = vue.toRef(props, "menuValue");
126606
- const uncontrolledMenuValueRef = vue.ref(
126607
- props.defaultMenuValue ?? null
126608
- );
126729
+ const uncontrolledMenuValueRef = vue.ref(null);
126609
126730
  const mergedMenuValueRef = useMergedState(
126610
126731
  controlledMenuValueRef,
126611
126732
  uncontrolledMenuValueRef
@@ -126733,6 +126854,14 @@
126733
126854
  function handleLogoClick() {
126734
126855
  emit("logo-click");
126735
126856
  }
126857
+ function handleUpdateActiveMenuKey(value) {
126858
+ uncontrolledActiveMenuKeyRef.value = value;
126859
+ emit("update:activeMenuKey", value);
126860
+ const { onUpdateActiveMenuKey } = props;
126861
+ const { "onUpdate:activeMenuKey": _onUpdateActiveMenuKey } = props;
126862
+ if (onUpdateActiveMenuKey) call(onUpdateActiveMenuKey, value);
126863
+ if (_onUpdateActiveMenuKey) call(_onUpdateActiveMenuKey, value);
126864
+ }
126736
126865
  return {
126737
126866
  mergedClsPrefix: mergedClsPrefixRef,
126738
126867
  cssVars: cssVarsRef,
@@ -126743,6 +126872,9 @@
126743
126872
  isMobile: isMobileRef,
126744
126873
  mobileMenuVisible: mobileMenuVisibleRef,
126745
126874
  searchVisible: searchVisibleRef,
126875
+ menuPaneClass,
126876
+ menuPaneWrapperClass,
126877
+ mergedActiveMenuKey: mergedActiveMenuKeyRef,
126746
126878
  handleSelectLang,
126747
126879
  handleMenuValueUpdate,
126748
126880
  handleSearchClick,
@@ -126757,8 +126889,7 @@
126757
126889
  handleMobileMenuItemClick,
126758
126890
  handleMobilePrimaryAction,
126759
126891
  handleMobileSecondaryAction,
126760
- menuPaneClass,
126761
- menuPaneWrapperClass,
126892
+ handleUpdateActiveMenuKey,
126762
126893
  onRender: themeClassHandle?.onRender
126763
126894
  };
126764
126895
  },
@@ -126805,7 +126936,9 @@
126805
126936
  mergedClsPrefix,
126806
126937
  menuPaneClass: this.menuPaneClass,
126807
126938
  menuPaneWrapperClass: this.menuPaneWrapperClass,
126808
- onUpdateMenuValue: this.handleMenuValueUpdate
126939
+ activeMenuKey: this.mergedActiveMenuKey,
126940
+ onUpdateMenuValue: this.handleMenuValueUpdate,
126941
+ onUpdateActiveMenuKey: this.handleUpdateActiveMenuKey
126809
126942
  }
126810
126943
  );
126811
126944
  const mobileNode = this.responsive && this.isMobile ? /* @__PURE__ */ vue.h(
@@ -128552,6 +128685,7 @@
128552
128685
  renderBadge: renderBadge,
128553
128686
  renderOptionLabel: renderOptionLabel,
128554
128687
  resolvePlacement: resolvePlacement,
128688
+ resolveTopLevelMenuKey: resolveTopLevelMenuKey,
128555
128689
  resultProps: resultProps,
128556
128690
  rowProps: rowProps,
128557
128691
  safeTopScrollbarProps: safeTopScrollbarProps,
@@ -128593,7 +128727,7 @@
128593
128727
  watermarkProps: watermarkProps
128594
128728
  });
128595
128729
 
128596
- var version = "1.12.16";
128730
+ var version = "1.12.18";
128597
128731
 
128598
128732
  function useExposeProxy(targetRef) {
128599
128733
  return new Proxy({}, {
@@ -129843,6 +129977,7 @@
129843
129977
  exports.renderBadge = renderBadge;
129844
129978
  exports.renderOptionLabel = renderOptionLabel;
129845
129979
  exports.resolvePlacement = resolvePlacement;
129980
+ exports.resolveTopLevelMenuKey = resolveTopLevelMenuKey;
129846
129981
  exports.resultDark = resultDark;
129847
129982
  exports.resultProps = resultProps;
129848
129983
  exports.rowProps = rowProps;