@riboseinc/paneron-registry-kit 2.2.11 → 2.2.13

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 (58) hide show
  1. package/index.d.ts +2 -4
  2. package/package.json +2 -2
  3. package/types/cr.d.ts +5 -1
  4. package/types/cr.js +6 -2
  5. package/types/cr.js.map +1 -1
  6. package/types/util.d.ts +2 -0
  7. package/types/util.js.map +1 -1
  8. package/types/views.d.ts +22 -0
  9. package/types/views.js.map +1 -1
  10. package/views/BrowserCtx.d.ts +3 -11
  11. package/views/BrowserCtx.js +1 -0
  12. package/views/BrowserCtx.js.map +1 -1
  13. package/views/FilterCriteria/criteriaGroupToQueryExpression.d.ts +1 -1
  14. package/views/FilterCriteria/criteriaGroupToQueryExpression.js.map +1 -1
  15. package/views/FilterCriteria/models.d.ts +1 -1
  16. package/views/FilterCriteria/models.js.map +1 -1
  17. package/views/GenericRelatedItemView.js +7 -4
  18. package/views/GenericRelatedItemView.js.map +1 -1
  19. package/views/SearchQuery.js +34 -15
  20. package/views/SearchQuery.js.map +1 -1
  21. package/views/change-request/ChangeRequestContext.d.ts +13 -6
  22. package/views/change-request/ChangeRequestContext.js +84 -4
  23. package/views/change-request/ChangeRequestContext.js.map +1 -1
  24. package/views/change-request/Proposals.d.ts +16 -3
  25. package/views/change-request/Proposals.js +175 -79
  26. package/views/change-request/Proposals.js.map +1 -1
  27. package/views/change-request/objectChangeset.d.ts +7 -4
  28. package/views/change-request/objectChangeset.js +59 -22
  29. package/views/change-request/objectChangeset.js.map +1 -1
  30. package/views/change-request/util.d.ts +4 -0
  31. package/views/change-request/util.js +14 -0
  32. package/views/change-request/util.js.map +1 -0
  33. package/views/detail/ChangeRequest/index.js +16 -16
  34. package/views/detail/ChangeRequest/index.js.map +1 -1
  35. package/views/detail/RegisterHome/ActiveProposalDetails.d.ts +15 -0
  36. package/views/detail/RegisterHome/ActiveProposalDetails.js +105 -0
  37. package/views/detail/RegisterHome/ActiveProposalDetails.js.map +1 -0
  38. package/views/detail/RegisterHome/Block.d.ts +29 -0
  39. package/views/detail/RegisterHome/Block.js +75 -0
  40. package/views/detail/RegisterHome/Block.js.map +1 -0
  41. package/views/detail/RegisterHome/MetaSummary.js +7 -3
  42. package/views/detail/RegisterHome/MetaSummary.js.map +1 -1
  43. package/views/detail/RegisterHome/Proposal.d.ts +1 -11
  44. package/views/detail/RegisterHome/Proposal.js +113 -45
  45. package/views/detail/RegisterHome/Proposal.js.map +1 -1
  46. package/views/detail/RegisterHome/index.js +145 -148
  47. package/views/detail/RegisterHome/index.js.map +1 -1
  48. package/views/detail/RegisterItem/index.js +5 -4
  49. package/views/detail/RegisterItem/index.js.map +1 -1
  50. package/views/hooks/useCustomView.js +1 -1
  51. package/views/hooks/useCustomView.js.map +1 -1
  52. package/views/index.js +5 -3
  53. package/views/index.js.map +1 -1
  54. package/views/sidebar/Search/index.js +12 -2
  55. package/views/sidebar/Search/index.js.map +1 -1
  56. package/views/util.d.ts +26 -17
  57. package/views/util.js +50 -50
  58. package/views/util.js.map +1 -1
package/views/util.js CHANGED
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "GenericRelatedItemView", {
11
11
  return _GenericRelatedItemView.GenericRelatedItemView;
12
12
  }
13
13
  });
14
- exports.FormGroupAsCardInGrid = exports.CardInGrid = exports.TabContentsWithHeader = exports.TabContentsWithActions = exports._getRelatedClass = exports.Datestamp = exports.PropertyDetailView = exports.RegisterHelmet = void 0;
14
+ exports.FormGroupAsCardInGrid = exports.CardInGrid = exports.TabContentsWithHeader = exports._getRelatedClass = exports.Datestamp = exports.PropertyDetailView = exports.RegisterHelmet = void 0;
15
15
 
