@plasmicpkgs/antd5 0.0.185 → 0.0.187

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.
package/dist/index.js CHANGED
@@ -2940,13 +2940,34 @@ var __objRest$d = (source, exclude) => {
2940
2940
  }
2941
2941
  return target;
2942
2942
  };
2943
+ function addKeysToUnkeyedMenuItems(unkeyedMenuItems, maybeGenKey) {
2944
+ const genKey = maybeGenKey != null ? maybeGenKey : (() => {
2945
+ let key = 0;
2946
+ return () => {
2947
+ return `${key++}`;
2948
+ };
2949
+ })();
2950
+ return unkeyedMenuItems == null ? void 0 : unkeyedMenuItems.map((item) => {
2951
+ if (!item) {
2952
+ return null;
2953
+ }
2954
+ const newItem = __spreadValues$i({}, item);
2955
+ if (!newItem.key) {
2956
+ newItem.key = genKey();
2957
+ }
2958
+ if ("children" in newItem && newItem.children) {
2959
+ newItem.children = addKeysToUnkeyedMenuItems(newItem.children, genKey);
2960
+ }
2961
+ return newItem;
2962
+ });
2963
+ }
2943
2964
  function AntdDropdown(props) {
2944
2965
  const _a = props, {
2945
2966
  children,
2946
2967
  onAction,
2947
2968
  menuItems,
2948
2969
  useMenuItemsSlot = false,
2949
- menuItemsJson,
2970
+ menuItemsJson: unkeyedMenuItems,
2950
2971
  trigger = "click",
2951
2972
  dropdownMenuScopeClassName
2952
2973
  } = _a, rest = __objRest$d(_a, [
@@ -2958,6 +2979,7 @@ function AntdDropdown(props) {
2958
2979
  "trigger",
2959
2980
  "dropdownMenuScopeClassName"
2960
2981
  ]);
2982
+ const keyedMenuItems = addKeysToUnkeyedMenuItems(unkeyedMenuItems);
2961
2983
  return /* @__PURE__ */ React__default.default.createElement(
2962
2984
  antd.Dropdown,
2963
2985
  __spreadProps$a(__spreadValues$i({}, rest), {
@@ -2965,7 +2987,7 @@ function AntdDropdown(props) {
2965
2987
  overlay: () => {
2966
2988
  var _a2;
2967
2989
  const itemsChildren = useMenuItemsSlot ? (_a2 = menuItems == null ? void 0 : menuItems()) != null ? _a2 : [] : void 0;
2968
- const items = useMenuItemsSlot ? void 0 : menuItemsJson;
2990
+ const items = useMenuItemsSlot ? void 0 : keyedMenuItems;
2969
2991
  return /* @__PURE__ */ React__default.default.createElement(
2970
2992
  antd.Menu,
2971
2993
  {