Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 zft or zoom_to_fid parameter url on editable layer #686

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,5 @@ g3wsdk.gui.GUI.once('ready', () => {
});
});

window.GUI = g3wsdk.gui.GUI,
window.GUI = g3wsdk.gui.GUI;
window.localforage = localforage;
7 changes: 4 additions & 3 deletions src/map/layers/tablelayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,17 @@ export class TableLayer extends Layer {

await waitFor(() => window.g3wsdk.core.hasOwnProperty('editing'), TIMEOUT); // wait until "editing" plugin is loaded
// add editing configurations
this.config.editing = {

this.config.editing = {
fields: vector.fields || [],
format: vector.format,
constraints,
capabilities: capabilities || window.g3wsdk.constant.DEFAULT_EDITING_CAPABILITIES, // default editing capabilities
form: { perc: null }, // set editing form `perc` to null at beginning
style: vector.style, // get vector layer style
geometrytype: vector.geometrytype, // whether is a vector layer,
visible: (vector.editing || { visible: true }).visible, //@since 3.11.0 let know if layer should be editable directly (true) or through relation layer (false)
}
visible: (vector.editing || { visible: true }).visible, //@since 3.11.0 let know if layer should be editable directly (true) or through relation layer (false)
};

if (vector.style) { // set vector layer color
this.setColor(vector.style.color);
Expand Down
4 changes: 2 additions & 2 deletions src/services/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,15 @@ export default new (class GUI extends G3WObject {
});
}

const show = !stop && 'function' === typeof output.condition ? output.condition(data) : false !== output.condition;
const show = !stop && 'function' === typeof output.condition ? await output.condition(data) : false !== output.condition;

// check if data can be shown on query result content
if (!stop && show) {
(this.getService('queryresults') || this.showQueryResults(output.title || '')).setQueryResponse(data, { add: output.add });
}

if (!stop && !show) {
this.pending_output = this.closeContent.bind(this);
this.pending_output = await this.closeContent();
}

// call after is set with data
Expand Down
20 changes: 16 additions & 4 deletions src/services/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { groupBy } from 'utils/groupBy';
import { getProject } from 'utils/getProject';
import { getCatalogLayerById } from 'utils/getCatalogLayerById';
import { getCatalogLayers } from 'utils/getCatalogLayers';
import { waitFor } from 'utils/waitFor';

import { VectorLayer } from 'map/layers/vectorlayer';

Expand Down Expand Up @@ -1067,16 +1068,21 @@ class MapService extends G3WObject {
return;
}

const layer = this.project.getLayerById(layerId);

const { data = [] } = await DataRouterService.getData('search:fids', {
inputs: {
layer: this.project.getLayerById(layerId),
layer,
fids: [fid]
},
outputs: {
show: {
loading: false,
condition({ data = [] } = {}) {
return data[0] && data[0].features.length > 0;
async condition({ data = [] } = {}) {
if (layer.isEditable()) {
await waitFor(() => undefined !== layer.config.editing);
}
return !!(data[0] && data[0].features.length > 0);
}
}
}
Expand Down Expand Up @@ -1118,7 +1124,13 @@ class MapService extends G3WObject {
},
outputs: {
show: {
loading: false
loading: false,
async condition({ data = [] } = {}) {
if (layer.isEditable()) {
await waitFor(() => undefined !== layer.config.editing);
}
return !!(data[0] && data[0].features.length > 0);
}
}
}
});
Expand Down
Loading