@riboseinc/paneron-registry-kit 2.2.15 → 2.2.17

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/index.d.ts CHANGED
@@ -13,7 +13,9 @@ declare const _default: {
13
13
  incompleteItemRefToItemPathPrefix: typeof incompleteItemRefToItemPathPrefix;
14
14
  BrowserCtx: React.Context<BrowserCtx>;
15
15
  CRITERIA_CONFIGURATION: import("./views/FilterCriteria/models").CriteriaConfiguration;
16
- GenericRelatedItemView: React.FC<import("./types").GenericRelatedItemViewProps>;
16
+ GenericRelatedItemView: React.FC<import("./types").GenericRelatedItemViewProps & {
17
+ controlGroupProps?: import("@blueprintjs/core").IControlGroupProps | undefined;
18
+ }>;
17
19
  PropertyDetailView: React.FC<import("@blueprintjs/core").IFormGroupProps & {
18
20
  title?: React.ReactNode;
19
21
  secondaryTitle?: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riboseinc/paneron-registry-kit",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
4
4
  "main": "index.js",
5
5
  "author": "Ribose Inc. <open.source@ribose.com>",
6
6
  "scripts": {
package/types/views.d.ts CHANGED
@@ -154,6 +154,8 @@ export interface RegistryItemViewProps<P extends Payload> {
154
154
  export interface GenericRelatedItemViewProps {
155
155
  /** Currently selected item’s ref. */
156
156
  itemRef?: InternalItemReference;
157
+ /** Allows to grab a ref of the input displaying the selected item. */
158
+ inputRef?: React.Ref<HTMLInputElement>;
157
159
  /**
158
160
  * By default, clicking the item will spawn a tab via TabbedWorkspace context.
159
161
  * This prop can customize that behavior.
@@ -1 +1 @@
1
- {"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/types/views.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ButtonProps, MenuItemProps } from '@blueprintjs/core';\nimport type { ObjectDatasetRequest, ObjectDatasetResponse, ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport type { InternalItemReference, Payload, RegisterItem, RegisterItemClass } from './item';\nimport type { CriteriaGroup } from '../views/FilterCriteria/models';\n\n\n// Hooks\n\n/**\n * Mostly a wrapper around useObjectData, but coerces value type\n * (TODO: validate!) and takes into account change request from any\n * wrapping change request context. If a change request is present,\n * will substitute proposed item data unless `ignoreActiveCR` is set.\n *\n * NOTE: Despite the name, returns the entire RegisterItem,\n * not just the `.data` property with item payload.\n */\nexport type RegisterItemDataHook<P extends Payload = Payload> =\n (opts: { itemPaths: string[], ignoreActiveCR?: true }) => ValueHook<Record<string, RegisterItem<P> | null>>;\n\n\n// Extension configuration\n\n// TODO: Obsolete?\n// export interface ExtensionContext {\n// getRelatedItemClassConfiguration: (classID: string) => RelatedItemClassConfiguration\n// useRegisterItemData: RegisterItemDataHook\n// onJump?: () => void\n// }\n\nexport interface RegisterConfiguration\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> {\n /**\n * Configuration for all items in this register.\n * This includes items in subregisters.\n */\n itemClassConfiguration: Items\n\n /**\n * Default expression used to sort an item.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n /** Subregister information. */\n subregisters?: Subregisters<Items>\n}\n\nexport type Subregisters\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> = {\n [subregisterID: string]: {\n title: string\n\n /** Names of item classes that go in this subregister. */\n itemClasses: (keyof Items)[]\n }\n};\n\nexport type ItemClassConfigurationSet = {\n [itemClassID: string]: ItemClassConfiguration<any>\n};\n\n\n\nexport interface ExportFormatConfiguration<P extends Payload> {\n /** The name of the export format. */\n label: string\n\n /**\n * Trailing part of the filename to save export as;\n * must include at least extension (with separator),\n * must not include any path prefix.\n */\n filenameExtension: string\n\n /**\n * The function that takes register item data and some helper functions\n * and is expected to return a blob.\n */\n exportItem: (\n itemData: RegisterItem<P>,\n opts: {\n getObjectData: (opts: ObjectDatasetRequest) => Promise<ObjectDatasetResponse>,\n getBlob: (val: string) => Promise<Uint8Array>,\n logger?: { log: Console[\"log\"], error: Console[\"error\"], debug: Console[\"debug\"] },\n },\n ) => Promise<Uint8Array>\n}\n\n\nexport interface ItemClassConfiguration<P extends Payload/*, F extends Field*/> {\n meta: RegisterItemClass\n\n itemCanBeSuperseded?: boolean\n // If false, items of this class cannot be superseded, only retired.\n // Default is true.\n\n /** Used to pre-populate item data e.g. when a new item is created. */\n defaults?: RegistryItemPayloadDefaults<P>\n\n validatePayload?: (item: P) => Promise<boolean>\n sanitizePayload?: (item: P) => Promise<P>\n\n // XXX: Confirm if obsolete and remove\n itemSorter?: (a: P, b: P) => number\n\n /**\n * Expression used to sort an item of this class.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n exportFormats?: Readonly<ExportFormatConfiguration<P>[]>\n\n views: {\n listItemView: ItemListView<P>\n editView: ItemEditView<P>\n detailView?: ItemDetailView<P>\n }\n}\n\n\nexport interface RegistryViewProps\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>>\nextends RegisterConfiguration<Items> {\n /**\n * When search is initially opened, have this query pre-defined.\n * Not very useful since there are also preset searches in the browser now.\n */\n // TODO: Obsoluete?\n defaultSearchCriteria?: CriteriaGroup\n\n /**\n * Default predicate for matching items\n * using quick search.\n *\n * Must return the search expression as text.\n *\n * Search expression must return a boolean and can access:\n *\n * - `obj`, which *should* be a RegisterItem instance\n * with `obj.data` being its class-specific payload.\n *\n * E.g., if all important item classes in your register\n * specify a `name` field:\n *\n * @example (searchQuery) => `obj.data?.name?.toLowerCase().indexOf(\"${searchQuery.toLowerCase()}\") >= 0`\n */\n getQuickSearchPredicate?: (quickSearchQuery: string) => string\n\n /**\n * Extension-provided additional views that don’t correspond\n * to entities like register item, change request, etc. handled by RegistryKit.\n */\n customViews?: CustomViewConfiguration[]\n}\n\nexport interface CustomViewConfiguration {\n id: string\n label: string\n description: string\n view: React.FC<{\n /** View can support optional path for custom state/inner navigation (provisional). */\n path: string\n }>\n icon?: JSX.Element\n}\n\n\n// Item views\n\nexport interface ItemAction {\n getButtonProps:\n (item: RegisterItem<any>, itemClass: ItemClassConfiguration<any>, subregisterID?: string) =>\n ButtonProps | MenuItemProps\n}\n\nexport type RegistryView = React.FC<RegistryViewProps>\n\ntype RegistryItemPayloadDefaults<P extends Payload> =\n Partial<Omit<P, 'id'>>;\n\n/**\n * A small part of item class configuration,\n * useful e.g. for formatting related items.\n */\nexport type RelatedItemClassConfiguration = {\n title: string\n itemView: ItemListView<any>\n}\n\n\nexport interface RegistryItemViewProps<P extends Payload> {\n /**\n * Item reference.\n * Glossarist, for example, uses it to determine language subregister and set appropriate writing direction.\n */\n itemRef: Omit<InternalItemReference, 'itemID'> & { itemID?: InternalItemReference['itemID'] }\n\n /** Item data (payload). */\n itemData: P\n\n className?: string\n //subregisterID?: string\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\nexport interface GenericRelatedItemViewProps {\n /** Currently selected item’s ref. */\n itemRef?: InternalItemReference\n\n /**\n * By default, clicking the item will spawn a tab via TabbedWorkspace context.\n * This prop can customize that behavior.\n */\n onJump?: () => void\n\n className?: string\n\n /**\n * Determines which item classes can be selected in the search dialog.\n * If undefined, *any* class can be chosen.\n * If empty list, no class can be chosen (weird).\n */\n availableClassIDs?: string[]\n\n // XXX: Check if obsolete, remove if unused\n itemSorter?: ItemClassConfiguration<any>[\"itemSorter\"]\n\n /** Called to auto-create an item (can’t auto-create if not provided) */\n onCreateNew?: () => Promise<InternalItemReference>\n\n /** Called when current item is cleared (can’t clear if not provided) */\n onClear?: () => void\n\n /** Called when a new item is selected (can’t change if not provided) */\n onChange?: (newRef: InternalItemReference) => void\n\n /** @deprecated subregisters no longer supported. */\n availableSubregisterIDs?: string[]\n\n /** @deprecated */\n useRegisterItemData?: any\n //useRegisterItemData: RegisterItemDataHook\n\n /** @deprecated */\n getRelatedItemClassConfiguration?: any\n //getRelatedItemClassConfiguration: ExtensionContext[\"getRelatedItemClassConfiguration\"]\n}\n\n\nexport type ItemEditView<P extends Payload> = React.FC<ItemEditViewProps<P>>;\n\nexport interface ItemEditViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n onChange?: (newData: P) => void\n onCreateRelatedItem?:\n (classID: string, subregisterID?: string) => Promise<InternalItemReference>\n}\n\nexport interface ItemDetailViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n //useRegisterItemData: RegisterItemDataHook\n}\n\nexport type ItemDetailView<P extends Payload> = React.FC<ItemDetailViewProps<P>>;\n\nexport interface ItemListViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n}\n\nexport type ItemListView<P extends Payload> = React.FC<ItemListViewProps<P>>;\n\nexport type LazyItemView = React.FC<{ itemID: string }>;\n"]}
1
+ {"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/types/views.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ButtonProps, MenuItemProps } from '@blueprintjs/core';\nimport type { ObjectDatasetRequest, ObjectDatasetResponse, ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport type { InternalItemReference, Payload, RegisterItem, RegisterItemClass } from './item';\nimport type { CriteriaGroup } from '../views/FilterCriteria/models';\n\n\n// Hooks\n\n/**\n * Mostly a wrapper around useObjectData, but coerces value type\n * (TODO: validate!) and takes into account change request from any\n * wrapping change request context. If a change request is present,\n * will substitute proposed item data unless `ignoreActiveCR` is set.\n *\n * NOTE: Despite the name, returns the entire RegisterItem,\n * not just the `.data` property with item payload.\n */\nexport type RegisterItemDataHook<P extends Payload = Payload> =\n (opts: { itemPaths: string[], ignoreActiveCR?: true }) => ValueHook<Record<string, RegisterItem<P> | null>>;\n\n\n// Extension configuration\n\n// TODO: Obsolete?\n// export interface ExtensionContext {\n// getRelatedItemClassConfiguration: (classID: string) => RelatedItemClassConfiguration\n// useRegisterItemData: RegisterItemDataHook\n// onJump?: () => void\n// }\n\nexport interface RegisterConfiguration\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> {\n /**\n * Configuration for all items in this register.\n * This includes items in subregisters.\n */\n itemClassConfiguration: Items\n\n /**\n * Default expression used to sort an item.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n /** Subregister information. */\n subregisters?: Subregisters<Items>\n}\n\nexport type Subregisters\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> = {\n [subregisterID: string]: {\n title: string\n\n /** Names of item classes that go in this subregister. */\n itemClasses: (keyof Items)[]\n }\n};\n\nexport type ItemClassConfigurationSet = {\n [itemClassID: string]: ItemClassConfiguration<any>\n};\n\n\n\nexport interface ExportFormatConfiguration<P extends Payload> {\n /** The name of the export format. */\n label: string\n\n /**\n * Trailing part of the filename to save export as;\n * must include at least extension (with separator),\n * must not include any path prefix.\n */\n filenameExtension: string\n\n /**\n * The function that takes register item data and some helper functions\n * and is expected to return a blob.\n */\n exportItem: (\n itemData: RegisterItem<P>,\n opts: {\n getObjectData: (opts: ObjectDatasetRequest) => Promise<ObjectDatasetResponse>,\n getBlob: (val: string) => Promise<Uint8Array>,\n logger?: { log: Console[\"log\"], error: Console[\"error\"], debug: Console[\"debug\"] },\n },\n ) => Promise<Uint8Array>\n}\n\n\nexport interface ItemClassConfiguration<P extends Payload/*, F extends Field*/> {\n meta: RegisterItemClass\n\n itemCanBeSuperseded?: boolean\n // If false, items of this class cannot be superseded, only retired.\n // Default is true.\n\n /** Used to pre-populate item data e.g. when a new item is created. */\n defaults?: RegistryItemPayloadDefaults<P>\n\n validatePayload?: (item: P) => Promise<boolean>\n sanitizePayload?: (item: P) => Promise<P>\n\n // XXX: Confirm if obsolete and remove\n itemSorter?: (a: P, b: P) => number\n\n /**\n * Expression used to sort an item of this class.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n exportFormats?: Readonly<ExportFormatConfiguration<P>[]>\n\n views: {\n listItemView: ItemListView<P>\n editView: ItemEditView<P>\n detailView?: ItemDetailView<P>\n }\n}\n\n\nexport interface RegistryViewProps\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>>\nextends RegisterConfiguration<Items> {\n /**\n * When search is initially opened, have this query pre-defined.\n * Not very useful since there are also preset searches in the browser now.\n */\n // TODO: Obsoluete?\n defaultSearchCriteria?: CriteriaGroup\n\n /**\n * Default predicate for matching items\n * using quick search.\n *\n * Must return the search expression as text.\n *\n * Search expression must return a boolean and can access:\n *\n * - `obj`, which *should* be a RegisterItem instance\n * with `obj.data` being its class-specific payload.\n *\n * E.g., if all important item classes in your register\n * specify a `name` field:\n *\n * @example (searchQuery) => `obj.data?.name?.toLowerCase().indexOf(\"${searchQuery.toLowerCase()}\") >= 0`\n */\n getQuickSearchPredicate?: (quickSearchQuery: string) => string\n\n /**\n * Extension-provided additional views that don’t correspond\n * to entities like register item, change request, etc. handled by RegistryKit.\n */\n customViews?: CustomViewConfiguration[]\n}\n\nexport interface CustomViewConfiguration {\n id: string\n label: string\n description: string\n view: React.FC<{\n /** View can support optional path for custom state/inner navigation (provisional). */\n path: string\n }>\n icon?: JSX.Element\n}\n\n\n// Item views\n\nexport interface ItemAction {\n getButtonProps:\n (item: RegisterItem<any>, itemClass: ItemClassConfiguration<any>, subregisterID?: string) =>\n ButtonProps | MenuItemProps\n}\n\nexport type RegistryView = React.FC<RegistryViewProps>\n\ntype RegistryItemPayloadDefaults<P extends Payload> =\n Partial<Omit<P, 'id'>>;\n\n/**\n * A small part of item class configuration,\n * useful e.g. for formatting related items.\n */\nexport type RelatedItemClassConfiguration = {\n title: string\n itemView: ItemListView<any>\n}\n\n\nexport interface RegistryItemViewProps<P extends Payload> {\n /**\n * Item reference.\n * Glossarist, for example, uses it to determine language subregister and set appropriate writing direction.\n */\n itemRef: Omit<InternalItemReference, 'itemID'> & { itemID?: InternalItemReference['itemID'] }\n\n /** Item data (payload). */\n itemData: P\n\n className?: string\n //subregisterID?: string\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\nexport interface GenericRelatedItemViewProps {\n /** Currently selected item’s ref. */\n itemRef?: InternalItemReference\n\n /** Allows to grab a ref of the input displaying the selected item. */\n inputRef?: React.Ref<HTMLInputElement>\n\n /**\n * By default, clicking the item will spawn a tab via TabbedWorkspace context.\n * This prop can customize that behavior.\n */\n onJump?: () => void\n\n className?: string\n\n /**\n * Determines which item classes can be selected in the search dialog.\n * If undefined, *any* class can be chosen.\n * If empty list, no class can be chosen (weird).\n */\n availableClassIDs?: string[]\n\n // XXX: Check if obsolete, remove if unused\n itemSorter?: ItemClassConfiguration<any>[\"itemSorter\"]\n\n /** Called to auto-create an item (can’t auto-create if not provided) */\n onCreateNew?: () => Promise<InternalItemReference>\n\n /** Called when current item is cleared (can’t clear if not provided) */\n onClear?: () => void\n\n /** Called when a new item is selected (can’t change if not provided) */\n onChange?: (newRef: InternalItemReference) => void\n\n /** @deprecated subregisters no longer supported. */\n availableSubregisterIDs?: string[]\n\n /** @deprecated */\n useRegisterItemData?: any\n //useRegisterItemData: RegisterItemDataHook\n\n /** @deprecated */\n getRelatedItemClassConfiguration?: any\n //getRelatedItemClassConfiguration: ExtensionContext[\"getRelatedItemClassConfiguration\"]\n}\n\n\nexport type ItemEditView<P extends Payload> = React.FC<ItemEditViewProps<P>>;\n\nexport interface ItemEditViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n onChange?: (newData: P) => void\n onCreateRelatedItem?:\n (classID: string, subregisterID?: string) => Promise<InternalItemReference>\n}\n\nexport interface ItemDetailViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n //useRegisterItemData: RegisterItemDataHook\n}\n\nexport type ItemDetailView<P extends Payload> = React.FC<ItemDetailViewProps<P>>;\n\nexport interface ItemListViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n}\n\nexport type ItemListView<P extends Payload> = React.FC<ItemListViewProps<P>>;\n\nexport type LazyItemView = React.FC<{ itemID: string }>;\n"]}
@@ -1,6 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  /** @jsxFrag React.Fragment */
3
3
  import React from 'react';
4
+ import { type ControlGroupProps } from '@blueprintjs/core';
4
5
  import { type GenericRelatedItemViewProps } from '../types';
5
- export declare const GenericRelatedItemView: React.FC<GenericRelatedItemViewProps>;
6
+ export declare const GenericRelatedItemView: React.FC<GenericRelatedItemViewProps & {
7
+ controlGroupProps?: ControlGroupProps;
8
+ }>;
6
9
  export default GenericRelatedItemView;
@@ -7,7 +7,7 @@ exports.default = exports.GenericRelatedItemView = void 0;
7
7
 
8
8
  var _react = require("@emotion/react");
9
9
 
10
- var _react2 = require("react");
10
+ var _react2 = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _core = require("@blueprintjs/core");
13
13
 
@@ -25,6 +25,10 @@ var _ItemDrawer = _interopRequireDefault(require("./ItemDrawer"));
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
28
32
  /** @jsx jsx */
29
33
 
30
34
  /** @jsxFrag React.Fragment */
@@ -41,7 +45,9 @@ const GenericRelatedItemView = function ({
41
45
  onClear,
42
46
  onChange,
43
47
  availableClassIDs,
44
- onJump // availableSubregisterIDs,
48
+ onJump,
49
+ inputRef,
50
+ controlGroupProps // availableSubregisterIDs,
45
51
  // itemSorter,
46
52
 
47
53
  }) {
@@ -98,28 +104,27 @@ const GenericRelatedItemView = function ({
98
104
 
99
105
  return availableClassIDs !== null && availableClassIDs !== void 0 ? availableClassIDs : ((_a = itemRef === null || itemRef === void 0 ? void 0 : itemRef.classID) !== null && _a !== void 0 ? _a : '') !== '' ? [itemRef.classID] : [];
100
106
  }, [availableClassIDs === null || availableClassIDs === void 0 ? void 0 : availableClassIDs.join(','), itemRef === null || itemRef === void 0 ? void 0 : itemRef.classID]);
101
-
102
- function jump() {
103
- //jumpToItem?.(classID, itemID, subregisterID);
104
- onJump ? onJump() : jumpTo === null || jumpTo === void 0 ? void 0 : jumpTo(`${_protocolRegistry.Protocols.ITEM_DETAILS}:/${itemPathWithSubregister}`);
105
- }
106
-
107
107
  const hasItem = item !== null && classConfigured && (0, _types.isRegisterItem)(item);
108
108
  const itemIsMissing = itemID !== '' && item === null && !itemResult.isUpdating;
109
109
  const willShowItemView = hasItem || itemIsMissing || !onChange;
110
110
  const canJump = (item !== null || itemIsMissing) && classConfigured && !itemResult.isUpdating && (onJump || jumpTo);
111
+ const jump = (0, _react2.useCallback)(function jump() {
112
+ return onJump ? onJump() : jumpTo === null || jumpTo === void 0 ? void 0 : jumpTo(`${_protocolRegistry.Protocols.ITEM_DETAILS}:/${itemPathWithSubregister}`);
113
+ }, [onJump, jumpTo]);
111
114
  const itemView = (0, _react2.useMemo)(() => {
115
+ var _a;
116
+
112
117
  let itemView;
113
118
 
114
119
  if (hasItem) {
115
- itemView = (0, _react.jsx)(Item, {
120
+ itemView = (0, _react.jsx)(_react2.default.Fragment, null, (0, _react.jsx)(Item, {
116
121
  itemRef: {
117
122
  classID,
118
123
  itemID,
119
124
  subregisterID
120
125
  },
121
126
  itemData: item.data
122
- });
127
+ }), "\u2003", (0, _react.jsx)("small", null, (_a = cfg.title) !== null && _a !== void 0 ? _a : 'unknown class'));
123
128
  } else {
124
129
  if (itemIsMissing) {
125
130
  itemView = (0, _react.jsx)("span", null, "Item not found: ", itemID !== null && itemID !== void 0 ? itemID : 'N/A');
@@ -181,26 +186,38 @@ const GenericRelatedItemView = function ({
181
186
  return itemButtons;
182
187
  }, [itemID, itemResult.isUpdating, onCreateNew, onChange, onClear]); //log.debug("Rendering generic related item view: got item", item);
183
188
 
184
- return (0, _react.jsx)(_core.ButtonGroup, {
185
- fill: true,
189
+ return (0, _react.jsx)(_core.ControlGroup, {
186
190
  dir: "ltr",
187
191
  className: className,
188
- css: (0, _react.css)`.bp4-button-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }`
189
- }, classID ? (0, _react.jsx)(_core.Button, {
190
- alignText: "left",
191
- css: (0, _react.css)`width: 180px;`,
192
- title: `Item class: ${(_b = cfg.title) !== null && _b !== void 0 ? _b : "N/A"}`,
193
- outlined: true,
194
- disabled: true
195
- }, (_c = cfg.title) !== null && _c !== void 0 ? _c : "Class N/A") : null, willShowItemView ? (0, _react.jsx)(_core.Button, {
196
- alignText: "left",
192
+ title: hasItem ? `${(_b = cfg.title) !== null && _b !== void 0 ? _b : 'unknown class'} item ${itemID !== null && itemID !== void 0 ? itemID : 'with unknown ID'}` : undefined,
193
+ ...controlGroupProps
194
+ }, (0, _react.jsx)(_core.InputGroup, {
197
195
  fill: hasItem,
196
+ readOnly: !onChange && !onClear,
197
+ onChange: () => void 0,
198
+ inputRef: inputRef,
199
+ css: (0, _react.css)`
200
+ /* leftElement which displays itemView */
201
+ .bp4-input-left-container {
202
+ top: unset;
203
+ bottom: .45em;
204
+ padding-left: 10px;
205
+ padding-right: 5px;
206
+ white-space: nowrap;
207
+ overflow: hidden;
208
+ text-overflow: ellipsis;
209
+
210
+ max-width: 70%;
211
+ }
212
+ `,
213
+ leftElement: itemView,
214
+ value: itemID !== null && itemID !== void 0 ? itemID : '',
215
+ title: hasItem ? `${(_c = cfg.title) !== null && _c !== void 0 ? _c : 'unknown class'} item ${itemID !== null && itemID !== void 0 ? itemID : 'with unknown ID'}` : undefined
216
+ }), canJump ? (0, _react.jsx)(_core.Button, {
198
217
  outlined: true,
199
- disabled: !canJump,
200
218
  onClick: jump,
201
- loading: itemResult.isUpdating,
202
- title: hasItem ? `${cfg.title} (click to jump to item)` : undefined
203
- }, itemView) : null, itemButtons.map((props, idx) => (0, _react.jsx)(_core.Button, {
219
+ icon: "open-application"
220
+ }) : null, itemButtons.map((props, idx) => (0, _react.jsx)(_core.Button, {
204
221
  key: idx,
205
222
  outlined: true,
206
223
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"GenericRelatedItemView.js","sourceRoot":"","sources":["../../src/views/GenericRelatedItemView.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAc,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAGL,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,gBAAgB,MAAM,cAAc,CAAC;AAG5C,MAAM,SAAS,GAAG;IAChB,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;CACT,CAAC;AAGX,MAAM,CAAC,MAAM,sBAAsB,GAA0C,UAAU,EACrF,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,OAAO,EAAE,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AG,CAAA,sFAAsF;QAE/F,OAAO;YACN,CAAC,CAAC,IAAC,MAAM,IACH,SAAS,EAAC,MAAM,EAChB,GAAG,EAAE,GAAG,CAAA,eAAe,EACvB,KAAK,EAAE,eAAe,MAAA,GAAG,CAAC,KAAK,mCAAI,KAAK,EAAE,EAC1C,QAAQ,QAAC,QAAQ,UAClB,MAAA,GAAG,CAAC,KAAK,mCAAI,WAAW,CAClB;YACX,CAAC,CAAC,IAAI;QAEP,gBAAgB;YACf,CAAC,CAAC,IAAC,MAAM,IACH,SAAS,EAAC,MAAM,EAChB,IAAI,EAAE,OAAO,EAAE,QAAQ,QACvB,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,UAAU,CAAC,UAAU,EAC9B,KAAK,EAAE,OAAO;oBACZ,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,0BAA0B;oBACxC,CAAC,CAAC,SAAS,IACd,QAAQ,CACF;YACX,CAAC,CAAC,IAAI;QAEP,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAC9B,IAAC,MAAM,IAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,WAAK,KAAK,GAAI,CACzC;QAEA,QAAQ;YACP,CAAC,CAAC,IAAC,gBAAgB,IACf,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAC1C,YAAY,EAAE,QAAQ,EACtB,iBAAiB,EAAE,QAAQ,GAC3B;YACJ,CAAC,CAAC,IAAI,CACI,CACf,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,sBAAsB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport { jsx, css } from '@emotion/react';\nimport React, { useContext, useMemo, useState } from 'react';\nimport { Button, ButtonGroup, type ButtonProps } from '@blueprintjs/core';\nimport {\n type GenericRelatedItemViewProps,\n type RelatedItemClassConfiguration,\n isRegisterItem,\n} from '../types';\nimport { BrowserCtx } from './BrowserCtx';\nimport { ChangeRequestContext } from './change-request/ChangeRequestContext';\nimport { isDrafted } from '../types/cr';\nimport { Protocols } from './protocolRegistry';\nimport ItemSearchDrawer from './ItemDrawer';\n\n\nconst DUMMY_REF = {\n classID: '',\n itemID: '',\n subregisterID: '',\n} as const;\n\n\nexport const GenericRelatedItemView: React.FC<GenericRelatedItemViewProps> = function ({\n itemRef, className,\n onCreateNew, onClear, onChange,\n availableClassIDs,\n onJump,\n // availableSubregisterIDs,\n // itemSorter,\n}) {\n const {\n useRegisterItemData,\n getRelatedItemClassConfiguration,\n jumpTo,\n } = useContext(BrowserCtx);\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n const { classID, itemID, subregisterID } = itemRef ?? DUMMY_REF;\n\n const itemPathWithClass = `${classID}/${itemID}.yaml`;\n // If curretn register has subregisters, specify subregister-relative path\n const itemPathWithSubregister = subregisterID\n ? `subregisters/${subregisterID}/${itemPathWithClass}`\n : `${itemPathWithClass}`;\n // If a change request is active\n // and this item is among clarifications or additions\n // then use item path relative to the change request\n const affectedByActiveCR = (\n activeChangeRequest &&\n isDrafted(activeChangeRequest) &&\n activeChangeRequest.items[itemPathWithSubregister]\n );\n const itemPath = affectedByActiveCR\n ? `/proposals/${activeChangeRequest.id}/items/${itemPathWithSubregister}`\n : `/${itemPathWithSubregister}`;\n\n const [selectDialogState, setSelectDialogState] = useState(false);\n\n //log.debug(\"Rendering generic related item view\", itemRef);\n //const { jumpToItem } = useContext(BrowserCtx);\n\n const itemResult = useRegisterItemData({ itemPaths: [itemPath] });\n const item = (itemResult.value?.[itemPath] || null);\n\n const [classConfigured, cfg]: [boolean, RelatedItemClassConfiguration] = useMemo(() => {\n let classConfigured: boolean;\n let cfg: RelatedItemClassConfiguration;\n try {\n cfg = getRelatedItemClassConfiguration(classID);\n classConfigured = true;\n } catch (e) {\n cfg = {\n title: classID,\n itemView: () => <span>{itemID}</span>\n };\n classConfigured = false;\n }\n return [classConfigured, cfg];\n }, [itemID, classID, getRelatedItemClassConfiguration]);\n\n const Item = cfg.itemView;\n\n const classIDs = useMemo((() =>\n availableClassIDs ?? ((itemRef?.classID ?? '') !== '' ? [itemRef!.classID] : [])\n ), [availableClassIDs?.join(','), itemRef?.classID]);\n\n function jump() {\n //jumpToItem?.(classID, itemID, subregisterID);\n onJump\n ? onJump()\n : jumpTo?.(`${Protocols.ITEM_DETAILS}:/${itemPathWithSubregister}`);\n }\n\n const hasItem = item !== null && classConfigured && isRegisterItem(item);\n const itemIsMissing = itemID !== '' && (item === null && !itemResult.isUpdating);\n const willShowItemView = hasItem || itemIsMissing || !onChange;\n const canJump = (item !== null || itemIsMissing) && classConfigured && !itemResult.isUpdating && (onJump || jumpTo);\n\n const itemView: JSX.Element | null = useMemo(() => {\n let itemView: JSX.Element | null;\n\n if (hasItem) {\n itemView = <Item\n itemRef={{ classID, itemID, subregisterID }}\n itemData={item.data}\n />;\n } else {\n if (itemIsMissing) {\n itemView = <span>Item not found: {itemID ?? 'N/A'}</span>;\n } else {\n itemView = <span>Item not specified</span>;\n }\n }\n return itemView;\n }, [itemID, classID, subregisterID, item, hasItem, itemIsMissing]);\n\n const itemButtons = useMemo(() => {\n const canAutoCreateRelatedItem = itemID === '' && onCreateNew && !itemResult.isUpdating;\n const canChangeRelatedItem = /*classIDs.length >= 1 && */onChange && !itemResult.isUpdating;\n const canClear = onClear && itemID !== '' && !itemResult.isUpdating;\n\n let itemButtons: (ButtonProps & { title: string })[] = [];\n\n async function handleCreateNew() {\n if (!onCreateNew) { return; }\n const itemRef = await onCreateNew();\n console.debug(\"Created new item\", itemRef);\n }\n\n if (!hasItem && canAutoCreateRelatedItem) {\n itemButtons.push({\n onClick: handleCreateNew,\n icon: 'add',\n text: 'Auto create',\n intent: 'primary',\n title: \"Automatically create new item\",\n });\n }\n if (canChangeRelatedItem) {\n itemButtons.push({\n onClick: () => setSelectDialogState(true),\n icon: 'edit',\n text: willShowItemView ? undefined : 'Specify',\n intent: 'primary',\n title: \"Select related item\",\n /*disabled: classIDs.length < 1,*/\n });\n }\n if (canClear) {\n itemButtons.push({\n onClick: onClear,\n icon: 'eraser',\n intent: 'danger',\n title: \"Clear related item selection\",\n });\n }\n\n return itemButtons;\n }, [itemID, itemResult.isUpdating, onCreateNew, onChange, onClear]);\n\n //log.debug(\"Rendering generic related item view: got item\", item);\n return (\n <ButtonGroup\n fill\n dir=\"ltr\"\n className={className}\n css={css`.bp4-button-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }`}>\n\n {classID\n ? <Button\n alignText=\"left\"\n css={css`width: 180px;`}\n title={`Item class: ${cfg.title ?? \"N/A\"}`}\n outlined disabled>\n {cfg.title ?? \"Class N/A\"}\n </Button>\n : null}\n\n {willShowItemView\n ? <Button\n alignText=\"left\"\n fill={hasItem} outlined\n disabled={!canJump}\n onClick={jump}\n loading={itemResult.isUpdating}\n title={hasItem\n ? `${cfg.title} (click to jump to item)`\n : undefined}>\n {itemView}\n </Button>\n : null}\n\n {itemButtons.map((props, idx) =>\n <Button key={idx} outlined {...props} />\n )}\n\n {onChange\n ? <ItemSearchDrawer\n isOpen={selectDialogState}\n onClose={() => setSelectDialogState(false)}\n onChooseItem={onChange}\n availableClassIDs={classIDs}\n />\n : null}\n </ButtonGroup>\n );\n};\n\n\nexport default GenericRelatedItemView;\n"]}
1
+ {"version":3,"file":"GenericRelatedItemView.js","sourceRoot":"","sources":["../../src/views/GenericRelatedItemView.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAA4C,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAGL,c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AE;gBACvE,CAAC,CAAC,SAAS,GACb;QAED,OAAO;YACN,CAAC,CAAC,IAAC,MAAM,IAAC,QAAQ,QAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,kBAAkB,GAAG;YAC5D,CAAC,CAAC,IAAI;QAEP,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAC9B,IAAC,MAAM,IAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,WAAK,KAAK,GAAI,CACzC;QAEA,QAAQ;YACP,CAAC,CAAC,IAAC,gBAAgB,IACf,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAC1C,YAAY,EAAE,QAAQ,EACtB,iBAAiB,EAAE,QAAQ,GAC3B;YACJ,CAAC,CAAC,IAAI,CACK,CAChB,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,sBAAsB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport { jsx, css } from '@emotion/react';\nimport React, { useContext, useCallback, useMemo, useState } from 'react';\nimport { InputGroup, Button, ControlGroup, type ControlGroupProps, type ButtonProps } from '@blueprintjs/core';\nimport {\n type GenericRelatedItemViewProps,\n type RelatedItemClassConfiguration,\n isRegisterItem,\n} from '../types';\nimport { BrowserCtx } from './BrowserCtx';\nimport { ChangeRequestContext } from './change-request/ChangeRequestContext';\nimport { isDrafted } from '../types/cr';\nimport { Protocols } from './protocolRegistry';\nimport ItemSearchDrawer from './ItemDrawer';\n\n\nconst DUMMY_REF = {\n classID: '',\n itemID: '',\n subregisterID: '',\n} as const;\n\n\nexport const GenericRelatedItemView: React.FC<GenericRelatedItemViewProps & {\n controlGroupProps?: ControlGroupProps\n}> = function ({\n itemRef, className,\n onCreateNew, onClear, onChange,\n availableClassIDs,\n onJump,\n inputRef,\n controlGroupProps,\n // availableSubregisterIDs,\n // itemSorter,\n}) {\n const {\n useRegisterItemData,\n getRelatedItemClassConfiguration,\n jumpTo,\n } = useContext(BrowserCtx);\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n const { classID, itemID, subregisterID } = itemRef ?? DUMMY_REF;\n\n const itemPathWithClass = `${classID}/${itemID}.yaml`;\n // If curretn register has subregisters, specify subregister-relative path\n const itemPathWithSubregister = subregisterID\n ? `subregisters/${subregisterID}/${itemPathWithClass}`\n : `${itemPathWithClass}`;\n // If a change request is active\n // and this item is among clarifications or additions\n // then use item path relative to the change request\n const affectedByActiveCR = (\n activeChangeRequest &&\n isDrafted(activeChangeRequest) &&\n activeChangeRequest.items[itemPathWithSubregister]\n );\n const itemPath = affectedByActiveCR\n ? `/proposals/${activeChangeRequest.id}/items/${itemPathWithSubregister}`\n : `/${itemPathWithSubregister}`;\n\n const [selectDialogState, setSelectDialogState] = useState(false);\n\n //log.debug(\"Rendering generic related item view\", itemRef);\n //const { jumpToItem } = useContext(BrowserCtx);\n\n const itemResult = useRegisterItemData({ itemPaths: [itemPath] });\n const item = (itemResult.value?.[itemPath] || null);\n\n const [classConfigured, cfg]: [boolean, RelatedItemClassConfiguration] = useMemo(() => {\n let classConfigured: boolean;\n let cfg: RelatedItemClassConfiguration;\n try {\n cfg = getRelatedItemClassConfiguration(classID);\n classConfigured = true;\n } catch (e) {\n cfg = {\n title: classID,\n itemView: () => <span>{itemID}</span>\n };\n classConfigured = false;\n }\n return [classConfigured, cfg];\n }, [itemID, classID, getRelatedItemClassConfiguration]);\n\n const Item = cfg.itemView;\n\n const classIDs = useMemo((() =>\n availableClassIDs ?? ((itemRef?.classID ?? '') !== '' ? [itemRef!.classID] : [])\n ), [availableClassIDs?.join(','), itemRef?.classID]);\n\n const hasItem = item !== null && classConfigured && isRegisterItem(item);\n const itemIsMissing = itemID !== '' && (item === null && !itemResult.isUpdating);\n const willShowItemView = hasItem || itemIsMissing || !onChange;\n const canJump = (item !== null || itemIsMissing) && classConfigured && !itemResult.isUpdating && (onJump || jumpTo);\n\n const jump = useCallback(function jump() {\n return onJump\n ? onJump()\n : jumpTo?.(`${Protocols.ITEM_DETAILS}:/${itemPathWithSubregister}`);\n }, [onJump, jumpTo]);\n\n const itemView: JSX.Element | null = useMemo(() => {\n let itemView: JSX.Element | null;\n\n if (hasItem) {\n itemView = <>\n <Item\n itemRef={{ classID, itemID, subregisterID }}\n itemData={item.data}\n />&emsp;<small>{cfg.title ?? 'unknown class'}</small>\n </>;\n } else {\n if (itemIsMissing) {\n itemView = <span>Item not found: {itemID ?? 'N/A'}</span>;\n } else {\n itemView = <span>Item not specified</span>;\n }\n }\n return itemView;\n }, [itemID, classID, subregisterID, item, hasItem, itemIsMissing]);\n\n const itemButtons = useMemo(() => {\n const canAutoCreateRelatedItem = itemID === '' && onCreateNew && !itemResult.isUpdating;\n const canChangeRelatedItem = /*classIDs.length >= 1 && */onChange && !itemResult.isUpdating;\n const canClear = onClear && itemID !== '' && !itemResult.isUpdating;\n\n let itemButtons: (ButtonProps & { title: string })[] = [];\n\n async function handleCreateNew() {\n if (!onCreateNew) { return; }\n const itemRef = await onCreateNew();\n console.debug(\"Created new item\", itemRef);\n }\n\n if (!hasItem && canAutoCreateRelatedItem) {\n itemButtons.push({\n onClick: handleCreateNew,\n icon: 'add',\n text: 'Auto create',\n intent: 'primary',\n title: \"Automatically create new item\",\n });\n }\n if (canChangeRelatedItem) {\n itemButtons.push({\n onClick: () => setSelectDialogState(true),\n icon: 'edit',\n text: willShowItemView ? undefined : 'Specify',\n intent: 'primary',\n title: \"Select related item\",\n /*disabled: classIDs.length < 1,*/\n });\n }\n if (canClear) {\n itemButtons.push({\n onClick: onClear,\n icon: 'eraser',\n intent: 'danger',\n title: \"Clear related item selection\",\n });\n }\n\n return itemButtons;\n }, [itemID, itemResult.isUpdating, onCreateNew, onChange, onClear]);\n\n //log.debug(\"Rendering generic related item view: got item\", item);\n return (\n <ControlGroup\n dir=\"ltr\"\n className={className}\n title={hasItem\n ? `${cfg.title ?? 'unknown class'} item ${itemID ?? 'with unknown ID'}`\n : undefined}\n {...controlGroupProps}>\n\n <InputGroup\n fill={hasItem}\n readOnly={!onChange && !onClear}\n onChange={() => void 0}\n inputRef={inputRef}\n css={css`\n /* leftElement which displays itemView */\n .bp4-input-left-container {\n top: unset;\n bottom: .45em;\n padding-left: 10px;\n padding-right: 5px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n\n max-width: 70%;\n }\n `}\n leftElement={itemView}\n value={itemID ?? ''}\n title={hasItem\n ? `${cfg.title ?? 'unknown class'} item ${itemID ?? 'with unknown ID'}`\n : undefined}\n />\n\n {canJump\n ? <Button outlined onClick={jump} icon=\"open-application\" />\n : null}\n\n {itemButtons.map((props, idx) =>\n <Button key={idx} outlined {...props} />\n )}\n\n {onChange\n ? <ItemSearchDrawer\n isOpen={selectDialogState}\n onClose={() => setSelectDialogState(false)}\n onChooseItem={onChange}\n availableClassIDs={classIDs}\n />\n : null}\n </ControlGroup>\n );\n};\n\n\nexport default GenericRelatedItemView;\n"]}
@@ -47,6 +47,7 @@ const ItemSearchDrawer = function ({
47
47
  isOpen: isOpen,
48
48
  onClose: onClose,
49
49
  enforceFocus: false,
50
+ size: "50vw",
50
51
  style: {
51
52
  padding: '0',
52
53
  width: 'unset'
@@ -54,9 +55,9 @@ const ItemSearchDrawer = function ({
54
55
  }, (0, _react.jsx)(_Search.default, {
55
56
  style: {
56
57
  height: '100vh',
57
- width: '80vw',
58
+ width: '50vw',
58
59
  minWidth: '500px',
59
- maxWidth: '100vw'
60
+ maxWidth: '90vw'
60
61
  },
61
62
  availableClassIDs: availableClassIDs,
62
63
  implicitCriteria: implicitCriteria,
@@ -1 +1 @@
1
- {"version":3,"file":"ItemDrawer.js","sourceRoot":"","sources":["../../src/views/ItemDrawer.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAc,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW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AAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;QACzC,IAAC,MAAM,IACL,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAC/E,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAC,kCAAkC,EAC5C,UAAU,EAAE,cAAc,GAC1B,CACK,CACV,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,gBAAgB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport { jsx } from '@emotion/react';\nimport React, { useContext, useMemo, useCallback } from 'react';\nimport { Drawer } from '@blueprintjs/core';\nimport type { InternalItemReference } from '../types';\nimport type { Criterion, CriteriaGroup } from './FilterCriteria/models';\nimport { BrowserCtx } from './BrowserCtx';\nimport Search from './sidebar/Search';\nimport { itemPathToItemRef } from './itemPathUtils';\n\n\nconst ItemSearchDrawer: React.FC<{\n isOpen: boolean\n onClose: () => void\n onChooseItem: (itemRef: InternalItemReference) => void\n availableClassIDs: string[]\n}> = function ({\n isOpen, onClose, onChooseItem,\n availableClassIDs,\n}) {\n const { subregisters } = useContext(BrowserCtx);\n\n const classCriteria: Criterion[] = useMemo(() => (\n availableClassIDs.map(clsID => ({\n key: 'item-class',\n query: `objPath.indexOf(\\\"/${clsID}/\\\") >= 0`,\n }))\n ), [availableClassIDs.toString()]);\n\n const implicitCriteria: CriteriaGroup | undefined = useMemo(() => (\n classCriteria.length > 0\n ? {\n require: 'any',\n criteria: classCriteria,\n }\n : undefined\n ), [classCriteria]);\n\n const handleOpenItem = useCallback((itemPath) => {\n onChooseItem(itemPathToItemRef(subregisters !== undefined, itemPath));\n onClose();\n }, [onChooseItem, onClose]);\n\n return (\n <Drawer\n isOpen={isOpen}\n onClose={onClose}\n enforceFocus={false}\n style={{ padding: '0', width: 'unset' }}>\n <Search\n style={{ height: '100vh', width: '80vw', minWidth: '500px', maxWidth: '100vw' }}\n availableClassIDs={availableClassIDs}\n implicitCriteria={implicitCriteria}\n stateName=\"superseding-item-selector-search\"\n onOpenItem={handleOpenItem}\n />\n </Drawer>\n );\n};\n\n\nexport default ItemSearchDrawer;\n"]}
1
+ {"version":3,"file":"ItemDrawer.js","sourceRoot":"","sources":["../../src/views/ItemDrawer.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAc,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,gBAAgB,GAKjB,UAAU,EACb,MAAM,EAAE,OAAO,EAAE,YAAY,EAC7B,iBAAiB,GAClB;IACC,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAEhD,MAAM,aAAa,GAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAC/C,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,YAAY;QACjB,KAAK,EAAE,sBAAsB,KAAK,WAAW;KAC9C,CAAC,CAAC,CACJ,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAEnC,MAAM,gBAAgB,GAA8B,OAAO,CAAC,GAAG,EAAE,CAAC,CAChE,aAAa,CAAC,MAAM,GAAG,CAAC;QACtB,CAAC,CAAC;YACE,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,aAAa;SACxB;QACH,CAAC,CAAC,SAAS,CACd,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC9C,YAAY,CAAC,iBAAiB,CAAC,YAAY,KAAK,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtE,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5B,OAAO,CACL,IAAC,MAAM,IACH,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,KAAK,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;QACzC,IAAC,MAAM,IACL,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAC9E,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAC,kCAAkC,EAC5C,UAAU,EAAE,cAAc,GAC1B,CACK,CACV,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,gBAAgB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport { jsx } from '@emotion/react';\nimport React, { useContext, useMemo, useCallback } from 'react';\nimport { Drawer } from '@blueprintjs/core';\nimport type { InternalItemReference } from '../types';\nimport type { Criterion, CriteriaGroup } from './FilterCriteria/models';\nimport { BrowserCtx } from './BrowserCtx';\nimport Search from './sidebar/Search';\nimport { itemPathToItemRef } from './itemPathUtils';\n\n\nconst ItemSearchDrawer: React.FC<{\n isOpen: boolean\n onClose: () => void\n onChooseItem: (itemRef: InternalItemReference) => void\n availableClassIDs: string[]\n}> = function ({\n isOpen, onClose, onChooseItem,\n availableClassIDs,\n}) {\n const { subregisters } = useContext(BrowserCtx);\n\n const classCriteria: Criterion[] = useMemo(() => (\n availableClassIDs.map(clsID => ({\n key: 'item-class',\n query: `objPath.indexOf(\\\"/${clsID}/\\\") >= 0`,\n }))\n ), [availableClassIDs.toString()]);\n\n const implicitCriteria: CriteriaGroup | undefined = useMemo(() => (\n classCriteria.length > 0\n ? {\n require: 'any',\n criteria: classCriteria,\n }\n : undefined\n ), [classCriteria]);\n\n const handleOpenItem = useCallback((itemPath) => {\n onChooseItem(itemPathToItemRef(subregisters !== undefined, itemPath));\n onClose();\n }, [onChooseItem, onClose]);\n\n return (\n <Drawer\n isOpen={isOpen}\n onClose={onClose}\n enforceFocus={false}\n size=\"50vw\"\n style={{ padding: '0', width: 'unset' }}>\n <Search\n style={{ height: '100vh', width: '50vw', minWidth: '500px', maxWidth: '90vw' }}\n availableClassIDs={availableClassIDs}\n implicitCriteria={implicitCriteria}\n stateName=\"superseding-item-selector-search\"\n onOpenItem={handleOpenItem}\n />\n </Drawer>\n );\n};\n\n\nexport default ItemSearchDrawer;\n"]}
@@ -6,12 +6,13 @@ import type { ChangeProposal, Clarification, InternalItemReference, Payload, Reg
6
6
  import type { Drafted } from '../../types/cr';
7
7
  interface ProposalBrowserProps<CR extends Drafted> {
8
8
  proposals: CR['items'];
9
+ selectedItem?: (string & keyof CR['items']) | null;
10
+ onSelectItem: (selectedItem: (string & keyof CR['items']) | null) => void;
9
11
  /**
10
12
  * If provided, button to delete each proposed change
11
13
  * is shown in change card list mode.
12
14
  */
13
15
  onDeleteProposalForItemAtPath?: (itemPath: string) => void;
14
- className?: string;
15
16
  }
16
17
  /**
17
18
  * Shows a list of individual proposed changes as cards by default,
@@ -19,7 +20,7 @@ interface ProposalBrowserProps<CR extends Drafted> {
19
20
  *
20
21
  * If no proposals exist, returns null.
21
22
  */
22
- export declare function Proposals<CR extends Drafted>({ proposals, onDeleteProposalForItemAtPath, className }: ProposalBrowserProps<CR>): jsx.JSX.Element | null;
23
+ export declare function Proposals<CR extends Drafted>({ proposals, onDeleteProposalForItemAtPath, selectedItem, onSelectItem: selectProposal }: ProposalBrowserProps<CR>): jsx.JSX.Element;
23
24
  interface ProposalProps<P extends ChangeProposal> {
24
25
  proposal: P;
25
26
  /** Highlight changes. */
@@ -59,12 +59,13 @@ function stringifiedJSONEqual(i1, i2) {
59
59
  function Proposals({
60
60
  proposals,
61
61
  onDeleteProposalForItemAtPath,
62
- className
62
+ selectedItem,
63
+ onSelectItem: selectProposal
63
64
  }) {
64
- var _a, _b;
65
+ var _a;
65
66
 
66
- const [selectedProposal, selectProposal] = (0, _react.useState)(null);
67
- const [preferDiff, setPreferDiff] = (0, _react.useState)(false); // TODO: Temporarily unsupported
67
+ const [preferDiff, setPreferDiff] = (0, _react.useState)(false);
68
+ const selectedProposal = selectedItem !== null && selectedItem !== void 0 ? selectedItem : null; // TODO: Temporarily unsupported
68
69
  // (limitations of current change annotation implementation)
69
70
  //const [ showOnlyChanged, setShowOnlyChanged ] = useState(true);
70
71
 
@@ -150,156 +151,133 @@ function Proposals({
150
151
  };
151
152
  }), [proposals, getCurrentItem, getProposedItem]);
152
153
  const haveSelectedItem = selectedProposal && selectedItemRef && proposals[selectedProposal] && (selectedItemProposed || selectedItemCurrent);
153
- const proposalCount = Object.keys(proposals).length;
154
- const selectedProposalDetailRef = (0, _react.useRef)(null);
155
- (0, _react.useEffect)(() => {
156
- // if (!selectedProposal) {
157
- // const firstProposal = Object.keys(proposals)[0];
158
- // if (firstProposal) {
159
- // if (getCurrentItem(firstProposal) || getProposedItem(firstProposal)) {
160
- // selectProposal(firstProposal);
161
- // }
162
- // }
163
- // }
164
- if (selectedProposal) {
165
- if (selectedProposalDetailRef.current) {
166
- selectedProposalDetailRef.current.scrollIntoView({
167
- block: 'center'
168
- });
169
- }
170
- }
171
- }, [selectedProposal === null]);
154
+ const proposalCount = Object.keys(proposals).length; //useEffect(() => {
155
+ // // if (!selectedProposal) {
156
+ // // const firstProposal = Object.keys(proposals)[0];
157
+ // // if (firstProposal) {
158
+ // // if (getCurrentItem(firstProposal) || getProposedItem(firstProposal)) {
159
+ // // selectProposal(firstProposal);
160
+ // // }
161
+ // // }
162
+ // // }
163
+ // if (selectedProposal) {
164
+ // if (selectedProposalDetailRef.current) {
165
+ // selectedProposalDetailRef.current.scrollIntoView({ block: 'center' });
166
+ // }
167
+ // }
168
+ //}, [selectedProposal === null]);
169
+
172
170
  const canShowDiff = haveSelectedItem && ((_a = proposals[selectedProposal]) === null || _a === void 0 ? void 0 : _a.type) === 'clarification' ? true : false;
173
171
  const showDiff = canShowDiff && preferDiff;
172
+ const selectedItemSummary = haveSelectedItem ? (0, _react2.jsx)(ProposalSummary, {
173
+ itemRef: selectedItemRef,
174
+ item: selectedItemProposed !== null && selectedItemProposed !== void 0 ? selectedItemProposed : selectedItemCurrent,
175
+ itemBefore: selectedItemCurrent !== null && selectedItemCurrent !== void 0 ? selectedItemCurrent : undefined,
176
+ proposal: proposals[selectedProposal]
177
+ }) : (0, _react2.jsx)(_react.default.Fragment, null, "Select item\u2026");
178
+ const icon = haveSelectedItem ? getProposalIcon(proposals[selectedProposal]) : undefined;
179
+ const selectedItemDrawer = (0, _react.useMemo)(() => {
180
+ var _a;
174
181
 
175
- if (!currentItemDataReq.isUpdating && !proposedItemDataReq.isUpdating) {
176
- const selectedItemSummary = haveSelectedItem ? (0, _react2.jsx)(ProposalSummary, {
182
+ return (0, _react2.jsx)(_core.Drawer, {
183
+ isOpen: proposalCount > 0 && haveSelectedItem ? true : false,
184
+ onClose: () => selectProposal(null),
185
+ size: _core.DrawerSize.LARGE,
186
+ enforceFocus: false
187
+ }, proposalCount > 0 && haveSelectedItem ? (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_core.ButtonGroup, null, (0, _react2.jsx)(_core.Button, {
188
+ disabled: !jumpTo || ((_a = proposals[selectedProposal]) === null || _a === void 0 ? void 0 : _a.type) === 'addition',
189
+ icon: 'open-application',
190
+ onClick: () => jumpTo === null || jumpTo === void 0 ? void 0 : jumpTo(`${_protocolRegistry.Protocols.ITEM_DETAILS}:${selectedProposal}`),
191
+ title: "Open selected item in a new tab (not applicable to proposed additions)"
192
+ }), (0, _react2.jsx)(_core.Button, {
193
+ active: preferDiff,
194
+ onClick: () => setPreferDiff(v => !v),
195
+ // Diffing only makes sense for clarifications.
196
+ // Additions are entire new items, and for amendments
197
+ // item data is unchanged.
198
+ disabled: !canShowDiff,
199
+ text: "Compare",
200
+ title: "Annotate proposed clarifications for this item"
201
+ }), (0, _react2.jsx)(_react2.ClassNames, null, ({
202
+ css: css2
203
+ }) => (0, _react2.jsx)(_select.Select2, {
204
+ filterable: false,
205
+ itemsEqual: stringifiedJSONEqual,
206
+ menuProps: {
207
+ className: css2(`max-height: 50vh; overflow-y: auto;`)
208
+ },
209
+ activeItem: activeItem,
210
+ items: allItems,
211
+ popoverProps: {
212
+ minimal: true,
213
+ matchTargetWidth: true
214
+ },
215
+ fill: true,
216
+ itemRenderer: ChangeProposalItemView,
217
+ onItemSelect: handleItemSelect
218
+ }, (0, _react2.jsx)(_core.Button, {
219
+ fill: true,
220
+ rightIcon: "chevron-down",
221
+ icon: icon,
222
+ css: (0, _react2.css)`white-space: nowrap;`
223
+ }, selectedItemSummary))), (0, _react2.jsx)(_core.Button, {
224
+ onClick: () => selectProposal(null),
225
+ icon: "minimize",
226
+ title: "Minimize proposed change view",
227
+ text: "Minimize"
228
+ })), (0, _react2.jsx)("div", {
229
+ css: (0, _react2.css)`position: relative; flex: 1;`
230
+ }, (0, _react2.jsx)(_BrowserCtx.BrowserCtx.Provider, {
231
+ value: proposalBrowserCtx
232
+ }, (0, _react2.jsx)(_ErrorBoundary.default, {
233
+ viewName: "Proposal detail"
234
+ }, (0, _react2.jsx)(ProposalDetail, {
177
235
  itemRef: selectedItemRef,
236
+ showDiff: showDiff,
237
+ //showOnlyChanged={showOnlyChanged}
178
238
  item: selectedItemProposed !== null && selectedItemProposed !== void 0 ? selectedItemProposed : selectedItemCurrent,
179
239
  itemBefore: selectedItemCurrent !== null && selectedItemCurrent !== void 0 ? selectedItemCurrent : undefined,
180
240
  proposal: proposals[selectedProposal]
181
- }) : (0, _react2.jsx)(_react.default.Fragment, null, "Select item\u2026");
182
- const icon = haveSelectedItem ? getProposalIcon(proposals[selectedProposal]) : undefined;
183
-
184
- if (proposalCount > 0 && haveSelectedItem) {
185
- return (0, _react2.jsx)(_core.Card, {
186
- key: selectedProposal,
187
- elevation: 0,
188
- css: (0, _react2.css)`
189
- flex: 100%;
190
- background: ${_core.Colors.LIGHT_GRAY3};
191
- padding: 0;
192
- min-height: 70vh;
193
-
194
- overflow: hidden;
195
-
196
- border-radius: 5px;
197
- display: flex;
198
- flex-flow: column nowrap;
199
- transition:
200
- width .5s linear
201
- height .5s linear;
202
- `,
203
- className: className
204
- }, (0, _react2.jsx)(_core.ButtonGroup, null, (0, _react2.jsx)(_core.Button, {
205
- disabled: !jumpTo || ((_b = proposals[selectedProposal]) === null || _b === void 0 ? void 0 : _b.type) === 'addition',
206
- icon: 'open-application',
207
- onClick: () => jumpTo === null || jumpTo === void 0 ? void 0 : jumpTo(`${_protocolRegistry.Protocols.ITEM_DETAILS}:${selectedProposal}`),
208
- title: "Open selected item in a new tab (not applicable to proposed additions)"
209
- }), (0, _react2.jsx)(_core.Button, {
210
- active: preferDiff,
211
- onClick: () => setPreferDiff(v => !v),
212
- // Diffing only makes sense for clarifications.
213
- // Additions are entire new items, and for amendments
214
- // item data is unchanged.
215
- disabled: !canShowDiff,
216
- text: "Compare",
217
- title: "Annotate proposed clarifications for this item"
218
- }), (0, _react2.jsx)(_react2.ClassNames, null, ({
219
- css: css2
220
- }) => (0, _react2.jsx)(_select.Select2, {
221
- filterable: false,
222
- itemsEqual: stringifiedJSONEqual,
223
- menuProps: {
224
- className: css2(`max-height: 50vh; overflow-y: auto;`)
225
- },
226
- activeItem: activeItem,
227
- items: allItems,
228
- popoverProps: {
229
- minimal: true,
230
- matchTargetWidth: true
231
- },
232
- fill: true,
233
- itemRenderer: ChangeProposalItemView,
234
- onItemSelect: handleItemSelect
235
- }, (0, _react2.jsx)(_core.Button, {
236
- fill: true,
237
- rightIcon: "chevron-down",
238
- icon: icon,
239
- css: (0, _react2.css)`white-space: nowrap;`
240
- }, selectedItemSummary))), (0, _react2.jsx)(_core.Button, {
241
- onClick: () => selectProposal(null),
242
- icon: "minimize",
243
- title: "Minimize proposed change view",
244
- text: "Minimize"
245
- })), (0, _react2.jsx)("div", {
246
- css: (0, _react2.css)`position: relative; flex: 1;`,
247
- ref: selectedProposalDetailRef
248
- }, (0, _react2.jsx)(_BrowserCtx.BrowserCtx.Provider, {
249
- value: proposalBrowserCtx
250
- }, (0, _react2.jsx)(_ErrorBoundary.default, {
251
- viewName: "Proposal detail"
252
- }, (0, _react2.jsx)(ProposalDetail, {
253
- itemRef: selectedItemRef,
254
- showDiff: showDiff,
255
- //showOnlyChanged={showOnlyChanged}
256
- item: selectedItemProposed !== null && selectedItemProposed !== void 0 ? selectedItemProposed : selectedItemCurrent,
257
- itemBefore: selectedItemCurrent !== null && selectedItemCurrent !== void 0 ? selectedItemCurrent : undefined,
258
- proposal: proposals[selectedProposal]
259
- })))));
260
- } else {
261
- return (0, _react2.jsx)(_react.default.Fragment, null, allItems.map(cpi => {
262
- const actions = [{
263
- onClick: () => selectProposal(cpi.itemPath),
264
- text: "Expand",
265
- title: "Expand proposed change to see item details",
266
- icon: 'maximize'
267
- }];
268
-
269
- if (onDeleteProposalForItemAtPath) {
270
- actions.push({
271
- text: "Delete this proposal",
272
- intent: 'danger',
273
- onClick: () => onDeleteProposalForItemAtPath(cpi.itemPath),
274
- icon: 'trash'
275
- });
276
- }
277
-
278
- return (0, _react2.jsx)(_Block.HomeBlockCard, {
279
- css: (0, _react2.css)`
280
- flex-basis: calc(33.33% - 10px*2/3);
281
- `,
282
- description: `${cpi.proposal.type} proposal`,
283
- key: cpi.itemPath
284
- }, (0, _react2.jsx)(ProposalType, {
285
- item: cpi
286
- }), (0, _react2.jsx)("div", {
287
- css: (0, _react2.css)`padding: 5px; flex-grow: 1;`
288
- }, cpi.item !== null ? (0, _react2.jsx)(_core.H5, {
289
- css: (0, _react2.css)`margin: 0; overflow: hidden; text-overflow: ellipsis;`
290
- }, (0, _react2.jsx)(ProposalSummary, {
291
- itemRef: cpi.itemRef,
292
- proposal: cpi.proposal,
293
- itemBefore: cpi.itemBefore,
294
- item: cpi.item
295
- })) : (0, _react2.jsx)(_react.default.Fragment, null, "Problem reading proposed item data.")), actions.length > 0 ? (0, _react2.jsx)(_Block.HomeBlockActions, {
296
- actions: actions
297
- }) : null);
298
- }));
241
+ }))))) : null);
242
+ }, [proposalCount > 0, haveSelectedItem, selectedItemProposed, selectedItemCurrent, preferDiff, jumpTo, handleItemSelect, selectedProposal && proposals[selectedProposal]]);
243
+ return (0, _react2.jsx)(_react.default.Fragment, null, selectedItemDrawer, allItems.map(cpi => {
244
+ const actions = [{
245
+ onClick: () => selectProposal(cpi.itemPath),
246
+ text: "Expand",
247
+ title: "Expand proposed change to see item details",
248
+ icon: 'maximize'
249
+ }];
250
+
251
+ if (onDeleteProposalForItemAtPath) {
252
+ actions.push({
253
+ text: "Delete this proposal",
254
+ intent: 'danger',
255
+ onClick: () => onDeleteProposalForItemAtPath(cpi.itemPath),
256
+ icon: 'trash'
257
+ });
299
258
  }
300
- } else {
301
- return null;
302
- }
259
+
260
+ return (0, _react2.jsx)(_Block.HomeBlockCard, {
261
+ css: (0, _react2.css)`
262
+ flex-basis: calc(33.33% - 10px*2/3);
263
+ `,
264
+ description: `${cpi.proposal.type} proposal`,
265
+ key: cpi.itemPath
266
+ }, (0, _react2.jsx)(ProposalType, {
267
+ item: cpi
268
+ }), (0, _react2.jsx)("div", {
269
+ css: (0, _react2.css)`padding: 5px; flex-grow: 1;`
270
+ }, cpi.item !== null ? (0, _react2.jsx)(_core.H5, {
271
+ css: (0, _react2.css)`margin: 0; overflow: hidden; text-overflow: ellipsis;`
272
+ }, (0, _react2.jsx)(ProposalSummary, {
273
+ itemRef: cpi.itemRef,
274
+ proposal: cpi.proposal,
275
+ itemBefore: cpi.itemBefore,
276
+ item: cpi.item
277
+ })) : (0, _react2.jsx)(_react.default.Fragment, null, "Problem reading proposed item data.")), actions.length > 0 ? (0, _react2.jsx)(_Block.HomeBlockActions, {
278
+ actions: actions
279
+ }) : null);
280
+ }));
303
281
  }
304
282
 
305
283
  ;