@riboseinc/paneron-registry-kit 2.2.32 → 2.2.34
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 +2 -2
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/item-classes/Tree.js +6 -8
- package/item-classes/Tree.js.map +1 -1
- package/package.json +4 -3
- package/{views/change-request → proposals}/ChangeRequestContext.d.ts +3 -2
- package/{views/change-request → proposals}/ChangeRequestContext.js +8 -8
- package/proposals/ChangeRequestContext.js.map +1 -0
- package/{views/ProposalHistoryDrawer.js → proposals/HistoryDrawer.js} +11 -13
- package/proposals/HistoryDrawer.js.map +1 -0
- package/proposals/ListItem.d.ts +8 -0
- package/proposals/ListItem.js +40 -0
- package/proposals/ListItem.js.map +1 -0
- package/{views/change-request/Summary.d.ts → proposals/MetaProperties.d.ts} +4 -3
- package/proposals/MetaProperties.js +94 -0
- package/proposals/MetaProperties.js.map +1 -0
- package/proposals/NewProposalMenu.d.ts +10 -0
- package/proposals/NewProposalMenu.js +113 -0
- package/proposals/NewProposalMenu.js.map +1 -0
- package/proposals/ProposalBrowser.d.ts +22 -0
- package/{views/change-request/Proposals.js → proposals/ProposalBrowser.js} +20 -258
- package/proposals/ProposalBrowser.js.map +1 -0
- package/proposals/ProposalDetail.d.ts +6 -0
- package/proposals/ProposalDetail.js +67 -0
- package/proposals/ProposalDetail.js.map +1 -0
- package/proposals/ProposalItem.d.ts +16 -0
- package/proposals/ProposalItem.js +57 -0
- package/proposals/ProposalItem.js.map +1 -0
- package/proposals/ProposalSummary.d.ts +6 -0
- package/proposals/ProposalSummary.js +62 -0
- package/proposals/ProposalSummary.js.map +1 -0
- package/proposals/ProposalTab.d.ts +12 -0
- package/proposals/ProposalTab.js +102 -0
- package/proposals/ProposalTab.js.map +1 -0
- package/proposals/ProposalType.d.ts +11 -0
- package/proposals/ProposalType.js +99 -0
- package/proposals/ProposalType.js.map +1 -0
- package/proposals/ProposalWorkspace.d.ts +13 -0
- package/proposals/ProposalWorkspace.js +132 -0
- package/proposals/ProposalWorkspace.js.map +1 -0
- package/proposals/Search.d.ts +26 -0
- package/proposals/Search.js +109 -0
- package/proposals/Search.js.map +1 -0
- package/{views/change-request → proposals}/TransitionHistory.d.ts +3 -2
- package/{views/change-request → proposals}/TransitionHistory.js +18 -14
- package/proposals/TransitionHistory.js.map +1 -0
- package/{views/change-request → proposals}/TransitionOptions.d.ts +3 -3
- package/{views/change-request → proposals}/TransitionOptions.js +34 -12
- package/proposals/TransitionOptions.js.map +1 -0
- package/proposals/actionableGroups/Tree.js +23 -5
- package/proposals/actionableGroups/Tree.js.map +1 -1
- package/proposals/actionableGroups/queries.d.ts +0 -1
- package/proposals/actionableGroups/queries.js +7 -10
- package/proposals/actionableGroups/queries.js.map +1 -1
- package/proposals/actionableGroups/treeNodes.d.ts +2 -1
- package/proposals/actionableGroups/treeNodes.js +42 -10
- package/proposals/actionableGroups/treeNodes.js.map +1 -1
- package/proposals/index.d.ts +6 -0
- package/proposals/index.js +83 -0
- package/proposals/index.js.map +1 -0
- package/{views/change-request → proposals}/objectChangeset.d.ts +4 -4
- package/{views/change-request → proposals}/objectChangeset.js +6 -6
- package/proposals/objectChangeset.js.map +1 -0
- package/proposals/queries.d.ts +4 -0
- package/proposals/queries.js +14 -0
- package/proposals/queries.js.map +1 -0
- package/{types/cr.d.ts → proposals/types.d.ts} +80 -5
- package/{types/cr.js → proposals/types.js} +72 -3
- package/proposals/types.js.map +1 -0
- package/types/index.d.ts +0 -1
- package/types/index.js +0 -13
- package/types/index.js.map +1 -1
- package/types/util.d.ts +1 -1
- package/types/util.js.map +1 -1
- package/types/views.d.ts +1 -1
- package/types/views.js.map +1 -1
- package/views/FilterCriteria/models.d.ts +2 -0
- package/views/FilterCriteria/models.js +12 -2
- package/views/FilterCriteria/models.js.map +1 -1
- package/views/GenericRelatedItemView.js +4 -4
- package/views/GenericRelatedItemView.js.map +1 -1
- package/views/RegisterStakeholder.d.ts +4 -1
- package/views/RegisterStakeholder.js +19 -13
- package/views/RegisterStakeholder.js.map +1 -1
- package/views/detail/ChangeRequest/index.js +12 -160
- package/views/detail/ChangeRequest/index.js.map +1 -1
- package/views/detail/ProposalWork.d.ts +8 -0
- package/views/detail/ProposalWork.js +213 -0
- package/views/detail/ProposalWork.js.map +1 -0
- package/views/detail/RegisterHome/ActiveProposalDetails.d.ts +1 -1
- package/views/detail/RegisterHome/ActiveProposalDetails.js +4 -4
- package/views/detail/RegisterHome/ActiveProposalDetails.js.map +1 -1
- package/views/detail/RegisterHome/Proposal.d.ts +1 -1
- package/views/detail/RegisterHome/Proposal.js +2 -6
- package/views/detail/RegisterHome/Proposal.js.map +1 -1
- package/views/detail/RegisterHome/index.js +12 -16
- package/views/detail/RegisterHome/index.js.map +1 -1
- package/views/detail/RegisterHome2/index.d.ts +5 -0
- package/views/detail/RegisterHome2/index.js +58 -0
- package/views/detail/RegisterHome2/index.js.map +1 -0
- package/views/detail/RegisterItem/index.d.ts +2 -1
- package/views/detail/RegisterItem/index.js +62 -21
- package/views/detail/RegisterItem/index.js.map +1 -1
- package/views/detail/RegisterItemClass.js +1 -1
- package/views/detail/RegisterItemClass.js.map +1 -1
- package/views/detail/RegisterMeta/RegisterMetaForm.js +1 -46
- package/views/detail/RegisterMeta/RegisterMetaForm.js.map +1 -1
- package/views/hooks/useLatestAcceptedProposal.d.ts +2 -0
- package/views/hooks/useLatestAcceptedProposal.js +48 -0
- package/views/hooks/useLatestAcceptedProposal.js.map +1 -0
- package/views/hooks/useRegisterVersion.d.ts +5 -0
- package/views/hooks/useRegisterVersion.js +47 -0
- package/views/hooks/useRegisterVersion.js.map +1 -0
- package/views/hooks/useSingleRegisterItemData.js.map +1 -1
- package/views/index.js +38 -16
- package/views/index.js.map +1 -1
- package/views/itemQueryUtils.d.ts +1 -1
- package/views/itemQueryUtils.js +12 -7
- package/views/itemQueryUtils.js.map +1 -1
- package/views/protocolRegistry.d.ts +1 -0
- package/views/protocolRegistry.js +4 -0
- package/views/protocolRegistry.js.map +1 -1
- package/views/sidebar/Browse/index.js +2 -2
- package/views/sidebar/Browse/index.js.map +1 -1
- package/views/sidebar/Registration/index.d.ts +0 -1
- package/views/sidebar/Registration/index.js +9 -37
- package/views/sidebar/Registration/index.js.map +1 -1
- package/views/sidebar/Search/index.d.ts +3 -0
- package/views/sidebar/Search/index.js +12 -11
- package/views/sidebar/Search/index.js.map +1 -1
- package/views/sidebar/index.js +40 -10
- package/views/sidebar/index.js.map +1 -1
- package/views/util.d.ts +6 -1
- package/views/util.js +30 -7
- package/views/util.js.map +1 -1
- package/types/cr.js.map +0 -1
- package/types/proposal.d.ts +0 -90
- package/types/proposal.js +0 -71
- package/types/proposal.js.map +0 -1
- package/views/ProposalHistoryDrawer.js.map +0 -1
- package/views/change-request/ChangeRequestContext.js.map +0 -1
- package/views/change-request/Proposals.d.ts +0 -40
- package/views/change-request/Proposals.js.map +0 -1
- package/views/change-request/Summary.js +0 -59
- package/views/change-request/Summary.js.map +0 -1
- package/views/change-request/TransitionHistory.js.map +0 -1
- package/views/change-request/TransitionOptions.js.map +0 -1
- package/views/change-request/objectChangeset.js.map +0 -1
- package/views/change-request/util.d.ts +0 -4
- package/views/change-request/util.js +0 -14
- package/views/change-request/util.js.map +0 -1
- /package/{views/ProposalHistoryDrawer.d.ts → proposals/HistoryDrawer.d.ts} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
|
|
12
|
+
var _core = require("@blueprintjs/core");
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
|
|
20
|
+
/** @jsxFrag React.Fragment */
|
|
21
|
+
const NewProposalMenu = function ({
|
|
22
|
+
previousVersion,
|
|
23
|
+
onCreateBlank,
|
|
24
|
+
onImport,
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const [createMode, setCreateMode] = (0, _react.useState)(false);
|
|
28
|
+
const creatingBlank = onCreateBlank && createMode;
|
|
29
|
+
const stack = (0, _react.useMemo)(() => {
|
|
30
|
+
const stack = [];
|
|
31
|
+
const createMenu = (0, _react2.jsx)(_core.Menu, {
|
|
32
|
+
css: (0, _react2.css)`overflow-y: auto; background: none !important;`
|
|
33
|
+
}, (0, _react2.jsx)(_core.MenuItem, {
|
|
34
|
+
text: "Start blank proposal",
|
|
35
|
+
onClick: onCreateBlank && !createMode ? () => setCreateMode(true) : undefined,
|
|
36
|
+
disabled: !onCreateBlank,
|
|
37
|
+
active: creatingBlank,
|
|
38
|
+
selected: creatingBlank,
|
|
39
|
+
icon: "add"
|
|
40
|
+
}), (0, _react2.jsx)(_core.MenuItem, {
|
|
41
|
+
text: "Import proposal",
|
|
42
|
+
onClick: onImport,
|
|
43
|
+
disabled: !onImport || creatingBlank,
|
|
44
|
+
icon: "import"
|
|
45
|
+
}));
|
|
46
|
+
stack.push({
|
|
47
|
+
title: "Add new proposal",
|
|
48
|
+
renderPanel: () => createMenu
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (creatingBlank) {
|
|
52
|
+
stack.push({
|
|
53
|
+
title: "Start blank proposal",
|
|
54
|
+
renderPanel: () => (0, _react2.jsx)(NewProposal, {
|
|
55
|
+
previousVersion: previousVersion,
|
|
56
|
+
onCreateBlank: onCreateBlank,
|
|
57
|
+
css: (0, _react2.css)`padding: 5px;`
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return stack;
|
|
63
|
+
}, [onCreateBlank, onImport, creatingBlank, previousVersion]);
|
|
64
|
+
return (0, _react2.jsx)(_core.PanelStack2, {
|
|
65
|
+
css: (0, _react2.css)`flex: 1; overflow: unset; .bp4-panel-stack-view { background: none; border: none; }`,
|
|
66
|
+
className: className,
|
|
67
|
+
onClose: () => setCreateMode(false),
|
|
68
|
+
stack: stack.length > 0 ? stack : [{
|
|
69
|
+
title: '',
|
|
70
|
+
renderPanel: () => (0, _react2.jsx)(_core.NonIdealState, {
|
|
71
|
+
title: "Nothing to show"
|
|
72
|
+
})
|
|
73
|
+
}]
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var _default = NewProposalMenu;
|
|
78
|
+
exports.default = _default;
|
|
79
|
+
|
|
80
|
+
const NewProposal = function ({
|
|
81
|
+
previousVersion,
|
|
82
|
+
onCreateBlank,
|
|
83
|
+
className
|
|
84
|
+
}) {
|
|
85
|
+
const [newProposalIdea, setNewProposalIdea] = (0, _react.useState)('');
|
|
86
|
+
const handleNewProposal = (0, _react.useCallback)(async function handleNewProposal() {
|
|
87
|
+
if (newProposalIdea.trim()) {
|
|
88
|
+
await (onCreateBlank === null || onCreateBlank === void 0 ? void 0 : onCreateBlank(newProposalIdea));
|
|
89
|
+
setNewProposalIdea('');
|
|
90
|
+
} else {
|
|
91
|
+
throw new Error("Cannot create proposal: need some initial motivation for the change");
|
|
92
|
+
}
|
|
93
|
+
}, [newProposalIdea, onCreateBlank]);
|
|
94
|
+
return (0, _react2.jsx)(_core.FormGroup, {
|
|
95
|
+
className: className,
|
|
96
|
+
css: (0, _react2.css)`overflow-y: auto;`,
|
|
97
|
+
label: (0, _react2.jsx)(_react.default.Fragment, null, "Propose", previousVersion ? ` a change to version ${previousVersion}:` : ` the first change:`)
|
|
98
|
+
}, (0, _react2.jsx)(_core.ControlGroup, {
|
|
99
|
+
vertical: true
|
|
100
|
+
}, (0, _react2.jsx)(_core.TextArea, {
|
|
101
|
+
value: newProposalIdea !== null && newProposalIdea !== void 0 ? newProposalIdea : '',
|
|
102
|
+
placeholder: "Your idea\u2026",
|
|
103
|
+
title: "Justification draft (you can change this later)",
|
|
104
|
+
onChange: evt => setNewProposalIdea(evt.currentTarget.value)
|
|
105
|
+
}), (0, _react2.jsx)(_core.Button, {
|
|
106
|
+
fill: true,
|
|
107
|
+
intent: newProposalIdea ? 'primary' : undefined,
|
|
108
|
+
disabled: !newProposalIdea.trim() || !onCreateBlank,
|
|
109
|
+
title: "A blank proposal will be created and opened in a new tab.",
|
|
110
|
+
onClick: handleNewProposal,
|
|
111
|
+
icon: "tick"
|
|
112
|
+
}, "Create")));
|
|
113
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewProposalMenu.js","sourceRoot":"","sources":["../../src/proposals/NewProposalMenu.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAA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B,KAAK,EAAE;;YAEJ,eAAe;gBACd,CAAC,CAAC,wBAAwB,eAAe,GAAG;gBAC5C,CAAC,CAAC,oBAAoB,CACvB;QACL,IAAC,YAAY,IAAC,QAAQ;YACpB,IAAC,QAAQ,IACP,KAAK,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,EAC5B,WAAW,EAAC,iBAAY,EACxB,KAAK,EAAC,iDAAiD,EACvD,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,GAC5D;YACF,IAAC,MAAM,IACH,IAAI,QACJ,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAA,CAAC,CAAC,SAAS,EAC9C,QAAQ,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EACnD,KAAK,EAAC,2DAA2D,EACjE,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAC,MAAM,aAEN,CACI,CACL,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, {\n useState,\n useCallback,\n useMemo,\n} from 'react';\nimport { jsx, css } from '@emotion/react';\nimport {\n Button,\n FormGroup,\n ControlGroup,\n TextArea,\n PanelStack2 as PanelStack, type Panel,\n Menu, MenuItem,\n NonIdealState,\n} from '@blueprintjs/core';\n\n\nconst NewProposalMenu: React.FC<{\n className?: string\n previousVersion: string | null\n onCreateBlank?: (idea: string) => Promise<void>\n onImport?: () => Promise<void>\n}> = function ({ previousVersion, onCreateBlank, onImport, className }) {\n const [ createMode, setCreateMode ] = useState(false);\n const creatingBlank = onCreateBlank && createMode;\n\n const stack: Panel<any>[] = useMemo(() => {\n const stack = [];\n const createMenu = (\n <Menu css={css`overflow-y: auto; background: none !important;`}>\n <MenuItem \n text=\"Start blank proposal\"\n onClick={(onCreateBlank && !createMode)\n ? (() => setCreateMode(true))\n : undefined}\n disabled={!onCreateBlank}\n active={creatingBlank}\n selected={creatingBlank}\n icon=\"add\"\n />\n <MenuItem\n text=\"Import proposal\"\n onClick={onImport}\n disabled={!onImport || creatingBlank}\n icon=\"import\"\n />\n </Menu>\n );\n\n stack.push({\n title: \"Add new proposal\",\n renderPanel: () => createMenu,\n });\n\n if (creatingBlank) {\n stack.push({\n title: \"Start blank proposal\",\n renderPanel: () =>\n <NewProposal\n previousVersion={previousVersion}\n onCreateBlank={onCreateBlank}\n css={css`padding: 5px;`}\n />,\n });\n }\n return stack;\n }, [onCreateBlank, onImport, creatingBlank, previousVersion]);\n\n return <PanelStack\n css={css`flex: 1; overflow: unset; .bp4-panel-stack-view { background: none; border: none; }`}\n className={className}\n onClose={() => setCreateMode(false)}\n stack={stack.length > 0\n ? stack\n : [{ title: '', renderPanel: () => <NonIdealState title=\"Nothing to show\" /> }]}\n />;\n};\n\nexport default NewProposalMenu;\n\n\nconst NewProposal: React.VoidFunctionComponent<{\n previousVersion: string | null\n onCreateBlank?: (idea: string) => Promise<void>\n className?: string\n}> = function ({ previousVersion, onCreateBlank, className }) {\n const [ newProposalIdea, setNewProposalIdea ] = useState('');\n\n const handleNewProposal = useCallback(async function handleNewProposal () {\n if (newProposalIdea.trim()) {\n await onCreateBlank?.(newProposalIdea);\n setNewProposalIdea('');\n } else {\n throw new Error(\"Cannot create proposal: need some initial motivation for the change\");\n }\n }, [newProposalIdea, onCreateBlank]);\n\n return (\n <FormGroup\n className={className}\n css={css`overflow-y: auto;`}\n label={<>\n Propose\n {previousVersion\n ? ` a change to version ${previousVersion}:`\n : ` the first change:`}\n </>}>\n <ControlGroup vertical>\n <TextArea\n value={newProposalIdea ?? ''}\n placeholder=\"Your idea…\"\n title=\"Justification draft (you can change this later)\"\n onChange={evt => setNewProposalIdea(evt.currentTarget.value)}\n />\n <Button\n fill\n intent={newProposalIdea ? 'primary': undefined}\n disabled={!newProposalIdea.trim() || !onCreateBlank}\n title=\"A blank proposal will be created and opened in a new tab.\"\n onClick={handleNewProposal}\n icon=\"tick\">\n Create\n </Button>\n </ControlGroup>\n </FormGroup>\n );\n};\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
/** @jsxFrag React.Fragment */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { Drafted } from './types';
|
|
5
|
+
interface ProposalBrowserProps<CR extends Drafted> {
|
|
6
|
+
proposals: CR['items'];
|
|
7
|
+
selectedItem?: (string & keyof CR['items']) | null;
|
|
8
|
+
onSelectItem: (selectedItem: (string & keyof CR['items']) | null) => void;
|
|
9
|
+
/**
|
|
10
|
+
* If provided, button to delete each proposed change
|
|
11
|
+
* is shown in change card list mode.
|
|
12
|
+
*/
|
|
13
|
+
onDeleteProposalForItemAtPath?: (itemPath: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shows a list of individual proposed changes as cards by default,
|
|
17
|
+
* allowing to expand a proposal and view item details.
|
|
18
|
+
*
|
|
19
|
+
* If no proposals exist, returns null.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ProposalBrowser<CR extends Drafted>({ proposals, onDeleteProposalForItemAtPath, selectedItem, onSelectItem: selectProposal }: ProposalBrowserProps<CR>): jsx.JSX.Element;
|
|
22
|
+
export default ProposalBrowser;
|
|
@@ -3,39 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.default = exports.ProposalSummary = exports.ProposalDetail = void 0;
|
|
6
|
+
exports.ProposalBrowser = ProposalBrowser;
|
|
7
|
+
exports.default = void 0;
|
|
9
8
|
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
|
|
12
11
|
var _react2 = require("@emotion/react");
|
|
13
12
|
|
|
14
|
-
var _core = require("@blueprintjs/core");
|
|
15
|
-
|
|
16
13
|
var _select = require("@blueprintjs/select");
|
|
17
14
|
|
|
18
|
-
var
|
|
15
|
+
var _core = require("@blueprintjs/core");
|
|
19
16
|
|
|
20
17
|
var _ErrorBoundary = _interopRequireDefault(require("@riboseinc/paneron-extension-kit/widgets/ErrorBoundary"));
|
|
21
18
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _protocolRegistry = require("../protocolRegistry");
|
|
19
|
+
var _itemPathUtils = require("../views/itemPathUtils");
|
|
25
20
|
|
|
26
|
-
var _BrowserCtx = require("../BrowserCtx");
|
|
21
|
+
var _BrowserCtx = require("../views/BrowserCtx");
|
|
27
22
|
|
|
28
|
-
var
|
|
23
|
+
var _protocolRegistry = require("../views/protocolRegistry");
|
|
29
24
|
|
|
30
|
-
var
|
|
25
|
+
var _ProposalItem = require("./ProposalItem");
|
|
31
26
|
|
|
32
|
-
var
|
|
27
|
+
var _ProposalSummary = _interopRequireDefault(require("./ProposalSummary"));
|
|
33
28
|
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var _Block = require("../detail/RegisterHome/Block");
|
|
37
|
-
|
|
38
|
-
var _RegisterItem = require("../detail/RegisterItem");
|
|
29
|
+
var _ProposalDetail = _interopRequireDefault(require("./ProposalDetail"));
|
|
39
30
|
|
|
40
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
32
|
|
|
@@ -46,26 +37,19 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
46
37
|
/** @jsx jsx */
|
|
47
38
|
|
|
48
39
|
/** @jsxFrag React.Fragment */
|
|
49
|
-
|
|
50
|
-
return JSON.stringify(i1) === JSON.stringify(i2);
|
|
51
|
-
}
|
|
40
|
+
|
|
52
41
|
/**
|
|
53
42
|
* Shows a list of individual proposed changes as cards by default,
|
|
54
43
|
* allowing to expand a proposal and view item details.
|
|
55
44
|
*
|
|
56
45
|
* If no proposals exist, returns null.
|
|
57
46
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function Proposals({
|
|
47
|
+
function ProposalBrowser({
|
|
61
48
|
proposals,
|
|
62
49
|
onDeleteProposalForItemAtPath,
|
|
63
50
|
selectedItem,
|
|
64
51
|
onSelectItem: selectProposal
|
|
65
52
|
}) {
|
|
66
|
-
var _a;
|
|
67
|
-
|
|
68
|
-
const [preferDiff, setPreferDiff] = (0, _react.useState)(false);
|
|
69
53
|
const selectedProposal = selectedItem !== null && selectedItem !== void 0 ? selectedItem : null; // TODO: Temporarily unsupported
|
|
70
54
|
// (limitations of current change annotation implementation)
|
|
71
55
|
//const [ showOnlyChanged, setShowOnlyChanged ] = useState(true);
|
|
@@ -168,15 +152,13 @@ function Proposals({
|
|
|
168
152
|
// }
|
|
169
153
|
//}, [selectedProposal === null]);
|
|
170
154
|
|
|
171
|
-
const
|
|
172
|
-
const showDiff = canShowDiff && preferDiff;
|
|
173
|
-
const selectedItemSummary = haveSelectedItem ? (0, _react2.jsx)(ProposalSummary, {
|
|
155
|
+
const selectedItemSummary = haveSelectedItem ? (0, _react2.jsx)(_ProposalSummary.default, {
|
|
174
156
|
itemRef: selectedItemRef,
|
|
175
157
|
item: selectedItemProposed !== null && selectedItemProposed !== void 0 ? selectedItemProposed : selectedItemCurrent,
|
|
176
158
|
itemBefore: selectedItemCurrent !== null && selectedItemCurrent !== void 0 ? selectedItemCurrent : undefined,
|
|
177
159
|
proposal: proposals[selectedProposal]
|
|
178
160
|
}) : (0, _react2.jsx)(_react.default.Fragment, null, "Select item\u2026");
|
|
179
|
-
const icon = haveSelectedItem ? getProposalIcon(proposals[selectedProposal]) : undefined;
|
|
161
|
+
const icon = haveSelectedItem ? (0, _ProposalItem.getProposalIcon)(proposals[selectedProposal]) : undefined;
|
|
180
162
|
const selectedItemDrawer = (0, _react.useMemo)(() => {
|
|
181
163
|
var _a;
|
|
182
164
|
|
|
@@ -190,15 +172,6 @@ function Proposals({
|
|
|
190
172
|
icon: 'open-application',
|
|
191
173
|
onClick: () => jumpTo === null || jumpTo === void 0 ? void 0 : jumpTo(`${_protocolRegistry.Protocols.ITEM_DETAILS}:${selectedProposal}`),
|
|
192
174
|
title: "Open selected item in a new tab (not applicable to proposed additions)"
|
|
193
|
-
}), (0, _react2.jsx)(_core.Button, {
|
|
194
|
-
active: preferDiff,
|
|
195
|
-
onClick: () => setPreferDiff(v => !v),
|
|
196
|
-
// Diffing only makes sense for clarifications.
|
|
197
|
-
// Additions are entire new items, and for amendments
|
|
198
|
-
// item data is unchanged.
|
|
199
|
-
disabled: !canShowDiff,
|
|
200
|
-
text: "Compare",
|
|
201
|
-
title: "Annotate proposed clarifications for this item"
|
|
202
175
|
}), (0, _react2.jsx)(_react2.ClassNames, null, ({
|
|
203
176
|
css: css2
|
|
204
177
|
}) => (0, _react2.jsx)(_select.Select2, {
|
|
@@ -214,7 +187,7 @@ function Proposals({
|
|
|
214
187
|
matchTargetWidth: true
|
|
215
188
|
},
|
|
216
189
|
fill: true,
|
|
217
|
-
itemRenderer: ChangeProposalItemView,
|
|
190
|
+
itemRenderer: _ProposalItem.ChangeProposalItemView,
|
|
218
191
|
onItemSelect: handleItemSelect
|
|
219
192
|
}, (0, _react2.jsx)(_core.Button, {
|
|
220
193
|
fill: true,
|
|
@@ -233,233 +206,22 @@ function Proposals({
|
|
|
233
206
|
value: proposalBrowserCtx
|
|
234
207
|
}, (0, _react2.jsx)(_ErrorBoundary.default, {
|
|
235
208
|
viewName: "Proposal detail"
|
|
236
|
-
}, (0, _react2.jsx)(
|
|
209
|
+
}, (0, _react2.jsx)(_ProposalDetail.default, {
|
|
237
210
|
itemRef: selectedItemRef,
|
|
238
|
-
showDiff: showDiff,
|
|
239
211
|
//showOnlyChanged={showOnlyChanged}
|
|
240
212
|
item: selectedItemProposed !== null && selectedItemProposed !== void 0 ? selectedItemProposed : selectedItemCurrent,
|
|
241
213
|
itemBefore: selectedItemCurrent !== null && selectedItemCurrent !== void 0 ? selectedItemCurrent : undefined,
|
|
242
214
|
proposal: proposals[selectedProposal]
|
|
243
215
|
}))))) : null);
|
|
244
|
-
}, [proposalCount > 0, haveSelectedItem, selectedItemProposed, selectedItemCurrent,
|
|
245
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, selectedItemDrawer
|
|
246
|
-
const actions = [{
|
|
247
|
-
onClick: () => selectProposal(cpi.itemPath),
|
|
248
|
-
text: "Expand",
|
|
249
|
-
title: "Expand proposed change to see item details",
|
|
250
|
-
icon: 'maximize'
|
|
251
|
-
}];
|
|
252
|
-
|
|
253
|
-
if (onDeleteProposalForItemAtPath) {
|
|
254
|
-
actions.push({
|
|
255
|
-
text: "Delete this proposal",
|
|
256
|
-
intent: 'danger',
|
|
257
|
-
onClick: () => onDeleteProposalForItemAtPath(cpi.itemPath),
|
|
258
|
-
icon: 'trash'
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return (0, _react2.jsx)(_Block.HomeBlockCard, {
|
|
263
|
-
css: (0, _react2.css)`
|
|
264
|
-
flex-basis: calc(33.33% - 10px*2/3);
|
|
265
|
-
`,
|
|
266
|
-
description: `${cpi.proposal.type} proposal`,
|
|
267
|
-
key: cpi.itemPath
|
|
268
|
-
}, (0, _react2.jsx)(ProposalType, {
|
|
269
|
-
proposal: cpi.proposal
|
|
270
|
-
}), (0, _react2.jsx)("div", {
|
|
271
|
-
css: (0, _react2.css)`padding: 5px; flex-grow: 1;`
|
|
272
|
-
}, cpi.item !== null ? (0, _react2.jsx)(_core.H5, {
|
|
273
|
-
css: (0, _react2.css)`margin: 0; overflow: hidden; text-overflow: ellipsis;`
|
|
274
|
-
}, (0, _react2.jsx)(ProposalSummary, {
|
|
275
|
-
itemRef: cpi.itemRef,
|
|
276
|
-
proposal: cpi.proposal,
|
|
277
|
-
itemBefore: cpi.itemBefore,
|
|
278
|
-
item: cpi.item
|
|
279
|
-
})) : (0, _react2.jsx)(_react.default.Fragment, null, "Problem reading proposed item data.")), actions.length > 0 ? (0, _react2.jsx)(_Block.HomeBlockActions, {
|
|
280
|
-
actions: actions
|
|
281
|
-
}) : null);
|
|
282
|
-
}));
|
|
216
|
+
}, [proposalCount > 0, haveSelectedItem, selectedItemProposed, selectedItemCurrent, jumpTo, handleItemSelect, selectedProposal && proposals[selectedProposal]]);
|
|
217
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, selectedItemDrawer);
|
|
283
218
|
}
|
|
284
219
|
|
|
285
220
|
;
|
|
286
221
|
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
}) {
|
|
290
|
-
const proposalConfig = proposal.type === 'amendment' ? PROPOSAL_VIEWS[proposal.amendmentType] : PROPOSAL_VIEWS[proposal.type]; //const ProposalTypeLabel: React.FC<ProposalProps<any>> = proposalConfig.summary;
|
|
291
|
-
|
|
292
|
-
const tagProps = (0, _util.proposalToTagProps)(proposal);
|
|
293
|
-
return (0, _react2.jsx)(_core.Tag, {
|
|
294
|
-
minimal: true,
|
|
295
|
-
...tagProps,
|
|
296
|
-
rightIcon: (0, _react2.jsx)(_HelpTooltip.default, {
|
|
297
|
-
content: (0, _react2.jsx)(_react.default.Fragment, null, "Proposed to be ", proposalConfig.hint)
|
|
298
|
-
})
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const ChangeProposalItemView = (item, {
|
|
303
|
-
handleClick,
|
|
304
|
-
modifiers,
|
|
305
|
-
query
|
|
306
|
-
}) => {
|
|
307
|
-
if (item.item !== null) {
|
|
308
|
-
const i = item;
|
|
309
|
-
return (0, _react2.jsx)(_core.MenuItem, {
|
|
310
|
-
active: modifiers.active,
|
|
311
|
-
disabled: modifiers.disabled,
|
|
312
|
-
labelElement: (0, _react2.jsx)(ProposalType, {
|
|
313
|
-
proposal: i.proposal
|
|
314
|
-
}),
|
|
315
|
-
key: item.itemPath,
|
|
316
|
-
onClick: handleClick,
|
|
317
|
-
icon: getProposalIcon(item.proposal),
|
|
318
|
-
text: (0, _react2.jsx)(ProposalSummary, { ...i
|
|
319
|
-
})
|
|
320
|
-
});
|
|
321
|
-
} else {
|
|
322
|
-
return (0, _react2.jsx)(_core.MenuItem, {
|
|
323
|
-
disabled: true,
|
|
324
|
-
icon: "heart-broken",
|
|
325
|
-
onClick: handleClick,
|
|
326
|
-
text: `Broken proposal entry at path ${item.itemPath}`
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
const ProposalDetail = (0, _react.memo)(function ({
|
|
332
|
-
proposal,
|
|
333
|
-
showDiff,
|
|
334
|
-
showOnlyChanged,
|
|
335
|
-
itemRef,
|
|
336
|
-
item,
|
|
337
|
-
itemBefore,
|
|
338
|
-
onChange
|
|
339
|
-
}) {
|
|
340
|
-
var _a;
|
|
341
|
-
|
|
342
|
-
const itemClass = (0, _useItemClassConfig.default)((_a = itemRef.classID) !== null && _a !== void 0 ? _a : 'NONEXISTENT_CLASS_ID');
|
|
343
|
-
|
|
344
|
-
if (!itemClass) {
|
|
345
|
-
throw new Error(`Unknown item class “${itemRef.classID}”!`);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const view = showDiff ? (0, _react2.jsx)(_InlineDiff.InlineDiffGeneric, {
|
|
349
|
-
item1: itemBefore !== null && itemBefore !== void 0 ? itemBefore : {},
|
|
350
|
-
item2: item,
|
|
351
|
-
css: (0, _react2.css)`
|
|
352
|
-
position: absolute; inset: 0; padding: 10px; overflow: auto;
|
|
353
|
-
background-color: white;
|
|
354
|
-
.bp4-dark & {
|
|
355
|
-
background-color: ${_core.Colors.DARK_GRAY2};
|
|
356
|
-
}
|
|
357
|
-
`,
|
|
358
|
-
className: `${_core.Classes.ELEVATION_2} ${_core.Classes.RUNNING_TEXT}`
|
|
359
|
-
}) : (0, _react2.jsx)(_RegisterItem.ItemDetail, {
|
|
360
|
-
itemRef: itemRef,
|
|
361
|
-
item: item,
|
|
362
|
-
itemClass: itemClass,
|
|
363
|
-
key: JSON.stringify(itemRef),
|
|
364
|
-
compactHeader: true
|
|
365
|
-
});
|
|
366
|
-
return (0, _react2.jsx)("div", {
|
|
367
|
-
css: (0, _react2.css)`position: absolute; inset: 0; display: flex; flex-flow: column;`
|
|
368
|
-
}, view);
|
|
369
|
-
});
|
|
370
|
-
exports.ProposalDetail = ProposalDetail;
|
|
371
|
-
|
|
372
|
-
const ProposalSummary = function ({
|
|
373
|
-
proposal,
|
|
374
|
-
itemRef,
|
|
375
|
-
item,
|
|
376
|
-
itemBefore,
|
|
377
|
-
onChange
|
|
378
|
-
}) {
|
|
379
|
-
var _a;
|
|
380
|
-
|
|
381
|
-
const {
|
|
382
|
-
itemClasses
|
|
383
|
-
} = (0, _react.useContext)(_BrowserCtx.BrowserCtx);
|
|
384
|
-
const {
|
|
385
|
-
classID
|
|
386
|
-
} = itemRef;
|
|
387
|
-
const cls = itemClasses[classID];
|
|
388
|
-
const ListItemView = (_a = cls === null || cls === void 0 ? void 0 : cls.views) === null || _a === void 0 ? void 0 : _a.listItemView;
|
|
389
|
-
|
|
390
|
-
if (ListItemView) {
|
|
391
|
-
return (0, _react2.jsx)("span", {
|
|
392
|
-
css: (0, _react2.css)`
|
|
393
|
-
display: inline-flex;
|
|
394
|
-
flex-flow: row nowrap;
|
|
395
|
-
align-items: baseline;
|
|
396
|
-
`
|
|
397
|
-
}, (0, _react2.jsx)(ListItemView, {
|
|
398
|
-
itemRef: itemRef,
|
|
399
|
-
itemData: item.data,
|
|
400
|
-
css: (0, _react2.css)`text-overflow: ellipsis; overflow: hidden;`
|
|
401
|
-
}), "\u2003", (0, _react2.jsx)("small", null, cls.meta.title));
|
|
402
|
-
} else {
|
|
403
|
-
return (0, _react2.jsx)(_ErrorState.default, {
|
|
404
|
-
viewName: "list item view",
|
|
405
|
-
inline: true,
|
|
406
|
-
error: "unable to load list item view"
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
exports.ProposalSummary = ProposalSummary;
|
|
412
|
-
const clarification = {
|
|
413
|
-
hint: (0, _react2.jsx)(_react.default.Fragment, null, "altered to represent the same concept more clearly."),
|
|
414
|
-
summary: (0, _react.memo)(({
|
|
415
|
-
proposal,
|
|
416
|
-
item,
|
|
417
|
-
itemRef
|
|
418
|
-
}) => (0, _react2.jsx)(_react.default.Fragment, null, "Clarification"), () => true)
|
|
419
|
-
};
|
|
420
|
-
const addition = {
|
|
421
|
-
hint: (0, _react2.jsx)(_react.default.Fragment, null, "added to this register."),
|
|
422
|
-
summary: (0, _react.memo)(({
|
|
423
|
-
proposal,
|
|
424
|
-
item,
|
|
425
|
-
itemRef
|
|
426
|
-
}) => (0, _react2.jsx)(_react.default.Fragment, null, "Addition"), () => true)
|
|
427
|
-
};
|
|
428
|
-
const retirement = {
|
|
429
|
-
hint: (0, _react2.jsx)(_react.default.Fragment, null, "marked as no longer current. (Note that this register is append-only, so the item cannot be removed altogether.)"),
|
|
430
|
-
summary: (0, _react.memo)(({
|
|
431
|
-
proposal,
|
|
432
|
-
itemRef,
|
|
433
|
-
item
|
|
434
|
-
}) => (0, _react2.jsx)(_react.default.Fragment, null, "Retirement"), () => true)
|
|
435
|
-
};
|
|
436
|
-
const supersession = {
|
|
437
|
-
hint: (0, _react2.jsx)(_react.default.Fragment, null, "removed from the register with another item recommended for use in its place. A relation between the superseding and superseded item will be created, though the exact semantics of that relation depend on the register."),
|
|
438
|
-
summary: (0, _react.memo)(({
|
|
439
|
-
proposal,
|
|
440
|
-
itemRef,
|
|
441
|
-
item
|
|
442
|
-
}) => (0, _react2.jsx)(_react.default.Fragment, null, "Supersession"), () => true)
|
|
443
|
-
};
|
|
444
|
-
const invalidation = {
|
|
445
|
-
hint: (0, _react2.jsx)(_react.default.Fragment, null, "marked as invalid. The exact semantics of invalidation depend on the register."),
|
|
446
|
-
summary: (0, _react.memo)(({
|
|
447
|
-
proposal,
|
|
448
|
-
itemRef,
|
|
449
|
-
item
|
|
450
|
-
}) => (0, _react2.jsx)(_react.default.Fragment, null, "Invalidation"), () => true)
|
|
451
|
-
};
|
|
452
|
-
const PROPOSAL_VIEWS = {
|
|
453
|
-
clarification,
|
|
454
|
-
addition,
|
|
455
|
-
retirement,
|
|
456
|
-
supersession,
|
|
457
|
-
invalidation
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
function getProposalIcon(proposal) {
|
|
461
|
-
return proposal.type === 'addition' ? 'add' : proposal.type === 'clarification' ? 'edit' : 'ban-circle';
|
|
222
|
+
function stringifiedJSONEqual(i1, i2) {
|
|
223
|
+
return JSON.stringify(i1) === JSON.stringify(i2);
|
|
462
224
|
}
|
|
463
225
|
|
|
464
|
-
var _default =
|
|
226
|
+
var _default = ProposalBrowser;
|
|
465
227
|
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProposalBrowser.js","sourceRoot":"","sources":["../../src/proposals/ProposalBrowser.tsx"],"names":[],"mappings":"AACA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,aAAa,MAAM,wDAAwD,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAqC,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAiB,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAA2B,sBAAsB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAe9C;;;;;GAKG;AACH,MAAM,U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B,CAAE,EACpD,UAAU,EAAE,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,SAAS,EAC5C,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,GACrC,CACY,CACI,CAClB,CACL;YACL,CAAC,CAAC,IAAI,CACD,CAAA;KAAA,CACV,EAAE,CAAC,aAAa,GAAG,CAAC,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAEhK,OAAO,CACL,0BACG,kBAAkB,CAClB,CACJ,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,SAAS,oBAAoB,CAAC,EAAO,EAAE,EAAO;IAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,eAAe,eAAe,CAAC","sourcesContent":["\n/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ClassNames, jsx, css } from '@emotion/react';\nimport { Select2 as Select } from '@blueprintjs/select';\nimport { ButtonGroup, Button, Drawer, DrawerSize } from '@blueprintjs/core';\n\nimport ErrorBoundary from '@riboseinc/paneron-extension-kit/widgets/ErrorBoundary';\n\nimport { useItemRef, itemPathToItemRef } from '../views/itemPathUtils';\nimport { BrowserCtx, type BrowserCtx as BrowserCtxType } from '../views/BrowserCtx';\nimport { Protocols, type Protocol } from '../views/protocolRegistry';\n\nimport type { Drafted } from './types';\nimport { type ChangeProposalItem, ChangeProposalItemView, getProposalIcon } from './ProposalItem';\nimport ProposalSummary from './ProposalSummary';\nimport ProposalDetail from './ProposalDetail';\n\n\ninterface ProposalBrowserProps<CR extends Drafted> {\n proposals: CR['items']\n\n selectedItem?: (string & keyof CR['items']) | null\n onSelectItem: (selectedItem: (string & keyof CR['items']) | null) => void\n\n /**\n * If provided, button to delete each proposed change\n * is shown in change card list mode.\n */\n onDeleteProposalForItemAtPath?: (itemPath: string) => void\n}\n/**\n * Shows a list of individual proposed changes as cards by default,\n * allowing to expand a proposal and view item details.\n *\n * If no proposals exist, returns null.\n */\nexport function ProposalBrowser<CR extends Drafted>\n({ proposals, onDeleteProposalForItemAtPath, selectedItem, onSelectItem: selectProposal }:\nProposalBrowserProps<CR>) {\n const selectedProposal = selectedItem ?? null;\n\n // TODO: Temporarily unsupported\n // (limitations of current change annotation implementation)\n //const [ showOnlyChanged, setShowOnlyChanged ] = useState(true);\n\n const outerBrowserCtx = useContext(BrowserCtx);\n const { jumpTo, subregisters, useRegisterItemData } = outerBrowserCtx;\n\n /**\n * When jumping to an item affected by current CR,\n * jump in-CR instead of spawning tab.\n */\n const handleCRJump = useCallback(function _handleCRJump(uri: `${Protocol}:${string}`): void {\n if (uri.startsWith(Protocols.ITEM_DETAILS)) {\n const itemPath = uri.split(':')[1];\n if (proposals[itemPath]) {\n selectProposal(itemPath);\n } else {\n jumpTo?.(uri);\n }\n }\n }, [Object.keys(proposals), jumpTo]);\n\n const proposalBrowserCtx: BrowserCtxType = useMemo((() => ({\n ...outerBrowserCtx,\n jumpTo: handleCRJump,\n })), [handleCRJump, outerBrowserCtx]);\n\n /** Paths of register items in proposal. */\n const proposedItemPaths = Object.entries(proposals).map(([itemPath, proposal]) => {\n if (proposal.type === 'clarification' || proposal.type === 'addition') {\n return itemPath;\n } else {\n return undefined;\n }\n }).filter(s => s !== undefined) as string[];\n\n /** Proposed data of register items in proposal. */\n const proposedItemDataReq = useRegisterItemData({\n itemPaths: proposedItemPaths,\n });\n\n /** Pre-existing data of register items in proposal. */\n const currentItemDataReq = useRegisterItemData({\n itemPaths: Object.keys(proposals),\n ignoreActiveCR: true,\n });\n\n const getCurrentItem = useCallback(\n ((itemPath: string) => currentItemDataReq.value[itemPath] ?? null),\n [currentItemDataReq.value]);\n const getProposedItem = useCallback(\n ((itemPath: string) => proposedItemDataReq.value[itemPath] ?? null),\n [proposedItemDataReq.value]);\n\n /** Current register item (if any) corresponding to selected proposal. */\n const selectedItemCurrent = selectedProposal ? getCurrentItem(selectedProposal) : null;\n\n /** Proposed register item corresponding to selected proposal. */\n const selectedItemProposed = selectedProposal ? getProposedItem(selectedProposal) : null;\n\n const selectedItemRef = useItemRef(subregisters !== undefined, selectedProposal);\n\n const handleItemSelect = useCallback(\n ((item: ChangeProposalItem) => selectProposal(item.itemPath)),\n [selectProposal]);\n\n const activeItem: ChangeProposalItem | null = useMemo((() =>\n selectedProposal\n ? ({\n itemPath: selectedProposal,\n proposal: proposals[selectedProposal],\n item: (selectedItemProposed ?? selectedItemCurrent)!,\n itemBefore: selectedItemCurrent ?? undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, selectedProposal),\n })\n : null\n ), [selectedProposal, proposals, subregisters]);\n\n const allItems: ChangeProposalItem[] = useMemo((() =>\n Object.entries(proposals).map(([itemPath, proposal]) => ({\n itemPath,\n proposal,\n item: (getProposedItem(itemPath) ?? getCurrentItem(itemPath))! ?? null,\n itemBefore: undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, itemPath),\n }))\n ), [proposals, getCurrentItem, getProposedItem, subregisters !== undefined]);\n\n const haveSelectedItem =\n selectedProposal\n && selectedItemRef\n && proposals[selectedProposal]\n && (selectedItemProposed || selectedItemCurrent);\n\n const proposalCount = Object.keys(proposals).length;\n\n //useEffect(() => {\n // // if (!selectedProposal) {\n // // const firstProposal = Object.keys(proposals)[0];\n // // if (firstProposal) {\n // // if (getCurrentItem(firstProposal) || getProposedItem(firstProposal)) {\n // // selectProposal(firstProposal);\n // // }\n // // }\n // // }\n // if (selectedProposal) {\n // if (selectedProposalDetailRef.current) {\n // selectedProposalDetailRef.current.scrollIntoView({ block: 'center' });\n // }\n // }\n //}, [selectedProposal === null]);\n\n const selectedItemSummary = haveSelectedItem\n ? <ProposalSummary\n itemRef={selectedItemRef}\n item={(selectedItemProposed ?? selectedItemCurrent)!}\n itemBefore={selectedItemCurrent ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n : <>Select item…</>;\n const icon = haveSelectedItem\n ? getProposalIcon(proposals[selectedProposal])\n : undefined;\n\n const selectedItemDrawer = useMemo((() =>\n <Drawer\n isOpen={proposalCount > 0 && haveSelectedItem ? true : false}\n onClose={() => selectProposal(null)}\n size={DrawerSize.LARGE}\n enforceFocus={false}>\n {proposalCount > 0 && haveSelectedItem\n ? <>\n <ButtonGroup>\n <Button\n disabled={!jumpTo || proposals[selectedProposal]?.type === 'addition'}\n icon='open-application'\n onClick={() => jumpTo?.(`${Protocols.ITEM_DETAILS}:${selectedProposal}`)}\n title=\"Open selected item in a new tab (not applicable to proposed additions)\"\n />\n <ClassNames>\n {(({ css: css2 }) =>\n <Select<ChangeProposalItem>\n filterable={false}\n itemsEqual={stringifiedJSONEqual}\n menuProps={{ className: css2(`max-height: 50vh; overflow-y: auto;`) }}\n activeItem={activeItem}\n items={allItems}\n popoverProps={{ minimal: true, matchTargetWidth: true }}\n fill\n itemRenderer={ChangeProposalItemView}\n onItemSelect={handleItemSelect}>\n <Button\n fill\n rightIcon=\"chevron-down\"\n icon={icon}\n title=\"Switch between items in this proposal\"\n css={css`white-space: nowrap;`}>\n {selectedItemSummary}\n </Button>\n </Select>\n )}\n </ClassNames>\n <Button\n onClick={() => selectProposal(null)}\n icon=\"minimize\"\n title=\"Minimize proposed change view\"\n text=\"Minimize\"\n />\n </ButtonGroup>\n <div css={css`position: relative; flex: 1;`}>\n <BrowserCtx.Provider value={proposalBrowserCtx}>\n <ErrorBoundary viewName=\"Proposal detail\">\n <ProposalDetail\n itemRef={selectedItemRef}\n //showOnlyChanged={showOnlyChanged}\n item={(selectedItemProposed ?? selectedItemCurrent)!}\n itemBefore={selectedItemCurrent ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n </ErrorBoundary>\n </BrowserCtx.Provider>\n </div>\n </>\n : null}\n </Drawer>\n ), [proposalCount > 0, haveSelectedItem, selectedItemProposed, selectedItemCurrent, jumpTo, handleItemSelect, selectedProposal && proposals[selectedProposal]]);\n\n return (\n <>\n {selectedItemDrawer}\n </>\n );\n};\n\nfunction stringifiedJSONEqual(i1: any, i2: any): boolean {\n return JSON.stringify(i1) === JSON.stringify(i2);\n}\n\nexport default ProposalBrowser;\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ProposalDetail = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
|
|
12
|
+
var _core = require("@blueprintjs/core");
|
|
13
|
+
|
|
14
|
+
var _InlineDiff = require("../views/diffing/InlineDiff");
|
|
15
|
+
|
|
16
|
+
var _useItemClassConfig = _interopRequireDefault(require("../views/hooks/useItemClassConfig"));
|
|
17
|
+
|
|
18
|
+
var _RegisterItem = require("../views/detail/RegisterItem");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
/** @jsx jsx */
|
|
23
|
+
|
|
24
|
+
/** @jsxFrag React.Fragment */
|
|
25
|
+
const ProposalDetail = (0, _react.memo)(function ({
|
|
26
|
+
proposal,
|
|
27
|
+
showDiff,
|
|
28
|
+
showOnlyChanged,
|
|
29
|
+
itemRef,
|
|
30
|
+
item,
|
|
31
|
+
itemBefore,
|
|
32
|
+
onChange
|
|
33
|
+
}) {
|
|
34
|
+
var _a;
|
|
35
|
+
|
|
36
|
+
const itemClass = (0, _useItemClassConfig.default)((_a = itemRef.classID) !== null && _a !== void 0 ? _a : 'NONEXISTENT_CLASS_ID');
|
|
37
|
+
|
|
38
|
+
if (!itemClass) {
|
|
39
|
+
throw new Error(`Unknown item class “${itemRef.classID}”!`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const view = showDiff ? (0, _react2.jsx)(_InlineDiff.InlineDiffGeneric, {
|
|
43
|
+
item1: itemBefore !== null && itemBefore !== void 0 ? itemBefore : {},
|
|
44
|
+
item2: item,
|
|
45
|
+
css: (0, _react2.css)`
|
|
46
|
+
position: absolute; inset: 0; padding: 10px; overflow: auto;
|
|
47
|
+
background-color: white;
|
|
48
|
+
.bp4-dark & {
|
|
49
|
+
background-color: ${_core.Colors.DARK_GRAY2};
|
|
50
|
+
}
|
|
51
|
+
`,
|
|
52
|
+
className: `${_core.Classes.ELEVATION_2} ${_core.Classes.RUNNING_TEXT}`
|
|
53
|
+
}) : (0, _react2.jsx)(_RegisterItem.ItemDetail, {
|
|
54
|
+
itemRef: itemRef,
|
|
55
|
+
item: item,
|
|
56
|
+
itemBefore: itemBefore,
|
|
57
|
+
itemClass: itemClass,
|
|
58
|
+
key: JSON.stringify(itemRef),
|
|
59
|
+
compactHeader: true
|
|
60
|
+
});
|
|
61
|
+
return (0, _react2.jsx)("div", {
|
|
62
|
+
css: (0, _react2.css)`position: absolute; inset: 0; display: flex; flex-flow: column;`
|
|
63
|
+
}, view);
|
|
64
|
+
});
|
|
65
|
+
exports.ProposalDetail = ProposalDetail;
|
|
66
|
+
var _default = ProposalDetail;
|
|
67
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProposalDetail.js","sourceRoot":"","sources":["../../src/proposals/ProposalDetail.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,MAAM,CAAC,MAAM,cAAc,GAC3B,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE;;IACzF,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,sBAAsB,CAAC,CAAC;IAEhF,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;KAC7D;IAED,MAAM,IAAI,GAAgB,QAAQ;QAChC,CAAC,CAAC,IAAC,iBAAiB,IAChB,KAAK,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,EACvB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,GAAG,CAAA;;;;gCAIgB,MAAM,CAAC,UAAU;;SAExC,EACD,SAAS,EAAE,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,GAC3D;QACJ,CAAC,CAAC,IAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAC5B,aAAa,SACb,CAAC;IAEP,OAAO,aAAK,GAAG,EAAE,GAAG,CAAA,iEAAiE,IAClF,IAAI,CACD,CAAC;AACT,CAAC,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { memo } from 'react';\nimport { jsx, css } from '@emotion/react';\nimport { Classes, Colors } from '@blueprintjs/core';\n\nimport { InlineDiffGeneric } from '../views/diffing/InlineDiff';\nimport useItemClassConfig from '../views/hooks/useItemClassConfig';\nimport { ItemDetail } from '../views/detail/RegisterItem';\n\nimport type { ProposalProps, ChangeProposal } from './types';\n\n\nexport const ProposalDetail: React.FC<ProposalProps<ChangeProposal>> =\nmemo(function ({ proposal, showDiff, showOnlyChanged, itemRef, item, itemBefore, onChange }) {\n const itemClass = useItemClassConfig(itemRef.classID ?? 'NONEXISTENT_CLASS_ID');\n\n if (!itemClass) {\n throw new Error(`Unknown item class “${itemRef.classID}”!`);\n }\n\n const view: JSX.Element = showDiff\n ? <InlineDiffGeneric\n item1={itemBefore ?? {}}\n item2={item}\n css={css`\n position: absolute; inset: 0; padding: 10px; overflow: auto;\n background-color: white;\n .bp4-dark & {\n background-color: ${Colors.DARK_GRAY2};\n }\n `}\n className={`${Classes.ELEVATION_2} ${Classes.RUNNING_TEXT}`}\n />\n : <ItemDetail\n itemRef={itemRef}\n item={item}\n itemBefore={itemBefore}\n itemClass={itemClass}\n key={JSON.stringify(itemRef)}\n compactHeader\n />;\n\n return <div css={css`position: absolute; inset: 0; display: flex; flex-flow: column;`}>\n {view}\n </div>;\n});\n\nexport default ProposalDetail;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
/** @jsxFrag React.Fragment */
|
|
3
|
+
import { type ItemRenderer } from '@blueprintjs/select';
|
|
4
|
+
import { type IconName } from '@blueprintjs/core';
|
|
5
|
+
import type { InternalItemReference, Payload, RegisterItem } from '../types';
|
|
6
|
+
import type { ChangeProposal } from './types';
|
|
7
|
+
export interface ChangeProposalItem {
|
|
8
|
+
itemPath: string;
|
|
9
|
+
itemRef: InternalItemReference;
|
|
10
|
+
proposal: ChangeProposal;
|
|
11
|
+
item: RegisterItem<Payload> | null;
|
|
12
|
+
itemBefore: RegisterItem<Payload> | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare const ChangeProposalItemView: ItemRenderer<ChangeProposalItem>;
|
|
15
|
+
export default ChangeProposalItemView;
|
|
16
|
+
export declare function getProposalIcon(proposal: ChangeProposal): IconName;
|