@gravity-ui/dashkit 9.2.1-beta → 9.3.0

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 (38) hide show
  1. package/README.md +1 -1
  2. package/build/cjs/components/DashKit/DashKit.d.ts +1 -1
  3. package/build/cjs/components/GridLayout/GridLayout.d.ts +65 -51
  4. package/build/cjs/components/GridLayout/GridLayout.js +17 -60
  5. package/build/cjs/components/GridLayout/GridLayout.js.map +1 -1
  6. package/build/cjs/components/MobileLayout/MobileLayout.d.ts +4 -4
  7. package/build/cjs/components/MobileLayout/MobileLayout.js.map +1 -1
  8. package/build/cjs/components/OverlayControls/OverlayControls.d.ts +2 -0
  9. package/build/cjs/components/OverlayControls/OverlayControls.js +4 -3
  10. package/build/cjs/components/OverlayControls/OverlayControls.js.map +1 -1
  11. package/build/cjs/context/DashKitContext.d.ts +6 -14
  12. package/build/cjs/context/DashKitContext.js.map +1 -1
  13. package/build/cjs/typings/config.d.ts +2 -2
  14. package/build/cjs/typings/config.js.map +1 -1
  15. package/build/cjs/typings/plugin.d.ts +0 -1
  16. package/build/cjs/typings/plugin.js.map +1 -1
  17. package/build/esm/components/DashKit/DashKit.d.ts +1 -1
  18. package/build/esm/components/GridLayout/GridLayout.d.ts +65 -51
  19. package/build/esm/components/GridLayout/GridLayout.js +17 -60
  20. package/build/esm/components/GridLayout/GridLayout.js.map +1 -1
  21. package/build/esm/components/MobileLayout/MobileLayout.d.ts +4 -4
  22. package/build/esm/components/MobileLayout/MobileLayout.js.map +1 -1
  23. package/build/esm/components/OverlayControls/OverlayControls.d.ts +2 -0
  24. package/build/esm/components/OverlayControls/OverlayControls.js +4 -3
  25. package/build/esm/components/OverlayControls/OverlayControls.js.map +1 -1
  26. package/build/esm/context/DashKitContext.d.ts +6 -14
  27. package/build/esm/context/DashKitContext.js.map +1 -1
  28. package/build/esm/typings/config.d.ts +2 -2
  29. package/build/esm/typings/config.js.map +1 -1
  30. package/build/esm/typings/plugin.d.ts +0 -1
  31. package/build/esm/typings/plugin.js.map +1 -1
  32. package/package.json +1 -1
  33. package/build/cjs/components/GridLayout/types.d.ts +0 -60
  34. package/build/cjs/components/GridLayout/types.js +0 -3
  35. package/build/cjs/components/GridLayout/types.js.map +0 -1
  36. package/build/esm/components/GridLayout/types.d.ts +0 -60
  37. package/build/esm/components/GridLayout/types.js +0 -2
  38. package/build/esm/components/GridLayout/types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MobileLayout.js","sourceRoot":"../../../../src","sources":["components/MobileLayout/MobileLayout.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAE1B,wEAAqC;AAIrC,wDAA8C;AAC9C,oDAA6C;AAC7C,0CAAkC;AAClC,mEAAgC;AAEhC,0CAA+C;AAE/C,8BAA6B;AAE7B,MAAM,CAAC,GAAG,IAAA,OAAE,EAAC,uBAAuB,CAAC,CAAC;AAQtC,MAAqB,YAAa,SAAQ,eAAK,CAAC,aAG/C;IAHD;;QAOI,gBAAW,GAAgB,EAAE,CAAC;QAC9B,sBAAiB,GAAmE,IAAI,CAAC;QAEzF,gBAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAClC,4BAAuB,GAA0C,EAAE,CAAC;QACpE,4BAAuB,GAA+D,EAAE,CAAC;QAEzF,UAAK,GAAsB;YACvB,yBAAyB,EAAE,EAAE;SAChC,CAAC;IAuHN,CAAC;IArHG,MAAM;QACF,MAAM,EACF,MAAM,EACN,MAAM,EACN,MAAM,GAAG,CAAC,EAAC,EAAE,EAAE,yBAAa,EAAC,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,WAAW,GACd,GAAG,IAAI,CAAC,OAAO,CAAC;QAEjB,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAE7C,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChD,IAAI,WAAW,GAAG,CAAC,CAAC;QAEpB,OA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AAkC,CAAC,EAAE,CAAC,CAAC;YAE9C,IAAI,CAAC,QAAQ,CAAC,EAAC,yBAAyB,EAAE,kCAAkC,EAAC,CAAC,CAAC;QACnF,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,QAAQ,CAAC;gBACV,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE;oBAC/E,CAAC,EAAE,CAAC,EAAE,IAAI;iBACb,CAAC;aACL,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,yBAAyB,CAAC,EAAU;QAChC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;;AAlIM,wBAAW,GAAG,wBAAc,AAAjB,CAAkB;kBAJnB,YAAY","sourcesContent":["import React from 'react';\n\nimport groupBy from 'lodash/groupBy';\n\nimport type {PluginRef} from 'src/typings';\n\nimport {DEFAULT_GROUP} from '../../constants';\nimport {DashKitContext} from '../../context';\nimport {cn} from '../../utils/cn';\nimport Item from '../Item/Item';\n\nimport {getSortedConfigItems} from './helpers';\n\nimport './MobileLayout.scss';\n\nconst b = cn('dashkit-mobile-layout');\n\ntype MobileLayoutProps = {};\n\ntype MobileLayoutState = {\n itemsWithActiveAutoheight: Record<string, boolean>;\n};\n\nexport default class MobileLayout extends React.PureComponent<\n MobileLayoutProps,\n MobileLayoutState\n> {\n static contextType = DashKitContext;\n context!: React.ContextType<typeof DashKitContext>;\n\n pluginsRefs: PluginRef[] = [];\n sortedLayoutItems: Record<string, ReturnType<typeof getSortedConfigItems>> | null = null;\n\n _memoLayout = this.context.layout;\n _memoForwardedPluginRef: Array<(refObject: PluginRef) => void> = [];\n _memoAdjustWidgetLayout: Record<string, (props: {needSetDefault: boolean}) => void> = {};\n\n state: MobileLayoutState = {\n itemsWithActiveAutoheight: {},\n };\n\n render() {\n const {\n config,\n layout,\n groups = [{id: DEFAULT_GROUP}],\n context,\n editMode,\n configItems,\n } = this.context;\n\n this.pluginsRefs.length = configItems.length;\n\n const sortedItems = this.getSortedLayoutItems();\n let indexOffset = 0;\n\n return (\n <div className={b()}>\n {groups.map((group) => {\n const groupId = group.id || DEFAULT_GROUP;\n const items = sortedItems[groupId] || [];\n\n const children = items.map((item, index) => {\n const isItemWithActiveAutoheight =\n item.id in this.state.itemsWithActiveAutoheight;\n\n return (\n <div\n className={b('item', {autoheight: isItemWithActiveAutoheight})}\n key={item.id}\n >\n <Item\n id={item.id}\n item={item}\n layout={layout}\n shouldItemUpdate={false}\n adjustWidgetLayout={this.getMemoAdjustWidgetLayout(item.id)}\n forwardedPluginRef={this.getMemoForwardRefCallback(\n indexOffset + index,\n )}\n onItemMountChange={this.context.onItemMountChange}\n onItemRender={this.context.onItemRender}\n />\n </div>\n );\n });\n\n indexOffset += items.length;\n\n if (group.render) {\n return group.render(groupId, children, {\n isMobile: true,\n config,\n context,\n editMode,\n items,\n layout,\n });\n }\n\n return children;\n })}\n </div>\n );\n }\n\n getSortedLayoutItems() {\n if (this.sortedLayoutItems && this.context.layout === this._memoLayout) {\n return this.sortedLayoutItems;\n }\n\n this._memoLayout = this.context.layout;\n\n const hasOrderId = Boolean(this.context.configItems.find((item) => item.orderId));\n\n this.sortedLayoutItems = groupBy(\n getSortedConfigItems(this.context.config, this.context.configItems, hasOrderId),\n (item) => item.parent || DEFAULT_GROUP,\n );\n\n return this.sortedLayoutItems;\n }\n\n getMemoForwardRefCallback(refIndex: number) {\n if (!this._memoForwardedPluginRef[refIndex]) {\n this._memoForwardedPluginRef[refIndex] = (pluginRef: PluginRef) => {\n this.pluginsRefs[refIndex] = pluginRef;\n };\n }\n\n return this._memoForwardedPluginRef[refIndex];\n }\n\n adjustWidgetLayout(id: string, {needSetDefault}: {needSetDefault: boolean}) {\n if (needSetDefault) {\n const indexesOfItemsWithActiveAutoheight = {\n ...this.state.itemsWithActiveAutoheight,\n };\n\n delete indexesOfItemsWithActiveAutoheight[id];\n\n this.setState({itemsWithActiveAutoheight: indexesOfItemsWithActiveAutoheight});\n } else {\n this.setState({\n itemsWithActiveAutoheight: Object.assign({}, this.state.itemsWithActiveAutoheight, {\n [id]: true,\n }),\n });\n }\n }\n\n getMemoAdjustWidgetLayout(id: string) {\n if (!this._memoAdjustWidgetLayout[id]) {\n this._memoAdjustWidgetLayout[id] = this.adjustWidgetLayout.bind(this, id);\n }\n\n return this._memoAdjustWidgetLayout[id];\n }\n}\n"]}