16
16
  var _format = _interopRequireDefault(require("date-fns/format"));
17
17
 
@@ -55,22 +55,47 @@ const RegisterHelmet = (0, _react.memo)(function (props) {
55
55
  defaultTitle: `${datasetTitle} register`
56
56
  }, props.children);
57
57
  });
58
+ /**
59
+ * A wrapper to show property data with its label(s).
60
+ */
61
+
58
62
  exports.RegisterHelmet = RegisterHelmet;
59
63
 
60
64
  const PropertyDetailView = function ({
65
+ label,
66
+ labelInfo,
61
67
  title,
62
68
  secondaryTitle,
63
- inline,
64
- children,
65
- className
69
+ ...props
66
70
  }) {
67
71
  return (0, _react2.jsx)(_core.FormGroup, {
68
- label: `${title}:`,
69
- labelInfo: secondaryTitle,
70
- css: (0, _react2.css)`&, &.bp4-inline { label.bp4-label { font-weight: bold; line-height: unset } }`,
71
- className: className,
72
- inline: inline
73
- }, children);
72
+ label: label || title ? `${label !== null && label !== void 0 ? label : title}:` : undefined,
73
+ labelInfo: labelInfo !== null && labelInfo !== void 0 ? labelInfo : secondaryTitle,
74
+ css: (0, _react2.css)`
75
+ &, &.bp4-inline {
76
+ label.bp4-label {
77
+ /*
78
+ * Since it’s in flex container, label expands to fill its width,
79
+ * and due to the mechanics of how labels work (?)
80
+ * any button (e.g., for deletion) within labelInfo
81
+ * would responds to events of the entire label
82
+ * (meaning you can hover space to the right of the label and labelInfo
83
+ * and the button would still be clickable).
84
+ * This makes the label not fill flex container width.
85
+ */
86
+ align-self: flex-start;
87
+
88
+ font-weight: bold;
89
+ line-height: unset;
90
+ text-transform: capitalize;
91
+ .bp4-text-muted {
92
+ text-transform: none;
93
+ }
94
+ }
95
+ }
96
+ `,
97
+ ...props
98
+ });
74
99
  };
75
100
  /** Formats given date as a span with tooltip set to full ISO date & time. */
76
101
 
@@ -113,40 +138,8 @@ const _getRelatedClass = classes => {
113
138
  };
114
139
  };
115
140
  };
116
- /**
117
- * Suitable for use as tab contents for TabbedWorkspace.
118
- * Provides top bar with actions and main content.
119
- */
120
-
121
141
 
122
142
  exports._getRelatedClass = _getRelatedClass;
123
-
124
- const TabContentsWithActions = function ({
125
- actions,
126
- main,
127
- className
128
- }) {
129
- return (0, _react2.jsx)("div", {
130
- css: (0, _react2.css)`
131
- position: absolute; inset: 0;
132
- display: flex; flex-flow: column nowrap;
133
- `,
134
- className: className
135
- }, (0, _react2.jsx)("div", {
136
- css: (0, _react2.css)`flex: 0; padding: 10px; display: flex; flex-flow: row wrap; gap: 10px;`
137
- }, actions), (0, _react2.jsx)("div", {
138
- css: (0, _react2.css)`
139
- position: relative;
140
- flex: 1;
141
- padding: 10px;
142
- overflow-y: auto;
143
- background: ${_core.Colors.GRAY5};
144
- .bp4-dark & { background: ${_core.Colors.DARK_GRAY2}; }
145
- `
146
- }, main));
147
- };
148
-
149
- exports.TabContentsWithActions = TabContentsWithActions;
150
143
  const paddingPx = 11;
151
144
 
