drugflow-molstar 0.4.6 → 0.4.8
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/build/drugflow-molstar-0.4.8.css +1 -0
- package/build/drugflow-molstar-component-0.4.8.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.8.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.8.js.LICENSE.txt +39 -0
- package/lib/alphafold-transparency.js +157 -62
- package/lib/contact.d.ts +7 -14
- package/lib/contact.js +68 -72
- package/lib/custom-events.js +15 -15
- package/lib/domain-annotations/behavior.d.ts +1 -1
- package/lib/domain-annotations/behavior.js +24 -20
- package/lib/domain-annotations/color.js +22 -22
- package/lib/domain-annotations/prop.js +111 -62
- package/lib/drugflow-molstar-component-build-0.4.7.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.7.js.LICENSE.txt +24 -0
- package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.8.js.LICENSE.txt +24 -0
- package/lib/helpers.d.ts +3 -3
- package/lib/helpers.js +94 -89
- package/lib/index.d.ts +902 -1
- package/lib/index.js +2836 -1806
- package/lib/labels.d.ts +1 -1
- package/lib/labels.js +34 -20
- package/lib/loci-details.js +46 -34
- package/lib/sifts-mapping.js +32 -28
- package/lib/sifts-mappings-behaviour.d.ts +1 -1
- package/lib/sifts-mappings-behaviour.js +30 -26
- package/lib/spec.js +40 -52
- package/lib/structure_contact3d.d.ts +14 -21
- package/lib/structure_contact3d.js +46 -25
- package/lib/subscribe-events.js +18 -19
- package/lib/superposition-export.js +178 -102
- package/lib/superposition-focus-representation.d.ts +2 -2
- package/lib/superposition-focus-representation.js +131 -73
- package/lib/superposition-sifts-mapping.js +150 -105
- package/lib/superposition.js +810 -495
- package/lib/ui/alphafold-superposition.d.ts +1 -1
- package/lib/ui/alphafold-superposition.js +118 -94
- package/lib/ui/alphafold-tranparency.js +43 -27
- package/lib/ui/annotation-controls.js +89 -83
- package/lib/ui/export-superposition.d.ts +0 -1
- package/lib/ui/export-superposition.js +50 -32
- package/lib/ui/pdbe-left-panel.d.ts +0 -1
- package/lib/ui/pdbe-left-panel.js +105 -82
- package/lib/ui/pdbe-screenshot-controls.js +83 -54
- package/lib/ui/pdbe-structure-controls.js +57 -34
- package/lib/ui/pdbe-viewport-controls.js +29 -23
- package/lib/ui/segment-tree.js +663 -440
- package/lib/ui/superposition-components.js +312 -208
- package/lib/ui/superposition-viewport.js +18 -11
- package/package.json +3 -3
- package/build/drugflow-molstar-0.4.6.css +0 -1
- package/build/drugflow-molstar-component-0.4.6.js +0 -25
- package/build/drugflow-molstar-plugin-0.4.6.js +0 -2
- package/build/drugflow-molstar-plugin-0.4.6.js.LICENSE.txt +0 -64
|
@@ -1,59 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnnotationsComponentControls =
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
6
|
-
const base_1 = require("Molstar/mol-plugin-ui/base");
|
|
7
|
-
const color_1 = require("Molstar/extensions/pdbe/structure-quality-report/color");
|
|
8
|
-
const mol_state_1 = require("Molstar/mol-state");
|
|
9
|
-
const parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
10
|
-
const color_2 = require("../domain-annotations/color");
|
|
11
|
-
const behavior_1 = require("Molstar/extensions/pdbe/structure-quality-report/behavior");
|
|
12
|
-
const behavior_2 = require("../domain-annotations/behavior");
|
|
13
|
-
const icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
14
|
-
const hierarchy_1 = require("Molstar/mol-plugin-state/manager/structure/hierarchy");
|
|
15
|
-
const _TextsmsOutlined = (0, jsx_runtime_1.jsxs)("svg", { width: '24px', height: '24px', viewBox: '0 0 24 24', children: [(0, jsx_runtime_1.jsx)("path", { fill: "none", d: "M0 0h24v24H0V0z" }), (0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 9h2v2H7zM11 9h2v2h-2zM15 9h2v2h-2z" })] })] });
|
|
16
|
-
function TextsmsOutlinedSvg() { return _TextsmsOutlined; }
|
|
3
|
+
exports.AnnotationsComponentControls = void 0;
|
|
17
4
|
exports.TextsmsOutlinedSvg = TextsmsOutlinedSvg;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
8
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
9
|
+
var color_1 = require("Molstar/extensions/pdbe/structure-quality-report/color");
|
|
10
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
11
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
12
|
+
var color_2 = require("../domain-annotations/color");
|
|
13
|
+
var behavior_1 = require("Molstar/extensions/pdbe/structure-quality-report/behavior");
|
|
14
|
+
var behavior_2 = require("../domain-annotations/behavior");
|
|
15
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
16
|
+
var hierarchy_1 = require("Molstar/mol-plugin-state/manager/structure/hierarchy");
|
|
17
|
+
var _TextsmsOutlined = (0, jsx_runtime_1.jsxs)("svg", { width: '24px', height: '24px', viewBox: '0 0 24 24', children: [(0, jsx_runtime_1.jsx)("path", { fill: "none", d: "M0 0h24v24H0V0z" }), (0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 9h2v2H7zM11 9h2v2h-2zM15 9h2v2h-2z" })] })] });
|
|
18
|
+
function TextsmsOutlinedSvg() { return _TextsmsOutlined; }
|
|
19
|
+
var AnnotationsComponentControls = /** @class */ (function (_super) {
|
|
20
|
+
tslib_1.__extends(AnnotationsComponentControls, _super);
|
|
21
|
+
function AnnotationsComponentControls() {
|
|
22
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
23
|
+
_this.state = {
|
|
22
24
|
isCollapsed: false,
|
|
23
25
|
validationApplied: false,
|
|
24
26
|
domainAtnApplied: false,
|
|
25
27
|
validationOptions: false,
|
|
26
28
|
domainAtnOptions: false
|
|
27
29
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
_this.getOptionParams = function () {
|
|
31
|
+
var validationAnnotationCtrl = false;
|
|
32
|
+
var domainAnnotationCtrl = false;
|
|
33
|
+
var customState = _this.plugin.customState;
|
|
32
34
|
if (customState && customState.initParams) {
|
|
33
35
|
if (customState.initParams.validationAnnotation)
|
|
34
36
|
validationAnnotationCtrl = true;
|
|
35
37
|
if (customState.initParams.domainAnnotation)
|
|
36
38
|
domainAnnotationCtrl = true;
|
|
37
39
|
}
|
|
38
|
-
if ((validationAnnotationCtrl && !
|
|
39
|
-
|
|
40
|
+
if ((validationAnnotationCtrl && !_this.state.validationParams) || (domainAnnotationCtrl && !_this.state.domainAtnParams)) {
|
|
41
|
+
var groupRef = mol_state_1.StateSelection.findTagInSubtree(_this.plugin.state.data.tree, mol_state_1.StateTransform.RootRef, 'structure-component-static-polymer');
|
|
40
42
|
if (groupRef) {
|
|
41
|
-
|
|
43
|
+
var struct = _this.plugin.state.data.select(groupRef)[0].obj;
|
|
42
44
|
if (struct) {
|
|
43
|
-
|
|
44
|
-
if (validationAnnotationCtrl && !
|
|
45
|
-
|
|
45
|
+
var themeDataCtx = { structure: struct.data };
|
|
46
|
+
if (validationAnnotationCtrl && !_this.state.validationParams) {
|
|
47
|
+
var validationActionsParams = color_1.StructureQualityReportColorThemeProvider.getParams(themeDataCtx);
|
|
46
48
|
if (validationActionsParams) {
|
|
47
|
-
|
|
49
|
+
_this.setState({ validationParams: {
|
|
48
50
|
params: validationActionsParams,
|
|
49
51
|
values: { type: validationActionsParams.type.defaultValue }
|
|
50
52
|
} });
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
if (domainAnnotationCtrl && !
|
|
54
|
-
|
|
55
|
+
if (domainAnnotationCtrl && !_this.state.domainAtnParams) {
|
|
56
|
+
var domainActionsParams = color_2.DomainAnnotationsColorThemeProvider.getParams(themeDataCtx);
|
|
55
57
|
if (domainActionsParams) {
|
|
56
|
-
|
|
58
|
+
_this.setState({ domainAtnParams: {
|
|
57
59
|
params: domainActionsParams,
|
|
58
60
|
values: { type: domainActionsParams.type.defaultValue }
|
|
59
61
|
} });
|
|
@@ -63,98 +65,102 @@ class AnnotationsComponentControls extends base_1.PurePluginUIComponent {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
_this.toggleCollapsed = function () {
|
|
69
|
+
_this.setState({ isCollapsed: !_this.state.isCollapsed });
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
_this.toggleOptions = function (type) {
|
|
70
72
|
if (type === 0)
|
|
71
|
-
|
|
73
|
+
_this.setState({ validationOptions: !_this.state.validationOptions });
|
|
72
74
|
if (type === 1)
|
|
73
|
-
|
|
75
|
+
_this.setState({ domainAtnOptions: !_this.state.domainAtnOptions });
|
|
74
76
|
};
|
|
75
|
-
|
|
77
|
+
_this.applyAnnotation = function (type, visibleState, params) {
|
|
76
78
|
// Defaults
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
var themeName = 'polymer-id';
|
|
80
|
+
var themePropsToAdd = behavior_1.PDBeStructureQualityReport;
|
|
81
|
+
var themePropsToRemove = _this.state.domainAtnParams ? behavior_2.PDBeDomainAnnotations : void 0;
|
|
80
82
|
// Set Theme Params
|
|
81
83
|
if (type === 0) {
|
|
82
84
|
if (visibleState) {
|
|
83
85
|
themeName = 'pdbe-structure-quality-report';
|
|
84
86
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
_this.setState({ validationApplied: visibleState });
|
|
88
|
+
_this.setState({ domainAtnApplied: false });
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
themePropsToAdd = behavior_2.PDBeDomainAnnotations;
|
|
90
|
-
themePropsToRemove =
|
|
92
|
+
themePropsToRemove = _this.state.validationParams ? behavior_1.PDBeStructureQualityReport : void 0;
|
|
91
93
|
if (visibleState)
|
|
92
94
|
themeName = 'pdbe-domain-annotations';
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
_this.setState({ domainAtnApplied: visibleState });
|
|
96
|
+
_this.setState({ validationApplied: false });
|
|
95
97
|
}
|
|
96
98
|
// Update Tooltip
|
|
97
99
|
if (visibleState && themeName !== 'polymer-id') {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
var addTooltipUpdate = _this.plugin.state.behaviors.build().to(themePropsToAdd.id).update(themePropsToAdd, function (old) { old.showTooltip = true; });
|
|
101
|
+
_this.plugin.runTask(_this.plugin.state.behaviors.updateTree(addTooltipUpdate));
|
|
100
102
|
if (themePropsToRemove) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
var removeTooltipUpdate = _this.plugin.state.behaviors.build().to(themePropsToRemove.id).update(themePropsToRemove, function (old) { old.showTooltip = false; });
|
|
104
|
+
_this.plugin.runTask(_this.plugin.state.behaviors.updateTree(removeTooltipUpdate));
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
componentGroups.forEach((compGrp)
|
|
107
|
+
var polymerGroup;
|
|
108
|
+
var componentGroups = _this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
109
|
+
componentGroups.forEach(function (compGrp) {
|
|
108
110
|
if (compGrp[0].key === 'structure-component-static-polymer')
|
|
109
111
|
polymerGroup = compGrp;
|
|
110
112
|
});
|
|
111
113
|
if (polymerGroup) {
|
|
112
|
-
|
|
114
|
+
_this.plugin.managers.structure.component.updateRepresentationsTheme(polymerGroup, { color: themeName, colorParams: params ? params : void 0 });
|
|
113
115
|
}
|
|
114
116
|
};
|
|
115
|
-
|
|
117
|
+
_this.initApplyAnnotation = function (type) {
|
|
116
118
|
if (type === 0)
|
|
117
|
-
|
|
119
|
+
_this.applyAnnotation(0, !_this.state.validationApplied, _this.state.validationParams.values);
|
|
118
120
|
if (type === 1)
|
|
119
|
-
|
|
121
|
+
_this.applyAnnotation(1, !_this.state.domainAtnApplied, _this.state.domainAtnParams.values);
|
|
120
122
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
_this.updateValidationParams = function (val) {
|
|
124
|
+
var updatedParams = tslib_1.__assign({}, _this.state.validationParams);
|
|
123
125
|
updatedParams.values = val;
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
|
|
126
|
+
_this.setState({ validationParams: updatedParams });
|
|
127
|
+
if (_this.state.validationApplied)
|
|
128
|
+
_this.applyAnnotation(0, _this.state.validationApplied, val);
|
|
127
129
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
_this.updateDomainAtnParams = function (val) {
|
|
131
|
+
var updatedParams = tslib_1.__assign({}, _this.state.domainAtnParams);
|
|
130
132
|
updatedParams.values = val;
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
|
|
133
|
+
_this.setState({ domainAtnParams: updatedParams });
|
|
134
|
+
if (_this.state.domainAtnApplied)
|
|
135
|
+
_this.applyAnnotation(1, _this.state.domainAtnApplied, val);
|
|
134
136
|
};
|
|
137
|
+
return _this;
|
|
135
138
|
}
|
|
136
|
-
componentDidMount() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
AnnotationsComponentControls.prototype.componentDidMount = function () {
|
|
140
|
+
var _this = this;
|
|
141
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function () {
|
|
142
|
+
_this.getOptionParams();
|
|
143
|
+
_this.forceUpdate();
|
|
140
144
|
});
|
|
141
|
-
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, c
|
|
142
|
-
description: hierarchy_1.StructureHierarchyManager.getSelectedStructuresDescription(
|
|
143
|
-
}));
|
|
144
|
-
}
|
|
145
|
-
render() {
|
|
145
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function (c) { return _this.setState({
|
|
146
|
+
description: hierarchy_1.StructureHierarchyManager.getSelectedStructuresDescription(_this.plugin)
|
|
147
|
+
}); });
|
|
148
|
+
};
|
|
149
|
+
AnnotationsComponentControls.prototype.render = function () {
|
|
150
|
+
var _this = this;
|
|
146
151
|
if (!this.state.validationParams && !this.state.domainAtnParams)
|
|
147
152
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
148
|
-
|
|
153
|
+
var brand = {
|
|
149
154
|
accent: 'green',
|
|
150
155
|
svg: TextsmsOutlinedSvg
|
|
151
156
|
};
|
|
152
|
-
|
|
157
|
+
var wrapClass = this.state.isCollapsed
|
|
153
158
|
? 'msp-transform-wrapper msp-transform-wrapper-collapsed'
|
|
154
159
|
: 'msp-transform-wrapper';
|
|
155
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: wrapClass, children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-transform-header', children: (0, jsx_runtime_1.jsxs)(common_1.Button, { icon: brand ? void 0 : this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, noOverflow: true, onClick: this.toggleCollapsed, className: brand ?
|
|
156
|
-
(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title:
|
|
157
|
-
(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title:
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: wrapClass, children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-transform-header', children: (0, jsx_runtime_1.jsxs)(common_1.Button, { icon: brand ? void 0 : this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, noOverflow: true, onClick: this.toggleCollapsed, className: brand ? "msp-transform-header-brand msp-transform-header-brand-".concat(brand.accent) : void 0, title: "Click to ".concat(this.state.isCollapsed ? 'expand' : 'collapse'), children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { svg: brand === null || brand === void 0 ? void 0 : brand.svg, inline: true }), "Annotations", (0, jsx_runtime_1.jsx)("small", { style: { margin: '0 6px' }, children: this.state.isCollapsed ? '' : this.state.description })] }) }), !this.state.isCollapsed && this.state.validationParams &&
|
|
161
|
+
(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: "Validation Report Annotations.", style: { textAlign: 'left' }, children: "Validation Report" }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.initApplyAnnotation(0); }, toggleState: false, svg: !this.state.validationApplied ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, title: "Click to ".concat(this.state.validationApplied ? 'Hide' : 'Show', " Validation Report Annotation"), small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.toggleOptions(0); }, svg: icons_1.MoreHorizSvg, title: 'Actions', toggleState: this.state.validationOptions, className: 'msp-form-control', flex: true })] }), !this.state.isCollapsed && this.state.validationParams && this.state.validationOptions && (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: '6px' }, children: (0, jsx_runtime_1.jsx)("div", { className: "msp-accent-offset", children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.validationParams.params, values: this.state.validationParams.values, onChangeValues: this.updateValidationParams }) }) }) }), !this.state.isCollapsed && this.state.domainAtnParams &&
|
|
162
|
+
(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: "Domain Annotations.", style: { textAlign: 'left' }, children: "Domains" }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.initApplyAnnotation(1); }, toggleState: false, svg: !this.state.domainAtnApplied ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, title: "Click to ".concat(this.state.domainAtnApplied ? 'Hide' : 'Show', " Domain Annotation"), small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.toggleOptions(1); }, svg: icons_1.MoreHorizSvg, title: 'Actions', toggleState: this.state.domainAtnOptions, className: 'msp-form-control', flex: true })] }), !this.state.isCollapsed && this.state.domainAtnParams && this.state.domainAtnOptions && (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: '6px' }, children: (0, jsx_runtime_1.jsx)("div", { className: "msp-accent-offset", children: (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.domainAtnParams.params, values: this.state.domainAtnParams.values, onChangeValues: this.updateDomainAtnParams }) }) }) })] });
|
|
163
|
+
};
|
|
164
|
+
return AnnotationsComponentControls;
|
|
165
|
+
}(base_1.PurePluginUIComponent));
|
|
160
166
|
exports.AnnotationsComponentControls = AnnotationsComponentControls;
|
|
@@ -1,53 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SuperpositionModelExportUI = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
8
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
9
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
10
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
11
|
+
var use_behavior_1 = require("Molstar/mol-plugin-ui/hooks/use-behavior");
|
|
12
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
13
|
+
var superposition_export_1 = require("../superposition-export");
|
|
14
|
+
var SuperpositionModelExportUI = /** @class */ (function (_super) {
|
|
15
|
+
tslib_1.__extends(SuperpositionModelExportUI, _super);
|
|
16
|
+
function SuperpositionModelExportUI() {
|
|
17
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18
|
+
}
|
|
19
|
+
SuperpositionModelExportUI.prototype.defaultState = function () {
|
|
15
20
|
return {
|
|
16
21
|
header: 'Export Models',
|
|
17
22
|
isCollapsed: true,
|
|
18
23
|
brand: { accent: 'cyan', svg: icons_1.GetAppSvg }
|
|
19
24
|
};
|
|
20
|
-
}
|
|
21
|
-
renderControls() {
|
|
25
|
+
};
|
|
26
|
+
SuperpositionModelExportUI.prototype.renderControls = function () {
|
|
22
27
|
return (0, jsx_runtime_1.jsx)(SuperpositionExportControls, { plugin: this.plugin });
|
|
23
|
-
}
|
|
24
|
-
|
|
28
|
+
};
|
|
29
|
+
return SuperpositionModelExportUI;
|
|
30
|
+
}(base_1.CollapsableControls));
|
|
25
31
|
exports.SuperpositionModelExportUI = SuperpositionModelExportUI;
|
|
26
|
-
|
|
32
|
+
var Params = {
|
|
27
33
|
format: param_definition_1.ParamDefinition.Select('cif', [['cif', 'mmCIF'], ['bcif', 'Binary mmCIF']])
|
|
28
34
|
};
|
|
29
|
-
|
|
30
|
-
function SuperpositionExportControls(
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
var DefaultParams = param_definition_1.ParamDefinition.getDefaultValues(Params);
|
|
36
|
+
function SuperpositionExportControls(_a) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
var plugin = _a.plugin;
|
|
39
|
+
var _b = tslib_1.__read((0, react_1.useState)(DefaultParams), 2), params = _b[0], setParams = _b[1];
|
|
40
|
+
var _c = tslib_1.__read((0, react_1.useState)(false), 2), exporting = _c[0], setExporting = _c[1];
|
|
33
41
|
(0, use_behavior_1.useBehavior)(plugin.managers.structure.hierarchy.behaviors.selection); // triggers UI update
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
var isBusy = (0, use_behavior_1.useBehavior)(plugin.behaviors.state.isBusy);
|
|
43
|
+
var hierarchy = plugin.managers.structure.hierarchy.current;
|
|
44
|
+
var label = 'Nothing to Export';
|
|
37
45
|
if (hierarchy.structures.length === 1) {
|
|
38
46
|
label = 'Export';
|
|
39
47
|
}
|
|
40
48
|
if (hierarchy.structures.length > 1) {
|
|
41
49
|
label = 'Export (as ZIP)';
|
|
42
50
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
var onExport = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
return tslib_1.__generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
setExporting(true);
|
|
56
|
+
_a.label = 1;
|
|
57
|
+
case 1:
|
|
58
|
+
_a.trys.push([1, , 3, 4]);
|
|
59
|
+
return [4 /*yield*/, (0, superposition_export_1.superpositionExportHierarchy)(plugin, { format: params.format })];
|
|
60
|
+
case 2:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [3 /*break*/, 4];
|
|
63
|
+
case 3:
|
|
64
|
+
setExporting(false);
|
|
65
|
+
return [7 /*endfinally*/];
|
|
66
|
+
case 4: return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); };
|
|
52
70
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: Params, values: params, onChangeValues: setParams, isDisabled: isBusy || exporting }), (0, jsx_runtime_1.jsx)(common_1.Button, { onClick: onExport, style: { marginTop: 1 }, disabled: isBusy || hierarchy.structures.length === 0 || exporting, commit: hierarchy.structures.length ? 'on' : 'off', children: label })] });
|
|
53
71
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { PluginUIComponent } from 'Molstar/mol-plugin-ui/base';
|
|
3
2
|
export declare function WavesIconSvg(): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
type LeftPanelTabName = 'none' | 'root' | 'data' | 'states' | 'settings' | 'help' | 'segments';
|