1
+ {"version":3,"file":"MobileLayout.js","sourceRoot":"../../../../src","sources":["components/MobileLayout/MobileLayout.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAE1B,wEAAqC;AAErC,wDAA8C;AAC9C,oDAA6C;AAC7C,0CAAkC;AAClC,mEAAgC;AAEhC,0CAA+C;AAE/C,8BAA6B;AAE7B,MAAM,CAAC,GAAG,IAAA,OAAE,EAAC,uBAAuB,CAAC,CAAC;AAUtC,MAAqB,YAAa,SAAQ,eAAK,CAAC,aAG/C;IAHD;;QAOI,gBAAW,GAAsB,EAAE,CAAC;QACpC,sBAAiB,GAAmE,IAAI,CAAC;QAEzF,gBAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAClC,4BAAuB,GAAgD,EAAE,CAAC;QAC1E,4BAAuB,GAA+D,EAAE,CAAC;QAEzF,UAAK,GAAsB;YACvB,yBAAyB,EAAE,EAAE;SAChC,CAAC;IAuHN,CAAC;IArHG,MAAM;QACF,MAAM,EACF,MAAM,EACN,MAAM,EACN,MAAM,GAAG,CAAC,EAAC,EAAE,EAAE,yBAAa,EAAC,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,WAAW,GACd,GAAG,IAAI,CAAC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C;IAClD,CAAC;IAED,kBAAkB,CAAC,EAAU,EAAE,EAAC,cAAc,EAA4B;QACtE,IAAI,cAAc,EAAE,CAAC;YACjB,MAAM,kCAAkC,qBACjC,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAC1C,CAAC;YAEF,OAAO,kCAAkC,CAAC,EAAE,CAAC,CAAC;YAE9C,IAAI,CAAC,QAAQ,CAAC,EAAC,yBAAyB,EAAE,kCAAkC,EAAC,CAAC,CAAC;QACnF,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,QAAQ,CAAC;gBACV,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE;oBAC/E,CAAC,EAAE,CAAC,EAAE,IAAI;iBACb,CAAC;aACL,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,yBAAyB,CAAC,EAAU;QAChC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;;AAlIM,wBAAW,GAAG,wBAAc,AAAjB,CAAkB;kBAJnB,YAAY","sourcesContent":["import React from 'react';\n\nimport groupBy from 'lodash/groupBy';\n\nimport {DEFAULT_GROUP} from '../../constants';\nimport {DashKitContext} from '../../context';\nimport {cn} from '../../utils/cn';\nimport Item from '../Item/Item';\n\nimport {getSortedConfigItems} from './helpers';\n\nimport './MobileLayout.scss';\n\nconst b = cn('dashkit-mobile-layout');\n\ntype MobileLayoutProps = {};\n\ntype MobileLayoutState = {\n itemsWithActiveAutoheight: Record<string, boolean>;\n};\n\ntype PlugibRefObject = React.RefObject<any>;\n\nexport default class MobileLayout extends React.PureComponent<\n MobileLayoutProps,\n MobileLayoutState\n> {\n static contextType = DashKitContext;\n context!: React.ContextType<typeof DashKitContext>;\n\n pluginsRefs: PlugibRefObject[] = [];\n sortedLayoutItems: Record<string, ReturnType<typeof getSortedConfigItems>> | null = null;\n\n _memoLayout = this.context.layout;\n _memoForwardedPluginRef: Array<(refObject: PlugibRefObject) => void> = [];\n _memoAdjustWidgetLayout: Record<string, (props: {needSetDefault: boolean}) => void> = {};\n\n state: MobileLayoutState = {\n itemsWithActiveAutoheight: {},\n };\n\n render() {\n const {\n config,\n layout,\n groups = [{id: DEFAULT_GROUP}],\n context,\n editMode,\n configItems,\n } = this.context;\n\n this.pluginsRefs.length = configItems.length;\n\n const sortedItems = this.getSortedLayoutItems();\n let indexOffset = 0;\n\n return (\n <div className={b()}>\n {groups.map((group) => {\n const groupId = group.id || DEFAULT_GROUP;\n const items = sortedItems[groupId] || [];\n\n const children = items.map((item, index) => {\n const isItemWithActiveAutoheight =\n item.id in this.state.itemsWithActiveAutoheight;\n\n return (\n <div\n className={b('item', {autoheight: isItemWithActiveAutoheight})}\n key={item.id}\n >\n <Item\n id={item.id}\n item={item}\n layout={layout}\n shouldItemUpdate={false}\n adjustWidgetLayout={this.getMemoAdjustWidgetLayout(item.id)}\n forwardedPluginRef={this.getMemoForwardRefCallback(\n indexOffset + index,\n )}\n onItemMountChange={this.context.onItemMountChange}\n onItemRender={this.context.onItemRender}\n />\n </div>\n );\n });\n\n indexOffset += items.length;\n\n if (group.render) {\n return group.render(groupId, children, {\n isMobile: true,\n config,\n context,\n editMode,\n items,\n layout,\n });\n }\n\n return children;\n })}\n </div>\n );\n }\n\n getSortedLayoutItems() {\n if (this.sortedLayoutItems && this.context.layout === this._memoLayout) {\n return this.sortedLayoutItems;\n }\n\n this._memoLayout = this.context.layout;\n\n const hasOrderId = Boolean(this.context.configItems.find((item) => item.orderId));\n\n this.sortedLayoutItems = groupBy(\n getSortedConfigItems(this.context.config, this.context.configItems, hasOrderId),\n (item) => item.parent || DEFAULT_GROUP,\n );\n\n return this.sortedLayoutItems;\n }\n\n getMemoForwardRefCallback(refIndex: number) {\n if (!this._memoForwardedPluginRef[refIndex]) {\n this._memoForwardedPluginRef[refIndex] = (pluginRef: PlugibRefObject) => {\n this.pluginsRefs[refIndex] = pluginRef;\n };\n }\n\n return this._memoForwardedPluginRef[refIndex];\n }\n\n adjustWidgetLayout(id: string, {needSetDefault}: {needSetDefault: boolean}) {\n if (needSetDefault) {\n const indexesOfItemsWithActiveAutoheight = {\n ...this.state.itemsWithActiveAutoheight,\n };\n\n delete indexesOfItemsWithActiveAutoheight[id];\n\n this.setState({itemsWithActiveAutoheight: indexesOfItemsWithActiveAutoheight});\n } else {\n this.setState({\n itemsWithActiveAutoheight: Object.assign({}, this.state.itemsWithActiveAutoheight, {\n [id]: true,\n }),\n });\n }\n }\n\n getMemoAdjustWidgetLayout(id: string) {\n if (!this._memoAdjustWidgetLayout[id]) {\n this._memoAdjustWidgetLayout[id] = this.adjustWidgetLayout.bind(this, id);\n }\n\n return this._memoAdjustWidgetLayout[id];\n }\n}\n"]}
@@ -12,6 +12,7 @@ export declare enum OverlayControlsPosition {
12
12
  export interface OverlayControlItem {
13
13
  title?: string;
14
14
  icon?: IconProps['data'];
15
+ renderIcon?: (item: ConfigItem) => IconProps['data'];
15
16
  iconSize?: number | string;
16
17
  handler?: (item: ConfigItem) => void;
17
18
  visible?: (item: ConfigItem) => boolean;
@@ -19,6 +20,7 @@ export interface OverlayControlItem {
19
20
  excludeWidgetsTypes?: Array<PluginBase['type']>;
20
21
  id?: string;
21
22
  qa?: string;
23
+ className?: string;
22
24
  }
23
25
  export interface OverlayCustomControlItem {
24
26
  id: string;
@@ -40,13 +40,14 @@ class OverlayControls extends react_1.default.Component {
40
40
  };
41
41
  this.renderControlsItem = (item, index, length) => {
42
42
  const { view, size, onItemClick } = this.props;
43
- const { title, handler, icon, iconSize, qa } = item;
43
+ const { title, handler, icon, renderIcon, iconSize, qa, className } = item;
44
+ const iconData = renderIcon ? renderIcon(this.props.configItem) : icon;
44
45
  const onItemClickHandler = typeof handler === 'function' ? handler : noop_1.default;
45
46
  return (react_1.default.createElement(uikit_1.Button, { key: `control_${index}`, view: view, size: size, title: title, pin: this.getControlItemPinStyle(index, length), onClick: () => {
46
47
  onItemClickHandler(this.props.configItem);
47
48
  onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick();
48
- }, qa: qa },
49
- react_1.default.createElement(uikit_1.Icon, { data: icon || icons_1.Gear, size: icon ? iconSize : constants_1.OVERLAY_ICON_SIZE })));
49
+ }, className: className, qa: qa },
50
+ react_1.default.createElement(uikit_1.Icon, { data: iconData || icons_1.Gear, size: icon ? iconSize : constants_1.OVERLAY_ICON_SIZE })));
50
51
  };
