@jupytergis/base 0.13.2 → 0.13.3

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.
@@ -361,15 +361,12 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
361
361
  /**
362
362
  * LAYERS and LAYER GROUP actions.
363
363
  */
364
- commands.addCommand(CommandIDs.renameSelected, {
365
- label: trans.__('Rename'),
366
- isEnabled: () => {
364
+ commands.addCommand(CommandIDs.renameSelected, Object.assign({ label: trans.__('Rename'), isEnabled: () => {
367
365
  var _a, _b, _c;
368
366
  const model = (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model;
369
367
  const selected = (_c = (_b = model === null || model === void 0 ? void 0 : model.localState) === null || _b === void 0 ? void 0 : _b.selected) === null || _c === void 0 ? void 0 : _c.value;
370
368
  return !!selected && Object.keys(selected).length === 1;
371
- },
372
- execute: async () => {
369
+ }, execute: async () => {
373
370
  var _a, _b, _c;
374
371
  const model = (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model;
375
372
  const selected = (_c = (_b = model === null || model === void 0 ? void 0 : model.localState) === null || _b === void 0 ? void 0 : _b.selected) === null || _c === void 0 ? void 0 : _c.value;
@@ -377,17 +374,13 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
377
374
  return;
378
375
  }
379
376
  await Private.renameSelectedItem(model);
380
- },
381
- });
382
- commands.addCommand(CommandIDs.removeSelected, {
383
- label: trans.__('Remove'),
384
- isEnabled: () => {
377
+ } }, icons.get(CommandIDs.renameSelected)));
378
+ commands.addCommand(CommandIDs.removeSelected, Object.assign({ label: trans.__('Remove'), isEnabled: () => {
385
379
  var _a, _b, _c;
386
380
  const model = (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model;
387
381
  const selected = (_c = (_b = model === null || model === void 0 ? void 0 : model.localState) === null || _b === void 0 ? void 0 : _b.selected) === null || _c === void 0 ? void 0 : _c.value;
388
382
  return !!selected && Object.keys(selected).length > 0;
389
- },
390
- execute: async () => {
383
+ }, execute: async () => {
391
384
  var _a, _b, _c;
392
385
  const model = (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model;
393
386
  const selected = (_c = (_b = model === null || model === void 0 ? void 0 : model.localState) === null || _b === void 0 ? void 0 : _b.selected) === null || _c === void 0 ? void 0 : _c.value;
@@ -395,8 +388,7 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
395
388
  return;
396
389
  }
397
390
  await Private.removeSelectedItems(model);
398
- },
399
- });
391
+ } }, icons.get(CommandIDs.removeSelected)));
400
392
  commands.addCommand(CommandIDs.moveLayersToGroup, {
401
393
  label: args => args['label'] ? args['label'] : trans.__('Move to Root'),
402
394
  execute: args => {
package/lib/constants.js CHANGED
@@ -39,6 +39,8 @@ const iconObject = {
39
39
  [CommandIDs.toggleStoryPresentationMode]: {
40
40
  iconClass: 'fa fa-book jgis-icon-adjust',
41
41
  },
42
+ [CommandIDs.renameSelected]: { iconClass: 'fa fa-pen' },
43
+ [CommandIDs.removeSelected]: { iconClass: 'fa fa-trash' },
42
44
  };
43
45
  /**
44
46
  * The registered icons
@@ -663,7 +663,7 @@ export class MainView extends React.Component {
663
663
  displayTemporalController: false,
664
664
  filterStates: {},
665
665
  jgisSettings: this._model.jgisSettings,
666
- isSpectaPresentation: false,
666
+ isSpectaPresentation: this._model.isSpectaMode(),
667
667
  };
668
668
  this._sources = [];
669
669
  this._loadingLayers = new Set();
package/lib/widget.js CHANGED
@@ -70,10 +70,13 @@ export class JupyterGISPanel extends SplitPanel {
70
70
  super({ orientation: 'vertical', spacing: 0 });
71
71
  this._consoleOpened = false;
72
72
  this._state = state;
73
- this._initModel({ model, commandRegistry });
74
- this._initView(formSchemaRegistry, annotationModel);
75
73
  this._consoleOption = Object.assign({ commandRegistry }, consoleOption);
76
74
  this._consoleTracker = consoleTracker;
75
+ const readyPromise = model.sharedModel.initialSyncReady;
76
+ readyPromise.then(() => {
77
+ this._initModel({ model, commandRegistry });
78
+ this._initView(formSchemaRegistry, annotationModel);
79
+ });
77
80
  }
78
81
  _initModel(options) {
79
82
  this._view = new ObservableMap();
@@ -94,9 +97,15 @@ export class JupyterGISPanel extends SplitPanel {
94
97
  SplitPanel.setStretch(this._jupyterGISMainViewPanel, 1);
95
98
  }
96
99
  get jupyterGISMainViewPanel() {
100
+ if (!this._jupyterGISMainViewPanel) {
101
+ console.warn('JupyterGISPanel not ready (initialSyncReady not resolved)');
102
+ }
97
103
  return this._jupyterGISMainViewPanel;
98
104
  }
99
105
  get viewChanged() {
106
+ if (!this._view) {
107
+ console.warn('JupyterGISPanel not ready (initialSyncReady not resolved)');
108
+ }
100
109
  return this._view.changed;
101
110
  }
102
111
  /**
@@ -114,6 +123,9 @@ export class JupyterGISPanel extends SplitPanel {
114
123
  super.dispose();
115
124
  }
116
125
  get currentViewModel() {
126
+ if (!this._mainViewModel) {
127
+ console.warn('JupyterGISPanel not ready (initialSyncReady not resolved)');
128
+ }
117
129
  return this._mainViewModel;
118
130
  }
119
131
  get consolePanel() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/base",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "A JupyterLab extension for 3D modelling.",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -44,7 +44,7 @@
44
44
  "@jupyter/collaboration": "^4",
45
45
  "@jupyter/react-components": "^0.16.6",
46
46
  "@jupyter/ydoc": "^2.0.0 || ^3.0.0",
47
- "@jupytergis/schema": "^0.13.2",
47
+ "@jupytergis/schema": "^0.13.3",
48
48
  "@jupyterlab/application": "^4.3.0",
49
49
  "@jupyterlab/apputils": "^4.3.0",
50
50
  "@jupyterlab/completer": "^4.3.0",