152
145
  function findEnabledActions(props) {
@@ -158,10 +151,13 @@ const TabContentsWithHeader = function ({
158
151
  smallTitle,
159
152
  classification,
160
153
  actions,
161
- className,
162
154
  layout,
155
+ layoutOptions,
156
+ className,
163
157
  children
164
158
  }) {
159
+ var _a;
160
+
165
161
  const hasClassification = (classification !== null && classification !== void 0 ? classification : []).length > 0;
166
162
  const enabledActions = actions ? findEnabledActions(actions) : [];
167
163
  const hasActions = enabledActions.length > 0; // if (enabledActions.length === 1 && !enabledActions[0].intent) {
@@ -243,8 +239,8 @@ const TabContentsWithHeader = function ({
243
239
  display: flex;
244
240
  flex-flow: row wrap;
245
241
  align-content: flex-start;
246
- align-items: flex-start;
247
- gap: 10px;
242
+ ${(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.stretch) ? 'align-items: stretch;' : 'align-items: flex-start;'}
243
+ gap: ${(_a = layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.gapPx) !== null && _a !== void 0 ? _a : 10}px;
248
244
  ` : ''}
249
245
  `
250
246
  }, children), hasActions ? (0, _react2.jsx)("div", {
@@ -280,13 +276,16 @@ const Action = function ({
280
276
  intent: props.disabled ? undefined : props.intent,
281
277
  onClick: props.disabled ? undefined : props.onClick,
282
278
  disabled: props.active ? false : props.disabled,
283
- title: tooltip
279
+ title: tooltip,
280
+ rightIcon: popup ? 'more' : undefined
284
281
  });
285
282
 
286
283
  if (popup && !props.disabled) {
287
284
  return (0, _react2.jsx)(_popover.Popover2, {
288
285
  content: popup,
289
- placement: "top"
286
+ placement: "top",
287
+ minimal: true,
288
+ interactionKind: "click"
290
289
  }, btn);
291
290
  } else {
292
291
  return btn;
@@ -296,13 +295,14 @@ const Action = function ({
296
295
  const CardInGrid = function ({
297
296
  description,
298
297
  className,
299
- children
298
+ ...props
300
299
  }) {
301
300
  return (0, _react2.jsx)(_core.Card, {
302
301
  css: (0, _react2.css)`border-radius: 5px;`,
303
302
  title: description,
304
- className: `${_core.Classes.ELEVATION_3} ${className !== null && className !== void 0 ? className : ''}`
305
- }, children);
303
+ className: !props.interactive ? `${_core.Classes.ELEVATION_3} ${className !== null && className !== void 0 ? className : ''}` : className,
304
+ ...props
305
+ });
306
306
  };
307
307
  /** Useful in case of tab “card-grid” layout. */
308
308
 
package/views/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,iCAAiC;AACjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,EAAE,EAAE,EAAE,EACN,MAAM,IAAI,UAAU,EACpB,WAAW,EACX,GAAG,EACH,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,WAAsC,MAAM,sDAAsD,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;GAGG;AACH,MAAM,UAAU,oB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S,OACJ,KAAK,EACT,GAAG,EAAE,GAAG,CAAA;;;;mBAIK,UAAU;;;;2BAIF,UAAU;;;;;iBAKpB,UAAU;;;;;;;;sBAQL,MAAM,CAAC,KAAK;oCACE,MAAM,CAAC,UAAU;OAC9C,EACD,SAAS,EAAE,OAAO,CAAC,WAAW,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\n//import log from 'electron-log';\nimport format from 'date-fns/format';\nimport React, { memo, useContext } from 'react';\nimport { Helmet, type HelmetProps } from 'react-helmet';\nimport { css, jsx } from '@emotion/react';\nimport {\n Card,\n Classes,\n FormGroup, type FormGroupProps,\n H2, H4,\n Button as BaseButton, type ButtonProps,\n ButtonGroup,\n Tag, type TagProps,\n Colors,\n} from '@blueprintjs/core';\nimport { Popover2 as Popover } from '@blueprintjs/popover2';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip, { type HelpTooltipProps } from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type { ItemClassConfiguration, RelatedItemClassConfiguration } from '../types';\nexport { GenericRelatedItemView } from './GenericRelatedItemView';\n\n\n/**\n * Get give string truncated & with ellipsis appended\n * if its length exceeds given number of characters.\n */\nexport function maybeEllipsizeString(\n str: string,\n maxLength: number = 20,\n): string {\n return str.length > maxLength\n ? `${str.slice(0, maxLength)}…`\n : str;\n}\n\n\nexport const RegisterHelmet: React.FC<HelmetProps> = memo(function (props) {\n const { title: datasetTitle } = useContext(DatasetContext);\n\n return (\n <Helmet\n titleTemplate={`%s in ${datasetTitle} register`}\n defaultTitle={`${datasetTitle} register`}>\n {props.children}\n </Helmet>\n );\n});\n\n\nexport const PropertyDetailView: React.FC<{\n title: FormGroupProps[\"label\"]\n secondaryTitle?: FormGroupProps[\"labelInfo\"]\n inline?: FormGroupProps[\"inline\"]\n className?: string\n}> = function ({ title, secondaryTitle, inline, children, className }) {\n return (\n <FormGroup\n label={`${title}:`}\n labelInfo={secondaryTitle}\n css={css`&, &.bp4-inline { label.bp4-label { font-weight: bold; line-height: unset } }`}\n className={className}\n inline={inline}>\n {children}\n </FormGroup>\n );\n};\n\n\n/** Formats given date as a span with tooltip set to full ISO date & time. */\nexport const Datestamp: React.FC<{\n date: Date\n title?: string\n className?: string\n}> = function ({ date, title, className }) {\n const asString = formatDate(date);\n return <span\n className={className}\n title={`${title ? `${title}: ` : ''}${date?.toString() ?? 'N/A'}`}>\n {asString}\n </span>;\n};\n\n\n/** Foramts given date as plain text. */\nexport function formatDate(date: Date): string {\n try {\n return format(date, 'yyyy-MM-dd');\n } catch (e) {\n return `Invalid date (${e})`;\n }\n}\n\n\nexport const _getRelatedClass = (classes: Record<string, ItemClassConfiguration<any>>) => {\n return (clsID: string): RelatedItemClassConfiguration => {\n const cfg = classes[clsID];\n return {\n title: cfg.meta.title,\n // TODO: The itemView/listItemView inconsistency is annoying\n itemView: cfg.views.listItemView,\n };\n };\n};\n\n\n/**\n * Suitable for use as tab contents for TabbedWorkspace.\n * Provides top bar with actions and main content.\n */\nexport const TabContentsWithActions: React.FC<{\n actions: JSX.Element;\n main: JSX.Element;\n className?: string;\n}> = function ({ actions, main, className }) {\n return (\n <div css={css`\n position: absolute; inset: 0;\n display: flex; flex-flow: column nowrap;\n `} className={className}>\n <div css={css`flex: 0; padding: 10px; display: flex; flex-flow: row wrap; gap: 10px;`}>\n {actions}\n </div>\n <div css={css`\n position: relative;\n flex: 1;\n padding: 10px;\n overflow-y: auto;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `}>\n {main}\n </div>\n </div>\n );\n};\n\n\nexport type ClassificationEntry = TagProps & { tooltip?: HelpTooltipProps };\nexport interface TabContentsWithHeaderProps {\n title: JSX.Element | string\n smallTitle?: boolean\n classification?: ClassificationEntry[]\n actions?: (ActionProps | ActionProps[])[]\n tooltip?: HelpTooltipProps\n className?: string\n\n /**\n * CSS to apply to child contents wrapper div.\n *\n * If 'card-grid', children would be expected to be cards\n * (e.g., `FormGroupAsCardInGrid` or `CardInGrid`)\n *\n * 'card-grid' implies 'scrollable'.\n */\n layout?: undefined | 'card-grid' | 'scrollable'\n}\nconst paddingPx = 11;\nfunction findEnabledActions\n<T extends ButtonProps | ButtonProps[] = ButtonProps | ButtonProps[]>\n(props: T[]): ButtonProps[] {\n return props.map(props =>\n (props as ButtonProps[]).length !== undefined\n ? (props as ButtonProps[]).filter(p => !p.disabled)\n : !(props as ButtonProps).disabled\n ? props\n : []\n ).flat();\n}\nexport const TabContentsWithHeader: React.FC<TabContentsWithHeaderProps> =\nfunction ({ title, smallTitle, classification, actions, className, layout, children }) {\n const hasClassification = (classification ?? []).length > 0;\n\n const enabledActions = actions ? findEnabledActions(actions) : [];\n const hasActions = enabledActions.length > 0;\n\n // if (enabledActions.length === 1 && !enabledActions[0].intent) {\n // enabledActions[0].intent = 'primary';\n // }\n\n return (\n <div css={css`\n position: absolute; inset: 0;\n padding-top: ${paddingPx}px;\n ${hasActions ? `padding-bottom: ${paddingPx}px;` : ''}\n display: flex; flex-flow: column nowrap;\n gap: ${paddingPx}px;\n `} className={className}>\n {smallTitle\n ? <H4 css={css`margin: 0 ${paddingPx}px;`}>{title}</H4>\n : <H2 css={css`margin: 0 ${paddingPx}px;`}>{title}</H2>}\n {hasClassification\n ? <div css={css`\n flex: 0;\n margin: 0 ${paddingPx}px;\n display: flex;\n flex-flow: row wrap;\n gap: ${paddingPx}px;\n `}>\n {classification!.map((p, idx) =>\n <Tag\n key={idx}\n minimal\n {...p}\n large={!smallTitle}\n rightIcon={p.tooltip\n ? <HelpTooltip {...p.tooltip} />\n : undefined}\n />\n )}\n </div>\n : null}\n <div css={css`\n position: relative;\n flex: 1;\n overflow-y: auto;\n\n ${layout === undefined\n ? `\n > :only-child { position: absolute; inset: 0 }\n box-shadow: black 0 0 20px -10px;\n `\n : `\n padding: 0 10px;\n &::after, &::before {\n pointer-events: none;\n content: \" \";\n display: block;\n position: sticky;\n width: 100%;\n height: 1px;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n z-index: 10;\n }\n &::before {\n top: 0;\n box-shadow: ${Colors.GRAY5} 0 -20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 -20px 20px 20px;\n }\n }\n &::after {\n bottom: 0;\n box-shadow: ${Colors.GRAY5} 0 20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 20px 20px 20px;\n }\n }\n `}\n\n ${layout === 'scrollable' || layout === 'card-grid'\n ? `\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `\n : ''}\n\n ${layout === 'card-grid'\n ? `\n display: flex;\n flex-flow: row wrap;\n align-content: flex-start;\n align-items: flex-start;\n gap: 10px;\n `\n : ''}\n `}>\n {children}\n </div>\n\n {hasActions\n ? <div css={css`\n margin: 0 ${paddingPx}px;\n flex: 0; display: flex; flex-flow: row wrap; gap: ${paddingPx}px;\n `}>\n {actions!.map((props, idx) => {\n if (props.hasOwnProperty('length') && (props as ButtonProps[]).length !== undefined) {\n return (\n <ButtonGroup key={idx}>\n {(props as ButtonProps[]).map(p =>\n <Action {...p} />\n )}\n </ButtonGroup>\n );\n } else {\n return <Action key={idx} {...(props as ButtonProps)} />;\n }\n })}\n </div>\n : null}\n </div>\n );\n};\n\n\nexport type ActionProps = ButtonProps & ({ popup?: JSX.Element, tooltip?: string });\n/** Mostly a button, but with an optional popup. */\nconst Action: React.FC<ActionProps> = function ({ popup, tooltip, ...props }) {\n const btn = <BaseButton\n {...props}\n intent={props.disabled ? undefined : props.intent}\n onClick={props.disabled ? undefined : props.onClick}\n disabled={props.active ? false : props.disabled}\n title={tooltip}\n />;\n\n if (popup && !props.disabled) {\n return (\n <Popover content={popup} placement=\"top\">\n {btn}\n </Popover>\n );\n } else {\n return btn;\n }\n};\n\n\nexport const CardInGrid: React.FC<{ description: string, className?: string }> = function ({ description, className, children }) {\n return (\n <Card\n css={css`border-radius: 5px;`}\n title={description}\n className={`${Classes.ELEVATION_3} ${className ?? ''}`}>\n {children}\n </Card>\n );\n};\n\n\n/** Useful in case of tab “card-grid” layout. */\nexport const FormGroupAsCardInGrid: React.FC<FormGroupProps & { paddingPx?: number }> =\nfunction ({ paddingPx, ...props }) {\n const paddingPx_ = paddingPx ?? 11;\n return (\n <FormGroup\n {...props}\n css={css`\n margin: 0;\n\n border-radius: 5px;\n padding: ${paddingPx_}px;\n\n > label.bp4-label {\n font-weight: bold;\n margin-bottom: ${paddingPx_}px;\n }\n > .bp4-form-content {\n display: flex;\n flex-flow: column nowrap;\n gap: ${paddingPx_}px;\n\n > .bp4-form-group {\n margin: 0;\n }\n }\n\n /* Note: these colors are picked to work with some form widgets, date input widget specifically. */\n background: ${Colors.WHITE};\n .bp4-dark & { background: ${Colors.DARK_GRAY3}; }\n `}\n className={Classes.ELEVATION_3}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,iCAAiC;AACjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,EAAE,EAAE,EAAE,EACN,MAAM,IAAI,UAAU,EACpB,WAAW,EACX,GAAG,EACH,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,WAAsC,MAAM,sDAAsD,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;AAGF,gDAAgD;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAClC,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;IAC/B,MAAM,UAAU,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;IACnC,OAAO,CACL,IAAC,SAAS,OACJ,KAAK,EACT,GAAG,EAAE,GAAG,CAAA;;;;mBAIK,UAAU;;;;2BAIF,UAAU;;;;;iBAKpB,UAAU;;;;;;;;sBAQL,MAAM,CAAC,KAAK;oCACE,MAAM,CAAC,UAAU;OAC9C,EACD,SAAS,EAAE,OAAO,CAAC,WAAW,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\n//import log from 'electron-log';\nimport format from 'date-fns/format';\nimport React, { memo, useContext } from 'react';\nimport { Helmet, type HelmetProps } from 'react-helmet';\nimport { css, jsx } from '@emotion/react';\nimport {\n Card, type CardProps,\n Classes,\n FormGroup, type FormGroupProps,\n H2, H4,\n Button as BaseButton, type ButtonProps,\n ButtonGroup,\n Tag, type TagProps,\n Colors,\n} from '@blueprintjs/core';\nimport { Popover2 as Popover } from '@blueprintjs/popover2';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip, { type HelpTooltipProps } from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type { ItemClassConfiguration, RelatedItemClassConfiguration } from '../types';\nexport { GenericRelatedItemView } from './GenericRelatedItemView';\n\n\n/**\n * Get give string truncated & with ellipsis appended\n * if its length exceeds given number of characters.\n */\nexport function maybeEllipsizeString(\n str: string,\n maxLength: number = 20,\n): string {\n return str.length > maxLength\n ? `${str.slice(0, maxLength)}…`\n : str;\n}\n\n\nexport const RegisterHelmet: React.FC<HelmetProps> = memo(function (props) {\n const { title: datasetTitle } = useContext(DatasetContext);\n\n return (\n <Helmet\n titleTemplate={`%s in ${datasetTitle} register`}\n defaultTitle={`${datasetTitle} register`}>\n {props.children}\n </Helmet>\n );\n});\n\n\n/**\n * A wrapper to show property data with its label(s).\n */\nexport const PropertyDetailView: React.FC<FormGroupProps & {\n /** @deprecated use `label` instead */\n title?: FormGroupProps[\"label\"]\n /** @deprecated use `labelInfo` instead */\n secondaryTitle?: FormGroupProps[\"labelInfo\"]\n}> = function ({\n label, labelInfo,\n title, secondaryTitle,\n ...props }) {\n return (\n <FormGroup\n label={label || title ? `${label ?? title}:` : undefined}\n labelInfo={labelInfo ?? secondaryTitle}\n css={css`\n &, &.bp4-inline {\n label.bp4-label {\n /*\n * Since it’s in flex container, label expands to fill its width,\n * and due to the mechanics of how labels work (?)\n * any button (e.g., for deletion) within labelInfo\n * would responds to events of the entire label\n * (meaning you can hover space to the right of the label and labelInfo\n * and the button would still be clickable).\n * This makes the label not fill flex container width.\n */\n align-self: flex-start;\n\n font-weight: bold;\n line-height: unset;\n text-transform: capitalize;\n .bp4-text-muted {\n text-transform: none;\n }\n }\n }\n `}\n {...props}\n />\n );\n};\n\n\n/** Formats given date as a span with tooltip set to full ISO date & time. */\nexport const Datestamp: React.FC<{\n date: Date\n title?: string\n className?: string\n}> = function ({ date, title, className }) {\n const asString = formatDate(date);\n return <span\n className={className}\n title={`${title ? `${title}: ` : ''}${date?.toString() ?? 'N/A'}`}>\n {asString}\n </span>;\n};\n\n\n/** Foramts given date as plain text. */\nexport function formatDate(date: Date): string {\n try {\n return format(date, 'yyyy-MM-dd');\n } catch (e) {\n return `Invalid date (${e})`;\n }\n}\n\n\nexport const _getRelatedClass = (classes: Record<string, ItemClassConfiguration<any>>) => {\n return (clsID: string): RelatedItemClassConfiguration => {\n const cfg = classes[clsID];\n return {\n title: cfg.meta.title,\n // TODO: The itemView/listItemView inconsistency is annoying\n itemView: cfg.views.listItemView,\n };\n };\n};\n\n\n// /**\n// * Suitable for use as tab contents for TabbedWorkspace.\n// * Provides top bar with actions and main content.\n// */\n// export const TabContentsWithActions: React.FC<{\n// actions: JSX.Element;\n// main: JSX.Element;\n// gapPx?: number;\n// className?: string;\n// }> = function ({ actions, gapPx: _gapPx, main, className }) {\n// const gapPx = _gapPx ?? 10;\n// return (\n// <div css={css`\n// position: absolute; inset: 0;\n// display: flex; flex-flow: column nowrap;\n// `} className={className}>\n// <div css={css`flex: 0; padding: ${gapPx}px; display: flex; flex-flow: row wrap; gap: ${gapPx}px;`}>\n// {actions}\n// </div>\n// <div css={css`\n// position: relative;\n// flex: 1;\n// padding: ${gapPx}px;\n// overflow-y: auto;\n// background: ${Colors.GRAY5};\n// .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n// `}>\n// {main}\n// </div>\n// </div>\n// );\n// };\n\n\nexport type ClassificationEntry = TagProps & { tooltip?: HelpTooltipProps };\nexport interface TabContentsWithHeaderProps {\n title: JSX.Element | string\n smallTitle?: boolean\n classification?: ClassificationEntry[]\n actions?: (ActionProps | ActionProps[])[]\n tooltip?: HelpTooltipProps\n className?: string\n\n /**\n * CSS to apply to child contents wrapper div.\n *\n * If 'card-grid', children would be expected to be cards\n * (e.g., `FormGroupAsCardInGrid` or `CardInGrid`)\n *\n * 'card-grid' implies 'scrollable'.\n */\n layout?: undefined | 'card-grid' | 'scrollable'\n layoutOptions?: Record<string, unknown>\n}\ninterface Grid extends TabContentsWithHeaderProps {\n layout: 'card-grid'\n layoutOptions?: {\n gapPx?: number\n stretch?: boolean\n }\n}\ninterface Scrollable extends TabContentsWithHeaderProps {\n layout: 'scrollable'\n layoutOptions?: never\n}\ninterface NoLayout extends TabContentsWithHeaderProps {\n layout?: undefined\n layoutOptions?: never\n}\nconst paddingPx = 11;\nfunction findEnabledActions\n<T extends ButtonProps | ButtonProps[] = ButtonProps | ButtonProps[]>\n(props: T[]): ButtonProps[] {\n return props.map(props =>\n (props as ButtonProps[]).length !== undefined\n ? (props as ButtonProps[]).filter(p => !p.disabled)\n : !(props as ButtonProps).disabled\n ? props\n : []\n ).flat();\n}\nexport const TabContentsWithHeader: React.FC<Grid | Scrollable | NoLayout> =\nfunction ({ title, smallTitle, classification, actions, layout, layoutOptions, className, children }) {\n const hasClassification = (classification ?? []).length > 0;\n\n const enabledActions = actions ? findEnabledActions(actions) : [];\n const hasActions = enabledActions.length > 0;\n\n // if (enabledActions.length === 1 && !enabledActions[0].intent) {\n // enabledActions[0].intent = 'primary';\n // }\n\n return (\n <div css={css`\n position: absolute; inset: 0;\n padding-top: ${paddingPx}px;\n ${hasActions ? `padding-bottom: ${paddingPx}px;` : ''}\n display: flex; flex-flow: column nowrap;\n gap: ${paddingPx}px;\n `} className={className}>\n {smallTitle\n ? <H4 css={css`margin: 0 ${paddingPx}px;`}>{title}</H4>\n : <H2 css={css`margin: 0 ${paddingPx}px;`}>{title}</H2>}\n {hasClassification\n ? <div css={css`\n flex: 0;\n margin: 0 ${paddingPx}px;\n display: flex;\n flex-flow: row wrap;\n gap: ${paddingPx}px;\n `}>\n {classification!.map((p, idx) =>\n <Tag\n key={idx}\n minimal\n {...p}\n large={!smallTitle}\n rightIcon={p.tooltip\n ? <HelpTooltip {...p.tooltip} />\n : undefined}\n />\n )}\n </div>\n : null}\n <div css={css`\n position: relative;\n flex: 1;\n overflow-y: auto;\n\n ${layout === undefined\n ? `\n > :only-child { position: absolute; inset: 0 }\n box-shadow: black 0 0 20px -10px;\n `\n : `\n padding: 0 10px;\n &::after, &::before {\n pointer-events: none;\n content: \" \";\n display: block;\n position: sticky;\n width: 100%;\n height: 1px;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n z-index: 10;\n }\n &::before {\n top: 0;\n box-shadow: ${Colors.GRAY5} 0 -20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 -20px 20px 20px;\n }\n }\n &::after {\n bottom: 0;\n box-shadow: ${Colors.GRAY5} 0 20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 20px 20px 20px;\n }\n }\n `}\n\n ${layout === 'scrollable' || layout === 'card-grid'\n ? `\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `\n : ''}\n\n ${layout === 'card-grid'\n ? `\n display: flex;\n flex-flow: row wrap;\n align-content: flex-start;\n ${layoutOptions?.stretch\n ? 'align-items: stretch;'\n : 'align-items: flex-start;'}\n gap: ${layoutOptions?.gapPx ?? 10}px;\n `\n : ''}\n `}>\n {children}\n </div>\n\n {hasActions\n ? <div css={css`\n margin: 0 ${paddingPx}px;\n flex: 0; display: flex; flex-flow: row wrap; gap: ${paddingPx}px;\n `}>\n {actions!.map((props, idx) => {\n if (props.hasOwnProperty('length') && (props as ButtonProps[]).length !== undefined) {\n return (\n <ButtonGroup key={idx}>\n {(props as ButtonProps[]).map(p =>\n <Action {...p} />\n )}\n </ButtonGroup>\n );\n } else {\n return <Action key={idx} {...(props as ButtonProps)} />;\n }\n })}\n </div>\n : null}\n </div>\n );\n};\n\n\nexport type ActionProps = ButtonProps & ({ popup?: JSX.Element, tooltip?: string });\n/** Mostly a button, but with an optional popup. */\nconst Action: React.FC<ActionProps> = function ({ popup, tooltip, ...props }) {\n const btn = <BaseButton\n {...props}\n intent={props.disabled ? undefined : props.intent}\n onClick={props.disabled ? undefined : props.onClick}\n disabled={props.active ? false : props.disabled}\n title={tooltip}\n rightIcon={popup ? 'more' : undefined}\n />;\n\n if (popup && !props.disabled) {\n return (\n <Popover content={popup} placement=\"top\" minimal interactionKind=\"click\">\n {btn}\n </Popover>\n );\n } else {\n return btn;\n }\n};\n\n\nexport const CardInGrid: React.FC<{ description: string } & CardProps> =\nfunction ({ description, className, ...props }) {\n return (\n <Card\n css={css`border-radius: 5px;`}\n title={description}\n className={!props.interactive\n ? `${Classes.ELEVATION_3} ${className ?? ''}`\n : className}\n {...props}\n />\n );\n};\n\n\n/** Useful in case of tab “card-grid” layout. */\nexport const FormGroupAsCardInGrid: React.FC<FormGroupProps & { paddingPx?: number }> =\nfunction ({ paddingPx, ...props }) {\n const paddingPx_ = paddingPx ?? 11;\n return (\n <FormGroup\n {...props}\n css={css`\n margin: 0;\n\n border-radius: 5px;\n padding: ${paddingPx_}px;\n\n > label.bp4-label {\n font-weight: bold;\n margin-bottom: ${paddingPx_}px;\n }\n > .bp4-form-content {\n display: flex;\n flex-flow: column nowrap;\n gap: ${paddingPx_}px;\n\n > .bp4-form-group {\n margin: 0;\n }\n }\n\n /* Note: these colors are picked to work with some form widgets, date input widget specifically. */\n background: ${Colors.WHITE};\n .bp4-dark & { background: ${Colors.DARK_GRAY3}; }\n `}\n className={Classes.ELEVATION_3}\n />\n );\n};\n"]}