51
52
  this.getDefaultControls = () => {
52
53
  const { view, size } = this.props;
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayControls.js","sourceRoot":"../../../../src","sources":["components/OverlayControls/OverlayControls.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,6CAAwD;AACxD,6CAS2B;AAC3B,kEAA+B;AAE/B,wDAMyB;AACzB,oDAAoF;AACpF,8CAAgC;AAChC,kDAOsB;AAEtB,0CAAkC;AAElC,iCAAgC;AAEhC,MAAM,CAAC,GAAG,IAAA,OAAE,EAAC,uCAA2B,CAAC,CAAC;AAE1C,IAAY,uBAKX;AALD,WAAY,uBAAuB;IAC/B,iDAAsB,CAAA;IACtB,+CAAoB,CAAA;IACpB,uDAA4B,CAAA;IAC5B,qDAA0B,CAAA;AAC9B,CAAC,EALW,uBAAuB,uCAAvB,uBAAuB,QAKlC;AAoDD,MAAM,qBAAqB,GAAG,CAAC,qBAAS,CAAC,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,eAAgB,SAAQ,eAAK,CAAC,SAA+B;IAAnE;;QASI,UAAK,GAAG;YACJ,iBAAiB,EAAE,EAAwB;SAC9C,CAAC;QA4CM,4BAAuB,GAAG,GAAG,EAA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ChB,OAAO,aAAa,CAAC;QACzB,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YACd,OAAO,aAAa,CAAC;QACzB,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACb,OAAO,aAAa,CAAC;QACzB,CAAC;QAED,OAAO,aAAa,CAAC;IACzB,CAAC;IACO,4BAA4B;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CACpB,CAAC,IAAwB,EAAE,KAAa,EAAE,YAAkC,EAAE,EAAE,CAC5E,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAChE,CAAC;QACF,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;QAEzC,2DAA2D;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QAE5C,OAAO,MAAM,CAAC;IAClB,CAAC;;AAjaM,2BAAW,GAAG,sCAA4B,AAA/B,CAAgC;AAC3C,4BAAY,GAAgC;IAC/C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;IAC1C,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,GAAG;CACZ,AAJkB,CAIjB;AA+ZN,kBAAe,eAAe,CAAC","sourcesContent":["import React from 'react';\n\nimport {Ellipsis, Gear, Xmark} from '@gravity-ui/icons';\nimport {\n Button,\n ButtonSize,\n ButtonView,\n DropdownMenu,\n DropdownMenuItem,\n Icon,\n IconProps,\n MenuItemProps,\n} from '@gravity-ui/uikit';\nimport noop from 'lodash/noop';\n\nimport {\n COPIED_WIDGET_STORE_KEY,\n DRAGGABLE_CANCEL_CLASS_NAME,\n MenuItems,\n OVERLAY_CONTROLS_CLASS_NAME,\n OVERLAY_ICON_SIZE,\n} from '../../constants';\nimport {DashkitOvelayControlsContext, OverlayControlsCtxShape} from '../../context';\nimport {i18n} from '../../i18n';\nimport {\n type ConfigItem,\n type ItemParams,\n type ItemState,\n type PluginBase,\n isItemWithTabs,\n resolveItemInnerId,\n} from '../../shared';\nimport {MenuItem, Settings} from '../../typings';\nimport {cn} from '../../utils/cn';\n\nimport './OverlayControls.scss';\n\nconst b = cn(OVERLAY_CONTROLS_CLASS_NAME);\n\nexport enum OverlayControlsPosition {\n TopRight = 'top_right',\n TopLeft = 'top_left',\n BottomRight = 'bottom_right',\n BottomLeft = 'bottom_left',\n}\n\nexport interface OverlayControlItem {\n title?: string;\n icon?: IconProps['data'];\n iconSize?: number | string;\n handler?: (item: ConfigItem) => void;\n visible?: (item: ConfigItem) => boolean;\n allWidgetsControls?: boolean; // флаг кастомного контрола (без кастомного виджета), которые показываются не в списке меню\n excludeWidgetsTypes?: Array<PluginBase['type']>; // массив с типами виджетов (плагинов), которые исключаем из отображения контрола по настройке allWidgetsControls\n id?: string; // id дефолтного пункта меню для возможноти использования дефолтного action в кастомных контролах\n qa?: string;\n}\n\nexport interface OverlayCustomControlItem {\n id: string;\n title?: string;\n icon?: MenuItemProps['iconStart'];\n iconSize?: number | string;\n handler?: (item: ConfigItem, params: ItemParams, state: ItemState) => void;\n visible?: (item: ConfigItem) => boolean;\n className?: string;\n qa?: string;\n}\n\ninterface OverlayControlsDefaultProps {\n position: OverlayControlsPosition;\n view: ButtonView;\n size: ButtonSize;\n}\n\ninterface OverlayControlsProps extends OverlayControlsDefaultProps {\n configItem: ConfigItem;\n onItemClick?: () => void | null;\n}\n\ntype PreparedCopyItemOptionsArg = Pick<ConfigItem, 'data' | 'type' | 'defaults' | 'namespace'> & {\n timestamp: number;\n layout: {\n w: number;\n h: number;\n };\n targetId?: string;\n targetInnerId?: string;\n};\n\nexport type PreparedCopyItemOptions<C extends object = {}> = PreparedCopyItemOptionsArg & {\n copyContext?: C;\n};\n\ntype OverlayControlsCtx = React.Context<OverlayControlsCtxShape>;\n\nconst DEFAULT_DROPDOWN_MENU = [MenuItems.Copy, MenuItems.Delete];\n\nclass OverlayControls extends React.Component<OverlayControlsProps> {\n static contextType = DashkitOvelayControlsContext;\n static defaultProps: OverlayControlsDefaultProps = {\n position: OverlayControlsPosition.TopRight,\n view: 'flat',\n size: 'm',\n };\n context!: React.ContextType<OverlayControlsCtx>;\n\n state = {\n dropdownMenuItems: [] as DropdownMenuItem[],\n };\n\n componentDidMount() {\n this.updateDropdownMenuItems();\n }\n\n componentDidUpdate() {\n this.updateDropdownMenuItems();\n }\n\n render() {\n const {position} = this.props;\n const items = this.getItems();\n const hasCustomControlsWithWidgets = items.length > 0;\n\n const controls = hasCustomControlsWithWidgets\n ? this.getCustomControlsWithWidgets()\n : this.renderControls();\n\n return <div className={b({position}, [DRAGGABLE_CANCEL_CLASS_NAME])}>{controls}</div>;\n }\n\n private shallowEqualDropdownMenu(menuA: DropdownMenuItem[], menuB: DropdownMenuItem[]) {\n return (\n menuA.length === menuB.length &&\n menuA.every((itemA, index) => {\n const itemB = menuB[index];\n\n if (!itemB) {\n return false;\n }\n\n return Object.entries(itemA).every(\n ([key, value]) =>\n /**\n * field 'action' is new every time\n * @see {@link https://github.com/gravity-ui/dashkit/pull/267/commits/c6378b67c5fea07902a49ccce8118760a4ad2df0#diff-aa6a22e5a09a09ccc3f8f937d4ef6aaff97afc57da1b370f0120f0e225f7b061L297}\n */\n key === 'action' || itemB[key as keyof DropdownMenuItem] === value,\n );\n })\n );\n }\n\n private updateDropdownMenuItems = () => {\n const items = this.getDropdownMenuItems();\n if (!this.shallowEqualDropdownMenu(items, this.state.dropdownMenuItems)) {\n this.setState({dropdownMenuItems: items});\n }\n };\n\n private getItems = () => {\n const {overlayControls} = this.context;\n const {configItem} = this.props;\n\n return (overlayControls && overlayControls[configItem.type]) || [];\n };\n\n private renderControlsItem = (item: OverlayControlItem, index: number, length: number) => {\n const {view, size, onItemClick} = this.props;\n const {title, handler, icon, iconSize, qa} = item;\n\n const onItemClickHandler = typeof handler === 'function' ? handler : noop;\n return (\n <Button\n key={`control_${index}`}\n view={view}\n size={size}\n title={title}\n pin={this.getControlItemPinStyle(index, length)}\n onClick={() => {\n onItemClickHandler(this.props.configItem);\n onItemClick?.();\n }}\n qa={qa}\n >\n <Icon data={icon || Gear} size={icon ? iconSize : OVERLAY_ICON_SIZE} />\n </Button>\n );\n };\n\n private getDropDownMenuItemConfig(menuName: string, isDefaultMenu?: boolean) {\n switch (menuName) {\n case MenuItems.Copy: {\n return {\n action: this.onCopyItem,\n text: i18n('label_copy'),\n };\n }\n case MenuItems.Delete: {\n return {\n action: this.onRemoveItem,\n text: i18n('label_delete'),\n };\n }\n case MenuItems.Settings: {\n // для дефолтного состояния меню нет настройки settings, а для кастомного можно использовать дефолтный action и text\n if (isDefaultMenu) {\n return null;\n }\n return {\n action: this.onEditItem,\n text: i18n('label_settings'),\n };\n }\n }\n return null;\n }\n\n private getDefaultControls = () => {\n const {view, size} = this.props;\n\n if (this.context.overlayControls === null) {\n return null;\n }\n\n return (\n <Button\n key={'control_default'}\n view={view}\n size={size}\n title={i18n('label_settings')}\n pin=\"round-brick\"\n onClick={this.onEditItem}\n qa=\"dashkit-overlay-control-settings\"\n >\n <Icon data={Gear} size={OVERLAY_ICON_SIZE} />\n </Button>\n );\n };\n\n private renderControls() {\n const customLeftControls = this.getCustomLeftOverlayControls();\n const hasCustomOverlayLeftControls = Boolean(customLeftControls.length);\n\n const controls = hasCustomOverlayLeftControls\n ? customLeftControls.map(\n (item: OverlayControlItem, index: number, items: OverlayControlItem[]) =>\n this.renderControlsItem(item, index, items.length + 1),\n )\n : this.getDefaultControls();\n\n const menu = this.renderMenu(controls === null);\n\n return (\n <div\n className={b('default-controls', {\n 'with-custom-left': hasCustomOverlayLeftControls,\n })}\n >\n {controls}\n {menu}\n </div>\n );\n }\n private renderMenu(isOnlyOneItem: boolean) {\n const {view, size} = this.props;\n\n const dropdown = this.renderDropdownMenu(isOnlyOneItem);\n\n if (dropdown) {\n return dropdown;\n }\n\n return (\n <Button\n key={'delete-control'}\n view={view}\n size={size}\n title={i18n('label_delete')}\n pin={isOnlyOneItem ? 'round-round' : 'brick-round'}\n onClick={this.onRemoveItem}\n qa=\"dashkit-overlay-control-menu\"\n >\n <Icon data={Xmark} size={OVERLAY_ICON_SIZE} />\n </Button>\n );\n }\n\n private isDefaultMenu(menu: Settings['menu']) {\n return menu?.every((item) =>\n (Object.values(MenuItems) as Array<string>).includes(String(item)),\n );\n }\n private getDropdownMenuItems(): DropdownMenuItem[] {\n const {onItemClick} = this.props;\n const {menu: contextMenu, itemsParams, itemsState} = this.context;\n\n const configItem = this.props.configItem;\n const itemParams = itemsParams[configItem.id];\n const itemState = itemsState?.[configItem.id] || {};\n\n const menu = contextMenu && contextMenu.length > 0 ? contextMenu : DEFAULT_DROPDOWN_MENU;\n\n const isDefaultMenu = this.isDefaultMenu(menu);\n\n return isDefaultMenu\n ? ((menu || []) as string[]).reduce<DropdownMenuItem[]>((memo, name: string) => {\n const item = this.getDropDownMenuItemConfig(name, true);\n if (item) {\n memo.push(item);\n }\n\n return memo;\n }, [])\n : menu.reduce<DropdownMenuItem[]>((memo, item: MenuItem) => {\n if (typeof item === 'string') {\n return memo;\n }\n // custom menu dropdown item filter\n if (item.visible && !item.visible(configItem)) {\n return memo;\n }\n\n const itemHandler = item.handler;\n\n const itemAction =\n typeof itemHandler === 'function'\n ? () => {\n const result = itemHandler(configItem, itemParams, itemState);\n onItemClick?.();\n return result;\n }\n : this.getDropDownMenuItemConfig(item.id)?.action || (() => {});\n\n memo.push({\n // @ts-expect-error\n text: item.title || i18n(item.id),\n iconStart: item.icon,\n /**\n * if the logic of creating the 'action' field is changed, it is necessary to update the logic of the method shallowEqualDropdownMenu\n * @see {@link https://github.com/gravity-ui/dashkit/pull/267/commits/c6378b67c5fea07902a49ccce8118760a4ad2df0#diff-aa6a22e5a09a09ccc3f8f937d4ef6aaff97afc57da1b370f0120f0e225f7b061R143}\n */\n action: itemAction,\n className: item.className,\n qa: item.qa,\n });\n\n return memo;\n }, []);\n }\n\n private renderDropdownMenu(isOnlyOneItem: boolean) {\n const {view, size} = this.props;\n\n const items = this.getDropdownMenuItems();\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <DropdownMenu\n key={'controls_dropdown'}\n items={items}\n renderSwitcher={(props) => (\n <Button\n {...props}\n view={view}\n size={size}\n pin={isOnlyOneItem ? 'round-round' : 'brick-round'}\n extraProps={{'aria-label': i18n('label_more-options')}}\n qa=\"dashkit-overlay-control-menu\"\n >\n <Icon data={Ellipsis} size={OVERLAY_ICON_SIZE} />\n </Button>\n )}\n onOpenToggle={this.updateDropdownMenuItems}\n popupProps={{\n className: DRAGGABLE_CANCEL_CLASS_NAME,\n }}\n />\n );\n }\n private getCustomLeftOverlayControls = () => {\n // выбираем только items-ы у которых проставлено поле `allWidgetsControls:true`\n // те контролы, которые будут показываться слева от меню\n let controls: OverlayControlItem[] = [];\n const {onItemClick} = this.props;\n\n for (const controlItem of Object.values(this.context.overlayControls || {})) {\n controls = controls.concat(\n (\n (controlItem as OverlayControlItem[]).filter((item) => {\n // если тип виджета-плагина в списке исключаемых, то не показываем такой контрол\n if (item.excludeWidgetsTypes?.includes(this.props.configItem.type)) {\n return false;\n }\n\n return item.visible\n ? item.visible(this.props.configItem)\n : item.allWidgetsControls;\n }) || []\n ).map((item) => {\n if (!item?.id) {\n return item;\n }\n return {\n ...item,\n handler:\n typeof item.handler === 'function'\n ? (...args) => {\n const result = item.handler?.(...args);\n onItemClick?.();\n return result;\n }\n : this.getDropDownMenuItemConfig(item.id)?.action || (() => {}),\n };\n }),\n );\n }\n\n return controls;\n };\n private onCopyItem = () => {\n const {configItem} = this.props;\n const correspondedItemLayout = this.context.getLayoutItem(configItem.id);\n\n let targetInnerId;\n\n if (isItemWithTabs(this.props.configItem)) {\n targetInnerId = resolveItemInnerId({\n item: this.props.configItem,\n itemsStateAndParams: this.context.itemsStateAndParams,\n });\n }\n\n let options: PreparedCopyItemOptions = {\n timestamp: Date.now(),\n data: configItem.data,\n type: configItem.type,\n defaults: configItem.defaults,\n namespace: configItem.namespace,\n layout: {\n w: correspondedItemLayout!.w,\n h: correspondedItemLayout!.h,\n },\n targetId: this.props.configItem.id,\n targetInnerId,\n };\n\n if (this.context.context?.getPreparedCopyItemOptions) {\n console.warn?.(\n '`context.getPreparedCopyItemOptions` is deprecated. Please use `getPreparedCopyItemOptions` prop instead',\n );\n }\n\n const getPreparedCopyItemOptions =\n this.context?.getPreparedCopyItemOptions ??\n this.context.context?.getPreparedCopyItemOptions;\n\n if (typeof getPreparedCopyItemOptions === 'function') {\n options = getPreparedCopyItemOptions(options);\n }\n\n try {\n localStorage.setItem(COPIED_WIDGET_STORE_KEY, JSON.stringify(options));\n this.context.onCopyFulfill?.(null, options);\n } catch (e) {\n const error = e instanceof Error ? e : new Error('Unknown error while copying item');\n this.context.onCopyFulfill?.(error);\n }\n // https://stackoverflow.com/questions/35865481/storage-event-not-firing\n window.dispatchEvent(new Event('storage'));\n this.props.onItemClick?.();\n };\n private onEditItem = () => {\n this.context.editItem?.(this.props.configItem);\n this.props.onItemClick?.();\n };\n private onRemoveItem = () => {\n const {id} = this.props.configItem;\n this.context.removeItem(id);\n this.props.onItemClick?.();\n };\n private getControlItemPinStyle(index: number, itemsLength: number) {\n const isOnlyOneItem = itemsLength === 1;\n const isFirstItem = index === 0;\n const isLastItem = index === itemsLength - 1;\n\n if (isOnlyOneItem) {\n return 'round-round';\n }\n\n if (isFirstItem) {\n return 'round-brick';\n }\n\n if (isLastItem) {\n return 'brick-round';\n }\n\n return 'brick-brick';\n }\n private getCustomControlsWithWidgets() {\n const items = this.getItems();\n\n const result = items.map(\n (item: OverlayControlItem, index: number, controlItems: OverlayControlItem[]) =>\n this.renderControlsItem(item, index, controlItems.length),\n );\n const isOnlyOneItem = items.length === 0;\n\n // Добавляем контрол удаления или меню виджета по умолчанию\n result.push(this.renderMenu(isOnlyOneItem));\n\n return result;\n }\n}\n\nexport default OverlayControls;\n"]}
1
+ {"version":3,"file":"OverlayControls.js","sourceR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IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAChE,CAAC;QACF,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;QAEzC,2DAA2D;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QAE5C,OAAO,MAAM,CAAC;IAClB,CAAC;;AApaM,2BAAW,GAAG,sCAA4B,AAA/B,CAAgC;AAC3C,4BAAY,GAAgC;IAC/C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;IAC1C,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,GAAG;CACZ,AAJkB,CAIjB;AAkaN,kBAAe,eAAe,CAAC","sourcesContent":["import React from 'react';\n\nimport {Ellipsis, Gear, Xmark} from '@gravity-ui/icons';\nimport {\n Button,\n ButtonSize,\n ButtonView,\n DropdownMenu,\n DropdownMenuItem,\n Icon,\n IconProps,\n MenuItemProps,\n} from '@gravity-ui/uikit';\nimport noop from 'lodash/noop';\n\nimport {\n COPIED_WIDGET_STORE_KEY,\n DRAGGABLE_CANCEL_CLASS_NAME,\n MenuItems,\n OVERLAY_CONTROLS_CLASS_NAME,\n OVERLAY_ICON_SIZE,\n} from '../../constants';\nimport {DashkitOvelayControlsContext, OverlayControlsCtxShape} from '../../context';\nimport {i18n} from '../../i18n';\nimport {\n type ConfigItem,\n type ItemParams,\n type ItemState,\n type PluginBase,\n isItemWithTabs,\n resolveItemInnerId,\n} from '../../shared';\nimport {MenuItem, Settings} from '../../typings';\nimport {cn} from '../../utils/cn';\n\nimport './OverlayControls.scss';\n\nconst b = cn(OVERLAY_CONTROLS_CLASS_NAME);\n\nexport enum OverlayControlsPosition {\n TopRight = 'top_right',\n TopLeft = 'top_left',\n BottomRight = 'bottom_right',\n BottomLeft = 'bottom_left',\n}\n\nexport interface OverlayControlItem {\n title?: string;\n icon?: IconProps['data'];\n renderIcon?: (item: ConfigItem) => IconProps['data'];\n iconSize?: number | string;\n handler?: (item: ConfigItem) => void;\n visible?: (item: ConfigItem) => boolean;\n allWidgetsControls?: boolean; // флаг кастомного контрола (без кастомного виджета), которые показываются не в списке меню\n excludeWidgetsTypes?: Array<PluginBase['type']>; // массив с типами виджетов (плагинов), которые исключаем из отображения контрола по настройке allWidgetsControls\n id?: string; // id дефолтного пункта меню для возможноти использования дефолтного action в кастомных контролах\n qa?: string;\n className?: string;\n}\n\nexport interface OverlayCustomControlItem {\n id: string;\n title?: string;\n icon?: MenuItemProps['iconStart'];\n iconSize?: number | string;\n handler?: (item: ConfigItem, params: ItemParams, state: ItemState) => void;\n visible?: (item: ConfigItem) => boolean;\n className?: string;\n qa?: string;\n}\n\ninterface OverlayControlsDefaultProps {\n position: OverlayControlsPosition;\n view: ButtonView;\n size: ButtonSize;\n}\n\ninterface OverlayControlsProps extends OverlayControlsDefaultProps {\n configItem: ConfigItem;\n onItemClick?: () => void | null;\n}\n\ntype PreparedCopyItemOptionsArg = Pick<ConfigItem, 'data' | 'type' | 'defaults' | 'namespace'> & {\n timestamp: number;\n layout: {\n w: number;\n h: number;\n };\n targetId?: string;\n targetInnerId?: string;\n};\n\nexport type PreparedCopyItemOptions<C extends object = {}> = PreparedCopyItemOptionsArg & {\n copyContext?: C;\n};\n\ntype OverlayControlsCtx = React.Context<OverlayControlsCtxShape>;\n\nconst DEFAULT_DROPDOWN_MENU = [MenuItems.Copy, MenuItems.Delete];\n\nclass OverlayControls extends React.Component<OverlayControlsProps> {\n static contextType = DashkitOvelayControlsContext;\n static defaultProps: OverlayControlsDefaultProps = {\n position: OverlayControlsPosition.TopRight,\n view: 'flat',\n size: 'm',\n };\n context!: React.ContextType<OverlayControlsCtx>;\n\n state = {\n dropdownMenuItems: [] as DropdownMenuItem[],\n };\n\n componentDidMount() {\n this.updateDropdownMenuItems();\n }\n\n componentDidUpdate() {\n this.updateDropdownMenuItems();\n }\n\n render() {\n const {position} = this.props;\n const items = this.getItems();\n const hasCustomControlsWithWidgets = items.length > 0;\n\n const controls = hasCustomControlsWithWidgets\n ? this.getCustomControlsWithWidgets()\n : this.renderControls();\n\n return <div className={b({position}, [DRAGGABLE_CANCEL_CLASS_NAME])}>{controls}</div>;\n }\n\n private shallowEqualDropdownMenu(menuA: DropdownMenuItem[], menuB: DropdownMenuItem[]) {\n return (\n menuA.length === menuB.length &&\n menuA.every((itemA, index) => {\n const itemB = menuB[index];\n\n if (!itemB) {\n return false;\n }\n\n return Object.entries(itemA).every(\n ([key, value]) =>\n /**\n * field 'action' is new every time\n * @see {@link https://github.com/gravity-ui/dashkit/pull/267/commits/c6378b67c5fea07902a49ccce8118760a4ad2df0#diff-aa6a22e5a09a09ccc3f8f937d4ef6aaff97afc57da1b370f0120f0e225f7b061L297}\n */\n key === 'action' || itemB[key as keyof DropdownMenuItem] === value,\n );\n })\n );\n }\n\n private updateDropdownMenuItems = () => {\n const items = this.getDropdownMenuItems();\n if (!this.shallowEqualDropdownMenu(items, this.state.dropdownMenuItems)) {\n this.setState({dropdownMenuItems: items});\n }\n };\n\n private getItems = () => {\n const {overlayControls} = this.context;\n const {configItem} = this.props;\n\n return (overlayControls && overlayControls[configItem.type]) || [];\n };\n\n private renderControlsItem = (item: OverlayControlItem, index: number, length: number) => {\n const {view, size, onItemClick} = this.props;\n const {title, handler, icon, renderIcon, iconSize, qa, className} = item;\n\n const iconData = renderIcon ? renderIcon(this.props.configItem) : icon;\n\n const onItemClickHandler = typeof handler === 'function' ? handler : noop;\n return (\n <Button\n key={`control_${index}`}\n view={view}\n size={size}\n title={title}\n pin={this.getControlItemPinStyle(index, length)}\n onClick={() => {\n onItemClickHandler(this.props.configItem);\n onItemClick?.();\n }}\n className={className}\n qa={qa}\n >\n <Icon data={iconData || Gear} size={icon ? iconSize : OVERLAY_ICON_SIZE} />\n </Button>\n );\n };\n\n private getDropDownMenuItemConfig(menuName: string, isDefaultMenu?: boolean) {\n switch (menuName) {\n case MenuItems.Copy: {\n return {\n action: this.onCopyItem,\n text: i18n('label_copy'),\n };\n }\n case MenuItems.Delete: {\n return {\n action: this.onRemoveItem,\n text: i18n('label_delete'),\n };\n }\n case MenuItems.Settings: {\n // для дефолтного состояния меню нет настройки settings, а для кастомного можно использовать дефолтный action и text\n if (isDefaultMenu) {\n return null;\n }\n return {\n action: this.onEditItem,\n text: i18n('label_settings'),\n };\n }\n }\n return null;\n }\n\n private getDefaultControls = () => {\n const {view, size} = this.props;\n\n if (this.context.overlayControls === null) {\n return null;\n }\n\n return (\n <Button\n key={'control_default'}\n view={view}\n size={size}\n title={i18n('label_settings')}\n pin=\"round-brick\"\n onClick={this.onEditItem}\n qa=\"dashkit-overlay-control-settings\"\n >\n <Icon data={Gear} size={OVERLAY_ICON_SIZE} />\n </Button>\n );\n };\n\n private renderControls() {\n const customLeftControls = this.getCustomLeftOverlayControls();\n const hasCustomOverlayLeftControls = Boolean(customLeftControls.length);\n\n const controls = hasCustomOverlayLeftControls\n ? customLeftControls.map(\n (item: OverlayControlItem, index: number, items: OverlayControlItem[]) =>\n this.renderControlsItem(item, index, items.length + 1),\n )\n : this.getDefaultControls();\n\n const menu = this.renderMenu(controls === null);\n\n return (\n <div\n className={b('default-controls', {\n 'with-custom-left': hasCustomOverlayLeftControls,\n })}\n >\n {controls}\n {menu}\n </div>\n );\n }\n private renderMenu(isOnlyOneItem: boolean) {\n const {view, size} = this.props;\n\n const dropdown = this.renderDropdownMenu(isOnlyOneItem);\n\n if (dropdown) {\n return dropdown;\n }\n\n return (\n <Button\n key={'delete-control'}\n view={view}\n size={size}\n title={i18n('label_delete')}\n pin={isOnlyOneItem ? 'round-round' : 'brick-round'}\n onClick={this.onRemoveItem}\n qa=\"dashkit-overlay-control-menu\"\n >\n <Icon data={Xmark} size={OVERLAY_ICON_SIZE} />\n </Button>\n );\n }\n\n private isDefaultMenu(menu: Settings['menu']) {\n return menu?.every((item) =>\n (Object.values(MenuItems) as Array<string>).includes(String(item)),\n );\n }\n private getDropdownMenuItems(): DropdownMenuItem[] {\n const {onItemClick} = this.props;\n const {menu: contextMenu, itemsParams, itemsState} = this.context;\n\n const configItem = this.props.configItem;\n const itemParams = itemsParams[configItem.id];\n const itemState = itemsState?.[configItem.id] || {};\n\n const menu = contextMenu && contextMenu.length > 0 ? contextMenu : DEFAULT_DROPDOWN_MENU;\n\n const isDefaultMenu = this.isDefaultMenu(menu);\n\n return isDefaultMenu\n ? ((menu || []) as string[]).reduce<DropdownMenuItem[]>((memo, name: string) => {\n const item = this.getDropDownMenuItemConfig(name, true);\n if (item) {\n memo.push(item);\n }\n\n return memo;\n }, [])\n : menu.reduce<DropdownMenuItem[]>((memo, item: MenuItem) => {\n if (typeof item === 'string') {\n return memo;\n }\n // custom menu dropdown item filter\n if (item.visible && !item.visible(configItem)) {\n return memo;\n }\n\n const itemHandler = item.handler;\n\n const itemAction =\n typeof itemHandler === 'function'\n ? () => {\n const result = itemHandler(configItem, itemParams, itemState);\n onItemClick?.();\n return result;\n }\n : this.getDropDownMenuItemConfig(item.id)?.action || (() => {});\n\n memo.push({\n // @ts-expect-error\n text: item.title || i18n(item.id),\n iconStart: item.icon,\n /**\n * if the logic of creating the 'action' field is changed, it is necessary to update the logic of the method shallowEqualDropdownMenu\n * @see {@link https://github.com/gravity-ui/dashkit/pull/267/commits/c6378b67c5fea07902a49ccce8118760a4ad2df0#diff-aa6a22e5a09a09ccc3f8f937d4ef6aaff97afc57da1b370f0120f0e225f7b061R143}\n */\n action: itemAction,\n className: item.className,\n qa: item.qa,\n });\n\n return memo;\n }, []);\n }\n\n private renderDropdownMenu(isOnlyOneItem: boolean) {\n const {view, size} = this.props;\n\n const items = this.getDropdownMenuItems();\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <DropdownMenu\n key={'controls_dropdown'}\n items={items}\n renderSwitcher={(props) => (\n <Button\n {...props}\n view={view}\n size={size}\n pin={isOnlyOneItem ? 'round-round' : 'brick-round'}\n extraProps={{'aria-label': i18n('label_more-options')}}\n qa=\"dashkit-overlay-control-menu\"\n >\n <Icon data={Ellipsis} size={OVERLAY_ICON_SIZE} />\n </Button>\n )}\n onOpenToggle={this.updateDropdownMenuItems}\n popupProps={{\n className: DRAGGABLE_CANCEL_CLASS_NAME,\n }}\n />\n );\n }\n private getCustomLeftOverlayControls = () => {\n // выбираем только items-ы у которых проставлено поле `allWidgetsControls:true`\n // те контролы, которые будут показываться слева от меню\n let controls: OverlayControlItem[] = [];\n const {onItemClick} = this.props;\n\n for (const controlItem of Object.values(this.context.overlayControls || {})) {\n controls = controls.concat(\n (\n (controlItem as OverlayControlItem[]).filter((item) => {\n // если тип виджета-плагина в списке исключаемых, то не показываем такой контрол\n if (item.excludeWidgetsTypes?.includes(this.props.configItem.type)) {\n return false;\n }\n\n return item.visible\n ? item.visible(this.props.configItem)\n : item.allWidgetsControls;\n }) || []\n ).map((item) => {\n if (!item?.id) {\n return item;\n }\n return {\n ...item,\n handler:\n typeof item.handler === 'function'\n ? (...args) => {\n const result = item.handler?.(...args);\n onItemClick?.();\n return result;\n }\n : this.getDropDownMenuItemConfig(item.id)?.action || (() => {}),\n };\n }),\n );\n }\n\n return controls;\n };\n private onCopyItem = () => {\n const {configItem} = this.props;\n const correspondedItemLayout = this.context.getLayoutItem(configItem.id);\n\n let targetInnerId;\n\n if (isItemWithTabs(this.props.configItem)) {\n targetInnerId = resolveItemInnerId({\n item: this.props.configItem,\n itemsStateAndParams: this.context.itemsStateAndParams,\n });\n }\n\n let options: PreparedCopyItemOptions = {\n timestamp: Date.now(),\n data: configItem.data,\n type: configItem.type,\n defaults: configItem.defaults,\n namespace: configItem.namespace,\n layout: {\n w: correspondedItemLayout!.w,\n h: correspondedItemLayout!.h,\n },\n targetId: this.props.configItem.id,\n targetInnerId,\n };\n\n if (this.context.context?.getPreparedCopyItemOptions) {\n console.warn?.(\n '`context.getPreparedCopyItemOptions` is deprecated. Please use `getPreparedCopyItemOptions` prop instead',\n );\n }\n\n const getPreparedCopyItemOptions =\n this.context?.getPreparedCopyItemOptions ??\n this.context.context?.getPreparedCopyItemOptions;\n\n if (typeof getPreparedCopyItemOptions === 'function') {\n options = getPreparedCopyItemOptions(options);\n }\n\n try {\n localStorage.setItem(COPIED_WIDGET_STORE_KEY, JSON.stringify(options));\n this.context.onCopyFulfill?.(null, options);\n } catch (e) {\n const error = e instanceof Error ? e : new Error('Unknown error while copying item');\n this.context.onCopyFulfill?.(error);\n }\n // https://stackoverflow.com/questions/35865481/storage-event-not-firing\n window.dispatchEvent(new Event('storage'));\n this.props.onItemClick?.();\n };\n private onEditItem = () => {\n this.context.editItem?.(this.props.configItem);\n this.props.onItemClick?.();\n };\n private onRemoveItem = () => {\n const {id} = this.props.configItem;\n this.context.removeItem(id);\n this.props.onItemClick?.();\n };\n private getControlItemPinStyle(index: number, itemsLength: number) {\n const isOnlyOneItem = itemsLength === 1;\n const isFirstItem = index === 0;\n const isLastItem = index === itemsLength - 1;\n\n if (isOnlyOneItem) {\n return 'round-round';\n }\n\n if (isFirstItem) {\n return 'round-brick';\n }\n\n if (isLastItem) {\n return 'brick-round';\n }\n\n return 'brick-brick';\n }\n private getCustomControlsWithWidgets() {\n const items = this.getItems();\n\n const result = items.map(\n (item: OverlayControlItem, index: number, controlItems: OverlayControlItem[]) =>\n this.renderControlsItem(item, index, controlItems.length),\n );\n const isOnlyOneItem = items.length === 0;\n\n // Добавляем контрол удаления или меню виджета по умолчанию\n result.push(this.renderMenu(isOnlyOneItem));\n\n return result;\n }\n}\n\nexport default OverlayControls;\n"]}
@@ -1,37 +1,29 @@
1
1
  import React from 'react';
2
2
  import type { RegisterManager } from "../utils/index.js";
3
3
  import type { DashKitProps } from "../components/DashKit/index.js";
4
- import type { ConfigItem, ConfigLayout, ItemDragProps, ItemParams, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions } from "../shared/index.js";
5
- import type { PluginRef, ReactGridLayoutProps } from "../typings/index.js";
4
+ import type { ConfigItem, ConfigLayout, ItemParams, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions } from "../shared/index.js";
6
5
  type DashkitPropsPassedToCtx = Pick<DashKitProps, 'config' | 'groups' | 'context' | 'noOverlay' | 'focusable' | 'globalParams' | 'editMode' | 'settings' | 'onItemMountChange' | 'onItemRender' | 'draggableHandleClassName' | 'onDragStart' | 'onDrag' | 'onDragStop' | 'onResizeStart' | 'onResize' | 'onResizeStop'>;
7
6
  type PluginType = string;
8
- type TemporaryLayout = {
9
- data: ConfigLayout[];
10
- dragProps: ItemDragProps;
11
- };
12
7
  export type DashKitCtxShape = DashkitPropsPassedToCtx & {
13
8
  registerManager: RegisterManager;
14
9
  forwardedMetaRef: React.ForwardedRef<any>;
15
10
  configItems: ConfigItem[];
16
11
  layout: ConfigLayout[];
17
- layoutChange: (layout: ConfigLayout[]) => void;
18
- temporaryLayout: TemporaryLayout | null;
12
+ temporaryLayout: ConfigLayout[] | null;
19
13
  memorizeOriginalLayout: (widgetId: string, preAutoHeightLayout: ConfigLayout, postAutoHeightLayout: ConfigLayout) => void;
20
14
  revertToOriginalLayout: (widgetId: string) => void;
21
15
  itemsState?: Record<string, ItemState>;
22
16
  itemsParams: Record<string, ItemParams>;
23
17
  onItemStateAndParamsChange: (id: string, stateAndParams: ItemStateAndParams, options: ItemStateAndParamsChangeOptions) => void;
24
- getItemsMeta: (pluginsRefs: Array<PluginRef>) => Array<Promise<any>>;
25
- reloadItems: (pluginsRefs: Array<PluginRef>, data: {
18
+ getItemsMeta: (pluginsRefs: Array<React.RefObject<any>>) => Array<Promise<any>>;
19
+ reloadItems: (pluginsRefs: Array<React.RefObject<any>>, data: {
26
20
  silentLoading: boolean;
27
21
  noVeil: boolean;
28
22
  }) => void;
29
- onDrop: (newLayout: ConfigLayout[], item: ConfigLayout, e?: MouseEvent) => void;
30
- onDropDragOver: (e: DragEvent | MouseEvent, group: string | void, gridProps: ReactGridLayoutProps, groupLayout: ConfigLayout[], sharedItem: (Partial<ConfigLayout> & {
23
+ onDrop: (newLayout: ConfigLayout, item: ConfigItem) => void;
24
+ onDropDragOver: (e: DragEvent | MouseEvent, group: string | void, gridProps: Partial<ReactGridLayout.ReactGridLayoutProps>, groupLayout: ConfigLayout[], sharedItem: (Partial<ConfigLayout> & {
31
25
  type: PluginType;
32
26
  }) | void) => void | boolean;
33
- onItemBlur: (item: ConfigItem) => void;
34
- onItemFocus: (item: ConfigItem) => void;
35
27
  outerDnDEnable: boolean;
36
28
  dragOverPlugin: null | PluginType;
37
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DashKitContext.js","sourceRoot":"../../../src","sources":["context/DashKitContext.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAuF1B,MAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAAkB,EAAqB,CAAC,CAAC;AAE3E,wCAAc","sourcesContent":["import React from 'react';\n\nimport type {RegisterManager} from '..//utils';\nimport type {DashKitProps} from '../components/DashKit';\nimport type {\n ConfigItem,\n ConfigLayout,\n ItemDragProps,\n ItemParams,\n ItemState,\n ItemStateAndParams,\n ItemStateAndParamsChangeOptions,\n} from '../shared';\nimport type {PluginRef, ReactGridLayoutProps} from '../typings';\n\ntype DashkitPropsPassedToCtx = Pick<\n DashKitProps,\n | 'config'\n | 'groups'\n | 'context'\n | 'noOverlay'\n | 'focusable'\n | 'globalParams'\n | 'editMode'\n | 'settings'\n | 'onItemMountChange'\n | 'onItemRender'\n | 'draggableHandleClassName'\n // default handlers bypass\n | 'onDragStart'\n | 'onDrag'\n | 'onDragStop'\n | 'onResizeStart'\n | 'onResize'\n | 'onResizeStop'\n>;\n\ntype PluginType = string;\n\ntype TemporaryLayout = {\n data: ConfigLayout[];\n dragProps: ItemDragProps;\n};\n\nexport type DashKitCtxShape = DashkitPropsPassedToCtx & {\n registerManager: RegisterManager;\n forwardedMetaRef: React.ForwardedRef<any>;\n\n configItems: ConfigItem[];\n layout: ConfigLayout[];\n layoutChange: (layout: ConfigLayout[]) => void;\n temporaryLayout: TemporaryLayout | null;\n memorizeOriginalLayout: (\n widgetId: string,\n preAutoHeightLayout: ConfigLayout,\n postAutoHeightLayout: ConfigLayout,\n ) => void;\n revertToOriginalLayout: (widgetId: string) => void;\n\n itemsState?: Record<string, ItemState>;\n itemsParams: Record<string, ItemParams>;\n onItemStateAndParamsChange: (\n id: string,\n stateAndParams: ItemStateAndParams,\n options: ItemStateAndParamsChangeOptions,\n ) => void;\n\n getItemsMeta: (pluginsRefs: Array<PluginRef>) => Array<Promise<any>>;\n reloadItems: (\n pluginsRefs: Array<PluginRef>,\n data: {silentLoading: boolean; noVeil: boolean},\n ) => void;\n\n onDrop: (newLayout: ConfigLayout[], item: ConfigLayout, e?: MouseEvent) => void;\n onDropDragOver: (\n e: DragEvent | MouseEvent,\n group: string | void,\n gridProps: ReactGridLayoutProps,\n groupLayout: ConfigLayout[],\n sharedItem: (Partial<ConfigLayout> & {type: PluginType}) | void,\n ) => void | boolean;\n onItemBlur: (item: ConfigItem) => void;\n onItemFocus: (item: ConfigItem) => void;\n outerDnDEnable: boolean;\n dragOverPlugin: null | PluginType;\n};\n\nconst DashKitContext = React.createContext<DashKitCtxShape>({} as DashKitCtxShape);\n\nexport {DashKitContext};\n"]}
1
+ {"version":3,"file":"DashKitContext.js","sourceRoot":"../../../src","sources":["context/DashKitContext.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AA6E1B,MAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAAkB,EAAqB,CAAC,CAAC;AAE3E,wCAAc","sourcesContent":["import React from 'react';\n\nimport type {RegisterManager} from '..//utils';\nimport type {DashKitProps} from '../components/DashKit';\nimport type {\n ConfigItem,\n ConfigLayout,\n ItemParams,\n ItemState,\n ItemStateAndParams,\n ItemStateAndParamsChangeOptions,\n} from '../shared';\n\ntype DashkitPropsPassedToCtx = Pick<\n DashKitProps,\n | 'config'\n | 'groups'\n | 'context'\n | 'noOverlay'\n | 'focusable'\n | 'globalParams'\n | 'editMode'\n | 'settings'\n | 'onItemMountChange'\n | 'onItemRender'\n | 'draggableHandleClassName'\n // default handlers bypass\n | 'onDragStart'\n | 'onDrag'\n | 'onDragStop'\n | 'onResizeStart'\n | 'onResize'\n | 'onResizeStop'\n>;\n\ntype PluginType = string;\n\nexport type DashKitCtxShape = DashkitPropsPassedToCtx & {\n registerManager: RegisterManager;\n forwardedMetaRef: React.ForwardedRef<any>;\n\n configItems: ConfigItem[];\n layout: ConfigLayout[];\n temporaryLayout: ConfigLayout[] | null;\n memorizeOriginalLayout: (\n widgetId: string,\n preAutoHeightLayout: ConfigLayout,\n postAutoHeightLayout: ConfigLayout,\n ) => void;\n revertToOriginalLayout: (widgetId: string) => void;\n\n itemsState?: Record<string, ItemState>;\n itemsParams: Record<string, ItemParams>;\n onItemStateAndParamsChange: (\n id: string,\n stateAndParams: ItemStateAndParams,\n options: ItemStateAndParamsChangeOptions,\n ) => void;\n\n getItemsMeta: (pluginsRefs: Array<React.RefObject<any>>) => Array<Promise<any>>;\n reloadItems: (\n pluginsRefs: Array<React.RefObject<any>>,\n data: {silentLoading: boolean; noVeil: boolean},\n ) => void;\n\n onDrop: (newLayout: ConfigLayout, item: ConfigItem) => void;\n onDropDragOver: (\n e: DragEvent | MouseEvent,\n group: string | void,\n gridProps: Partial<ReactGridLayout.ReactGridLayoutProps>,\n groupLayout: ConfigLayout[],\n sharedItem: (Partial<ConfigLayout> & {type: PluginType}) | void,\n ) => void | boolean;\n outerDnDEnable: boolean;\n dragOverPlugin: null | PluginType;\n};\n\nconst DashKitContext = React.createContext<DashKitCtxShape>({} as DashKitCtxShape);\n\nexport {DashKitContext};\n"]}
@@ -1,4 +1,4 @@
1
- import type { Layout } from 'react-grid-layout';
1
+ import type { Layout, Layouts } from 'react-grid-layout';
2
2
  import type { Config, ConfigItem, ConfigLayout } from "../shared/index.js";
3
3
  import { GridLayoutSettings } from "./common.js";
4
4
  export interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {
@@ -42,7 +42,7 @@ export interface DashKitGroup {
42
42
  gridProperties?: (props: ReactGridLayoutProps) => ReactGridLayoutProps;
43
43
  }
44
44
  export type ItemManipulationCallback = (eventData: {
45
- layout: Layout[];
45
+ layout: Layouts;
46
46
  oldItem: Layout;
47
47
  newItem: Layout;
48
48
  placeholder: Layout;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"../../../src","sources":["typings/config.ts"],"names":[],"mappings":"","sourcesContent":["import type {Layout} from 'react-grid-layout';\n\nimport type {Config, ConfigItem, ConfigLayout} from '../shared';\n\nimport {GridLayoutSettings} from './common';\n\nexport interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {\n id?: null;\n namespace?: string;\n layout?: Omit<ConfigLayout, 'i'>;\n}\nexport type SetConfigItem = ConfigItem | AddConfigItem;\n\nexport type SetItemOptions = {\n excludeIds?: string[];\n useGlobalItems?: boolean;\n};\n\nexport type GridReflowOptions = {\n cols: number;\n maxRows?: number;\n compactType?: CompactType;\n};\n\nexport type CompactType = ReactGridLayout.ReactGridLayoutProps['compactType'] | 'horizontal-nowrap';\n\nexport type ReflowLayoutOptions = {\n defaultProps: GridReflowOptions;\n groups?: Record<string, GridReflowOptions>;\n};\n\nexport type AddNewItemOptions = SetItemOptions & {\n updateLayout?: ConfigLayout[];\n reflowLayoutOptions?: ReflowLayoutOptions;\n};\n\nexport interface DashkitGroupRenderProps {\n config: Config;\n editMode: boolean;\n isMobile: boolean;\n items: ConfigItem[];\n layout: ConfigLayout[];\n context: any;\n}\n\nexport type ReactGridLayoutProps = Omit<\n GridLayoutSettings,\n | 'children'\n | 'compactType'\n | 'innerRef'\n | 'key'\n | 'layout'\n | 'onDragStart'\n | 'onDragStop'\n | 'onResizeStart'\n | 'onResizeStop'\n | 'draggableHandle'\n | 'isDroppable'\n | 'onDropDragOver'\n | 'onDrop'\n | 'draggableCancel'\n> & {\n compactType?: CompactType;\n};\n\nexport interface DashKitGroup {\n id?: string;\n render?: (\n id: string,\n children: React.ReactNode,\n props: DashkitGroupRenderProps,\n ) => React.ReactNode;\n gridProperties?: (props: ReactGridLayoutProps) => ReactGridLayoutProps;\n}\n\nexport type ItemManipulationCallback = (eventData: {\n layout: Layout[];\n oldItem: Layout;\n newItem: Layout;\n placeholder: Layout;\n e: MouseEvent;\n element: HTMLElement;\n}) => void;\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"../../../src","sources":["typings/config.ts"],"names":[],"mappings":"","sourcesContent":["import type {Layout, Layouts} from 'react-grid-layout';\n\nimport type {Config, ConfigItem, ConfigLayout} from '../shared';\n\nimport {GridLayoutSettings} from './common';\n\nexport interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {\n id?: null;\n namespace?: string;\n layout?: Omit<ConfigLayout, 'i'>;\n}\nexport type SetConfigItem = ConfigItem | AddConfigItem;\n\nexport type SetItemOptions = {\n excludeIds?: string[];\n useGlobalItems?: boolean;\n};\n\nexport type GridReflowOptions = {\n cols: number;\n maxRows?: number;\n compactType?: CompactType;\n};\n\nexport type CompactType = ReactGridLayout.ReactGridLayoutProps['compactType'] | 'horizontal-nowrap';\n\nexport type ReflowLayoutOptions = {\n defaultProps: GridReflowOptions;\n groups?: Record<string, GridReflowOptions>;\n};\n\nexport type AddNewItemOptions = SetItemOptions & {\n updateLayout?: ConfigLayout[];\n reflowLayoutOptions?: ReflowLayoutOptions;\n};\n\nexport interface DashkitGroupRenderProps {\n config: Config;\n editMode: boolean;\n isMobile: boolean;\n items: ConfigItem[];\n layout: ConfigLayout[];\n context: any;\n}\n\nexport type ReactGridLayoutProps = Omit<\n GridLayoutSettings,\n | 'children'\n | 'compactType'\n | 'innerRef'\n | 'key'\n | 'layout'\n | 'onDragStart'\n | 'onDragStop'\n | 'onResizeStart'\n | 'onResizeStop'\n | 'draggableHandle'\n | 'isDroppable'\n | 'onDropDragOver'\n | 'onDrop'\n | 'draggableCancel'\n> & {\n compactType?: CompactType;\n};\n\nexport interface DashKitGroup {\n id?: string;\n render?: (\n id: string,\n children: React.ReactNode,\n props: DashkitGroupRenderProps,\n ) => React.ReactNode;\n gridProperties?: (props: ReactGridLayoutProps) => ReactGridLayoutProps;\n}\n\nexport type ItemManipulationCallback = (eventData: {\n layout: Layouts;\n oldItem: Layout;\n newItem: Layout;\n placeholder: Layout;\n e: MouseEvent;\n element: HTMLElement;\n}) => void;\n"]}
@@ -25,7 +25,6 @@ export interface PluginWidgetProps<T = StringParams> {
25
25
  }) => void;
26
26
  }
27
27
  export type PluginDefaultLayout = Partial<Omit<WidgetLayout, 'i'>>;
28
- export type PluginRef = React.RefObject<any> | Record<string, unknown>;
29
28
  export interface Plugin<P extends PluginWidgetProps<T> = any, T = StringParams> extends PluginBase {
30
29
  defaultLayout?: PluginDefaultLayout;
31
30
  renderer: (props: P, forwardedRef: React.RefObject<any>) => React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"../../../src","sources":["typings/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import React from 'react';\n\nimport ReactGridLayout from 'react-grid-layout';\n\nimport type {\n ConfigItem,\n ItemState,\n ItemStateAndParams,\n ItemStateAndParamsChangeOptions,\n PluginBase,\n StringParams,\n} from '../shared';\n\nimport type {ContextProps, SettingsProps, WidgetLayout} from './common';\n\nexport interface PluginWidgetProps<T = StringParams> {\n id: string;\n editMode: boolean;\n params: T;\n state: ItemState;\n onStateAndParamsChange: (\n stateAndParams: ItemStateAndParams,\n options?: ItemStateAndParamsChangeOptions,\n ) => void;\n onBeforeLoad: () => () => void;\n width: number;\n height: number;\n data: ConfigItem['data'];\n defaults: ConfigItem['defaults'];\n namespace: ConfigItem['namespace'];\n settings: SettingsProps;\n context: ContextProps;\n layout: WidgetLayout[];\n gridLayout: ReactGridLayout.ReactGridLayoutProps;\n adjustWidgetLayout: (data: {\n widgetId: string;\n needSetDefault?: boolean;\n adjustedWidgetLayout?: WidgetLayout;\n }) => void;\n}\n\nexport type PluginDefaultLayout = Partial<Omit<WidgetLayout, 'i'>>;\n\nexport type PluginRef = React.RefObject<any> | Record<string, unknown>;\n\nexport interface Plugin<P extends PluginWidgetProps<T> = any, T = StringParams> extends PluginBase {\n defaultLayout?: PluginDefaultLayout;\n renderer: (props: P, forwardedRef: React.RefObject<any>) => React.ReactNode;\n placeholderRenderer?: (props: P, forwardedRef: React.RefObject<any>) => React.ReactNode;\n}\n"]}
1
+ {"version":3,"file":"plugin.js","sourceRoot":"../../../src","sources":["typings/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import React from 'react';\n\nimport ReactGridLayout from 'react-grid-layout';\n\nimport type {\n ConfigItem,\n ItemState,\n ItemStateAndParams,\n ItemStateAndParamsChangeOptions,\n PluginBase,\n StringParams,\n} from '../shared';\n\nimport type {ContextProps, SettingsProps, WidgetLayout} from './common';\n\nexport interface PluginWidgetProps<T = StringParams> {\n id: string;\n editMode: boolean;\n params: T;\n state: ItemState;\n onStateAndParamsChange: (\n stateAndParams: ItemStateAndParams,\n options?: ItemStateAndParamsChangeOptions,\n ) => void;\n onBeforeLoad: () => () => void;\n width: number;\n height: number;\n data: ConfigItem['data'];\n defaults: ConfigItem['defaults'];\n namespace: ConfigItem['namespace'];\n settings: SettingsProps;\n context: ContextProps;\n layout: WidgetLayout[];\n gridLayout: ReactGridLayout.ReactGridLayoutProps;\n adjustWidgetLayout: (data: {\n widgetId: string;\n needSetDefault?: boolean;\n adjustedWidgetLayout?: WidgetLayout;\n }) => void;\n}\n\nexport type PluginDefaultLayout = Partial<Omit<WidgetLayout, 'i'>>;\n\nexport interface Plugin<P extends PluginWidgetProps<T> = any, T = StringParams> extends PluginBase {\n defaultLayout?: PluginDefaultLayout;\n renderer: (props: P, forwardedRef: React.RefObject<any>) => React.ReactNode;\n placeholderRenderer?: (props: P, forwardedRef: React.RefObject<any>) => React.ReactNode;\n}\n"]}
@@ -73,7 +73,7 @@ export declare class DashKit extends React.PureComponent<DashKitInnerProps> {
73
73
  }): ConfigLayout[];
74
74
  metaRef: React.RefObject<GridLayout>;
75
75
  render(): JSX.Element;
76
- getItemsMeta(): Promise<any>[] | undefined;
76
+ getItemsMeta(): any;
77
77
  reloadItems(options?: {
78
78
  targetIds?: string[];
79
79
  force?: boolean;
@@ -1,59 +1,73 @@
1
- import React from 'react';
2
- import type { PluginRef, ReactGridLayoutProps } from 'src/typings';
3
- import type { DashKitCtxShape } from "../../context/index.js";
4
- import type { ConfigItem, ConfigLayout } from "../../shared/index.js";
5
- import type { AdjustWidgetLayoutParams, GridLayoutProps, GridLayoutState, GroupCallbacks, LayoutAndPropsByGroup, ManipulationCallbackArgs, MemoGroupLayout, ReloadItemsOptions } from "./types.js";
6
- export default class GridLayout extends React.PureComponent<GridLayoutProps, GridLayoutState> {
7
- static contextType: React.Context<DashKitCtxShape>;
8
- context: DashKitCtxShape;
9
- pluginsRefs: Array<PluginRef>;
10
- private _memoForwardedPluginRef;
11
- private _memoGroupsProps;
12
- private _memoGroupsLayouts;
13
- private _memoCallbacksForGroups;
14
- private _timeout?;
15
- private _lastReloadAt?;
16
- private _parendDragNode;
17
- constructor(props: GridLayoutProps, context: DashKitCtxShape);
1
+ export default class GridLayout extends React.PureComponent<any, any, any> {
2
+ static contextType: React.Context<import("../../context/index.js").DashKitCtxShape>;
3
+ constructor(props: any, context: any);
4
+ pluginsRefs: any[];
5
+ state: {
6
+ isDragging: boolean;
7
+ isDraggedOut: boolean;
8
+ isPageHidden: boolean;
9
+ currentDraggingElement: null;
10
+ draggedOverGroup: null;
11
+ };
18
12
  componentDidMount(): void;
19
13
  componentDidUpdate(): void;
20
14
  componentWillUnmount(): void;
15
+ _memoCallbacksForGroups: {};
16
+ _memoGroupsProps: {};
17
+ _memoGroupsLayouts: {};
18
+ _memoForwardedPluginRef: any[];
19
+ _timeout: any;
20
+ _lastReloadAt: any;
21
21
  onVisibilityChange: () => void;
22
- adjustWidgetLayout: ({ widgetId, needSetDefault, adjustedWidgetLayout, }: AdjustWidgetLayoutParams) => void;
23
- getItemsMeta: () => Promise<any>[];
24
- getActiveLayout(): ConfigLayout[];
25
- getMemoGroupLayout(group: string, layout: ConfigLayout[]): MemoGroupLayout;
26
- getMemoGroupCallbacks(group: string): GroupCallbacks;
27
- getMemoGroupProps: (group: string, renderLayout: ConfigLayout[], properties: Partial<ReactGridLayoutProps>) => {
28
- layout: ConfigLayout[];
29
- callbacks: GroupCallbacks;
22
+ adjustWidgetLayout: ({ widgetId, needSetDefault, adjustedWidgetLayout }: {
23
+ widgetId: any;
24
+ needSetDefault: any;
25
+ adjustedWidgetLayout: any;
26
+ }) => void;
27
+ getItemsMeta: () => any;
28
+ getActiveLayout(): any;
29
+ getMemoGroupLayout(group: any, layout: any): any;
30
+ getMemoGroupCallbacks(group: any): any;
31
+ getMemoGroupProps: (group: any, renderLayout: any, properties: any) => {
32
+ layout: any;
33
+ callbacks: any;
34
+ };
35
+ getLayoutAndPropsByGroup: (group: any) => {
36
+ properties: any;
37
+ layout: any;
30
38
  };
31
- getLayoutAndPropsByGroup: (group: string) => LayoutAndPropsByGroup;
32
- getMemoForwardRefCallback: (refIndex: number) => (pluginRef: PluginRef) => void;
33
- mergeGroupsLayout(group: string, newLayout: ConfigLayout[], temporaryItem?: ConfigLayout): ConfigLayout[];
34
- reloadItems(options?: ReloadItemsOptions): void;
35
- prepareDefaultArguments(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): ManipulationCallbackArgs;
36
- updateDraggingElementState(group: string, layoutItem: ConfigLayout, e: MouseEvent): void;
37
- _initDragCoordinatesWatcher(element: HTMLElement): void;
38
- _forceCursorCapture(parentElement: HTMLElement, position: {
39
- top: number;
40
- left: number;
41
- }, parentRect: DOMRect): void;
42
- _updateDragCoordinates(e: MouseEvent): void;
39
+ getMemoForwardRefCallback: (refIndex: any) => any;
40
+ mergeGroupsLayout(group: any, newLayout: any, temporaryItem: any): any;
41
+ reloadItems(options: any): void;
42
+ prepareDefaultArguments(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): {
43
+ group: any;
44
+ layout: any;
45
+ oldItem: any;
46
+ newItem: any;
47
+ placeholder: any;
48
+ e: any;
49
+ element: any;
50
+ };
51
+ updateDraggingElementState(group: any, layoutItem: any, e: any): void;
52
+ _initDragCoordinatesWatcher(element: any): void;
53
+ _parendDragNode: any;
54
+ _forceCursorCapture(parentElement: any, position: any, parentRect: any): void;
55
+ _updateDragCoordinates(e: any): void;
43
56
  _resetDragWatcher(): void;
44
- _onDragStart(group: string, _newLayout: ConfigLayout[], layoutItem: ConfigLayout, _newItem: ConfigLayout, _placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
45
- _onDrag(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
46
- _onDragStop(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
47
- _onResizeStart(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
48
- _onResize(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
49
- _onResizeStop(group: string, layout: ConfigLayout[], oldItem: ConfigLayout, newItem: ConfigLayout, placeholder: ConfigLayout, e: MouseEvent, element: HTMLElement): void;
57
+ _onDragStart(group: any, _newLayout: any, layoutItem: any, _newItem: any, _placeholder: any, e: any, element: any): void;
58
+ _onDrag(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): void;
59
+ _onDragStop(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): void;
60
+ _onResizeStart(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): void;
61
+ _onResize(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): void;
62
+ _onResizeStop(group: any, layout: any, oldItem: any, newItem: any, placeholder: any, e: any, element: any): void;
50
63
  _onTargetRestore(): void;
51
- _onStop: (group: string, newLayout: ConfigLayout[]) => void;
52
- _onSharedDrop: (targetGroup: string, newLayout: ConfigLayout[], tempItem: ConfigLayout) => void;
53
- _onExternalDrop: (group: string, newLayout: ConfigLayout[], item: ConfigLayout, e: MouseEvent) => void;
54
- _onDrop: (group: string, newLayout: ConfigLayout[], item: ConfigLayout | undefined, e: MouseEvent) => void | false;
55
- _onDropDragOver: (group: string, e: DragEvent | MouseEvent) => void | boolean;
56
- renderTemporaryPlaceholder(gridLayout: Partial<ReactGridLayoutProps>): JSX.Element | null;
57
- renderGroup(group: string, renderLayout: ConfigLayout[], renderItems: ConfigItem[], offset?: number, groupGridProperties?: (props: ReactGridLayoutProps) => ReactGridLayoutProps): JSX.Element;
58
- render(): JSX.Element | (string | number | boolean | JSX.Element | React.ReactFragment | null | undefined)[];
64
+ _onStop: (group: any, newLayout: any) => void;
65
+ _onSharedDrop: (targetGroup: any, newLayout: any, tempItem: any) => void;
66
+ _onExternalDrop: (group: any, newLayout: any, item: any, e: any) => void;
67
+ _onDrop: (group: any, newLayout: any, item: any, e: any) => false | undefined;
68
+ _onDropDragOver: (group: any, e: any) => any;
69
+ renderTemporaryPlaceholder(gridLayout: any): JSX.Element | null;
70
+ renderGroup(group: any, renderLayout: any, renderItems: any, offset: number | undefined, groupGridProperties: any): JSX.Element;
71
+ render(): any;
59
72
  }
73
+ import React from 'react';