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

Refactor G3WObject, Panel and Component classes #574

Merged
merged 400 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
400 commits
Select commit Hold shift + click to select a range
436cb3e
remove `g3wsdk.vue.services.SearchPanel`
Raruto Mar 11, 2024
a74f0aa
missing `state` and `debounces`
Raruto Mar 11, 2024
3d81bca
convert to classes: `Plugin` and `PluginService`
Raruto Mar 11, 2024
b1622df
wrong variable name
Raruto Mar 11, 2024
dd092a1
field wrong variable name. Use input instead
volterra79 Mar 11, 2024
e21666a
Create utils methods from extrach from searchservice.js
volterra79 Mar 11, 2024
6e411cd
Move FETCH Object on top
volterra79 Mar 12, 2024
393a7d7
In case of already print page open, when we request a new print page,…
volterra79 Mar 12, 2024
411cb5f
stop loading afet mounted internal component
volterra79 Mar 12, 2024
6b9997c
fix state service.state
volterra79 Mar 12, 2024
0f4d89e
failsafe `has_maps`
Raruto Mar 12, 2024
6cd94c3
clean code
volterra79 Mar 12, 2024
3067468
Fix refactor
volterra79 Mar 13, 2024
e5b3c13
substitue stis.$options.service state with this.state
volterra79 Mar 13, 2024
6157b73
explicit debounce
Raruto Mar 14, 2024
05d39e5
spacing
Raruto Mar 14, 2024
456c0e4
Move createInputsFormFromFilter ouside g3w-search.js. Use on SearchPa…
volterra79 Mar 14, 2024
a8e3279
Revert "Move createInputsFormFromFilter ouside g3w-search.js. Use on …
volterra79 Mar 14, 2024
6530029
Clean code
volterra79 Mar 14, 2024
dfa9f2a
change to Promise.resolve()
volterra79 Mar 14, 2024
d3cce4c
clean code
volterra79 Mar 14, 2024
b2579e6
Fix autocomplete select XHR call
volterra79 Mar 14, 2024
ecf323f
Add init service
volterra79 Mar 14, 2024
33cb701
Set string autocomplete value
volterra79 Mar 14, 2024
7d8ca6b
remove return.
volterra79 Mar 14, 2024
56f98e0
fix no_autocomplete select inputs
volterra79 Mar 14, 2024
593a46d
clean code
volterra79 Mar 15, 2024
5c5e0ce
Extract get data function from createInputsFormFromFilter. Each utils…
volterra79 Mar 15, 2024
9b58e66
clean code
volterra79 Mar 15, 2024
fd2a9e9
remove getDataForSearchInput as utils method and move it as method of…
volterra79 Mar 15, 2024
f518919
Merge branch 'dev' into refactor-panels-and-components
volterra79 Mar 18, 2024
eda8775
avoid `Promise.resolve().then(async`
Raruto Mar 18, 2024
a936dfe
Merge branch 'refactor-panels-and-components' of https://github.com/g…
Raruto Mar 18, 2024
73fb039
remove nested `try..catch`
Raruto Mar 18, 2024
930904b
shorten aliases
Raruto Mar 18, 2024
f8740ba
restore async for loop
Raruto Mar 18, 2024
7947c66
chained conditions
Raruto Mar 18, 2024
b893d1c
unshift
Raruto Mar 18, 2024
27068e6
YAGNI
Raruto Mar 18, 2024
915f403
less is more..
Raruto Mar 18, 2024
60ff70c
let
Raruto Mar 18, 2024
ab699e8
delete `createFieldsDependenciesAutocompleteParameter`
Raruto Mar 18, 2024
7b5d346
simplify: `getDataForSearchInput` and `_getUniqueValuesFromField`
Raruto Mar 19, 2024
739f933
Show print sidebar component only if the project has print layout set
volterra79 Mar 19, 2024
756306d
extract `getDataForSearchInput`
Raruto Mar 19, 2024
1c9cec6
`has_error` and `chained_select`
Raruto Mar 19, 2024
9388ec9
`value_relation` and `relation_reference`
Raruto Mar 19, 2024
f612442
remove some useful conditions
Raruto Mar 19, 2024
ff70369
fix value map input
Raruto Mar 19, 2024
46470f5
useful condition
Raruto Mar 19, 2024
9980ef6
move `fillDependencyInputs` into `changeInput`
Raruto Mar 19, 2024
1d7cf6b
slim down `createSingleFieldParameter`
Raruto Mar 19, 2024
09d7ff4
edit in admin shortcut
Raruto Mar 19, 2024
3ec0d6c
superflous param
Raruto Mar 20, 2024
1e95656
yoda
Raruto Mar 20, 2024
6eb0b95
pre-populate forminputs
Raruto Mar 20, 2024
cf69316
guard conditions
Raruto Mar 20, 2024
052a776
slim down helpers
Raruto Mar 20, 2024
74c147b
remove `input.widget`
Raruto Mar 20, 2024
93db858
static `operators`
Raruto Mar 20, 2024
8d6e866
mounted workaround
Raruto Mar 20, 2024
7a69564
convert to class: `Filter` and `Expression`
Raruto Mar 20, 2024
f081e14
delete function `changeNumericInput`
Raruto Mar 20, 2024
8a3d5ed
move `forminputs` into `SearchPanel`
Raruto Mar 21, 2024
e235a17
wrong variable name
Raruto Mar 21, 2024
91cea65
duplicated import
Raruto Mar 21, 2024
9665c55
fix chained select
Raruto Mar 21, 2024
f451b39
console.info
Raruto Mar 21, 2024
d0dd98e
prevent initial http request on chained select
Raruto Mar 21, 2024
11203e7
remove `has_error`
Raruto Mar 21, 2024
75cc818
Update toRawType.js
Raruto Mar 21, 2024
b182b75
remove `state.input.dependance`
Raruto Mar 21, 2024
d1f0ef3
remove `state.input.dependencies`
Raruto Mar 21, 2024
73a20bb
shorten alias
Raruto Mar 21, 2024
b993d32
wrong deps
Raruto Mar 21, 2024
1e6647d
remove cached `_currentValue`
Raruto Mar 21, 2024
5184184
`dep_value` → `dvalue`
Raruto Mar 21, 2024
f398c97
extract forminput
Raruto Mar 21, 2024
dbe99ba
`dvalue` → `parent.value`
Raruto Mar 21, 2024
6aee995
`is_root` → `!forminput.dependance`
Raruto Mar 21, 2024
ff7fb11
remove `state.cached_deps`
Raruto Mar 21, 2024
8ba7682
remove `chained_select`
Raruto Mar 21, 2024
ebb2dab
remove `state.filter`
Raruto Mar 21, 2024
6efcd53
deprecation notice
Raruto Mar 21, 2024
1326845
spacing
Raruto Mar 21, 2024
03d9239
attempt to replace: `getFilterData` → `getDataForSearchInput`
Raruto Mar 21, 2024
a09b199
slim down `doSearch`
Raruto Mar 21, 2024
32888ad
remove `input.options`
Raruto Mar 21, 2024
06e665d
get real input from: `select2:select`
Raruto Mar 21, 2024
5906faa
`forminput` → `input`
Raruto Mar 21, 2024
961093f
attempt to fix `createSingleFieldParameter`
Raruto Mar 21, 2024
155fc6d
missing param `field`
Raruto Mar 21, 2024
c973477
extract `_createFieldsDeps`
Raruto Mar 21, 2024
6531988
console.log
Raruto Mar 21, 2024
5bbe9ca
fix `valuerelation`
Raruto Mar 21, 2024
51f19a4
debug info
Raruto Mar 22, 2024
48ec24d
console.assert
Raruto Mar 22, 2024
c08802c
add some debug info for super user
Raruto Mar 22, 2024
605d4e7
reduce font-weight
Raruto Mar 22, 2024
f6f2d78
Fix duplicate value declaration
volterra79 Mar 22, 2024
df1c7e4
restore `TableSelectRow.vue`
Raruto Mar 22, 2024
f0a081a
Merge branch 'refactor-panels-and-components' of https://github.com/g…
Raruto Mar 22, 2024
37fc62a
refactor `DataRouterService.getData('search:features'`
Raruto Mar 25, 2024
22039bc
make use of `fformatter` also for `ValueRelation`?
Raruto Mar 25, 2024
659fc8b
unusued imports
Raruto Mar 25, 2024
692533e
fix datetime widget
Raruto Mar 25, 2024
0c114cd
comments
Raruto Mar 25, 2024
519925b
strict check
Raruto Mar 25, 2024
c0d09e5
comments
Raruto Mar 25, 2024
96258b0
blank space
Raruto Mar 26, 2024
885d066
move helper utils
Raruto Mar 26, 2024
4b15c59
inline splice
Raruto Mar 27, 2024
9209bde
avoid multiple skip conditions within `changeInput`
Raruto Mar 27, 2024
94c9156
`is_autocomplete` → `has_autocomplete`
Raruto Mar 27, 2024
caa9f83
spacing
Raruto Mar 27, 2024
080da55
attempt to use a single assigment for `vals`
Raruto Mar 27, 2024
ce2720c
fallback disalbed to false
Raruto Mar 27, 2024
29e88ee
Merge branch 'dev' into refactor-panels-and-components
volterra79 Mar 28, 2024
4585d60
clean code
volterra79 Mar 28, 2024
8edf5ef
clean code
volterra79 Mar 28, 2024
0ed96a4
clear code
volterra79 Mar 28, 2024
1956422
clear code
volterra79 Mar 28, 2024
e0a493d
clear code
volterra79 Mar 28, 2024
436836d
clear code
volterra79 Mar 28, 2024
9c5d894
clear code
volterra79 Mar 28, 2024
2f2cdba
clear code
volterra79 Mar 28, 2024
ae7606e
clear code
volterra79 Mar 28, 2024
c0a1945
clear code
volterra79 Mar 28, 2024
3d395cb
clean code
volterra79 Mar 28, 2024
76795e8
clean code
volterra79 Mar 28, 2024
f476588
clean code
volterra79 Mar 28, 2024
f819534
clean code
volterra79 Mar 28, 2024
5a09067
clean code
volterra79 Mar 28, 2024
c689f02
clean code
volterra79 Mar 28, 2024
81dd54c
clean code
volterra79 Mar 28, 2024
3c1d8fd
clean code
volterra79 Mar 28, 2024
881d724
clean code
volterra79 Mar 28, 2024
40bba3c
clean code
volterra79 Mar 28, 2024
89c01dc
clean code
volterra79 Mar 28, 2024
6f3942d
clean code
volterra79 Mar 28, 2024
fb3b609
clean code
volterra79 Mar 28, 2024
d2dbe8a
clean code
volterra79 Mar 28, 2024
62b8541
clean code
volterra79 Mar 28, 2024
be10de5
clean code
volterra79 Mar 28, 2024
df1652e
clean code
volterra79 Mar 28, 2024
2a9362e
clean code
volterra79 Mar 28, 2024
f887e51
clean code
volterra79 Mar 28, 2024
e9e9ce4
clean code
volterra79 Mar 28, 2024
3718277
clean code
volterra79 Mar 29, 2024
506aff2
clean code
volterra79 Mar 29, 2024
743aa15
clean code
volterra79 Mar 29, 2024
17b75c4
clean code
volterra79 Mar 29, 2024
35e5d1a
clean code
volterra79 Mar 29, 2024
595933a
clean code
volterra79 Mar 29, 2024
5ae36c1
clean code
volterra79 Mar 29, 2024
09f7c05
clean code
volterra79 Mar 29, 2024
dd4c2dc
clean code
volterra79 Mar 29, 2024
d4592ab
clean code
volterra79 Mar 29, 2024
f44e58b
clean code
volterra79 Mar 29, 2024
af13ea0
clean code
volterra79 Mar 29, 2024
0357ce8
clean code
volterra79 Mar 29, 2024
8988cb8
clean code
volterra79 Mar 29, 2024
6c3b3a8
clean code
volterra79 Mar 29, 2024
113ab6a
clean code
volterra79 Mar 29, 2024
c0bbea5
clean code
volterra79 Mar 29, 2024
069acbc
clean code
volterra79 Mar 29, 2024
ad2ece7
clean code
volterra79 Mar 29, 2024
531b7c1
clean code
volterra79 Mar 29, 2024
62a8b2e
clean code
volterra79 Mar 29, 2024
95f9c03
clean code
volterra79 Mar 29, 2024
6d27dbb
clean code
volterra79 Mar 29, 2024
d150427
clean code
volterra79 Mar 29, 2024
fee7386
clean code
volterra79 Mar 29, 2024
25ea7a8
clean code
volterra79 Mar 29, 2024
28cb290
clean code
volterra79 Mar 29, 2024
0e78a30
clean code
volterra79 Mar 29, 2024
6a402aa
clean code
volterra79 Mar 29, 2024
cace75d
clean code
volterra79 Mar 29, 2024
f8bce5c
clean code
volterra79 Mar 29, 2024
414e44f
clean code
volterra79 Mar 29, 2024
f307c70
clean code
volterra79 Mar 29, 2024
8ce8187
clean code
volterra79 Mar 29, 2024
d22c452
clean code
volterra79 Mar 29, 2024
1607893
clean code
volterra79 Mar 29, 2024
6bd4028
clean code
volterra79 Mar 29, 2024
65aec36
clean code
volterra79 Mar 29, 2024
525efdc
clean code
volterra79 Mar 29, 2024
9015ff7
clean code
volterra79 Mar 29, 2024
403eb88
clean code
volterra79 Mar 29, 2024
28122b0
clean code
volterra79 Mar 29, 2024
f6bc45a
clean code
volterra79 Mar 29, 2024
1ede067
clean code
volterra79 Mar 29, 2024
58ea9cf
clean code
volterra79 Mar 29, 2024
f1d5f6c
clean code
volterra79 Mar 29, 2024
7e9dc56
clean code
volterra79 Mar 29, 2024
1f5c6ae
clean code
volterra79 Mar 29, 2024
d293642
clean code
volterra79 Mar 29, 2024
409e97d
clean code
volterra79 Mar 29, 2024
4a44c4a
clean code
volterra79 Mar 29, 2024
1131588
clean code
volterra79 Mar 29, 2024
718ee02
clean code
volterra79 Mar 29, 2024
0c55681
clean code
volterra79 Mar 29, 2024
12fef31
clean code
volterra79 Mar 29, 2024
2111a63
clean code
volterra79 Mar 29, 2024
7f05563
clean code
volterra79 Mar 29, 2024
df978cd
clean code
volterra79 Mar 29, 2024
9fb9059
clean code
volterra79 Mar 29, 2024
1a5aed3
clean code
volterra79 Mar 29, 2024
c8f16e9
clean code
volterra79 Mar 29, 2024
cd2f738
prevent initial http request (autocomplete)
Raruto Apr 4, 2024
8793268
move condition
Raruto Apr 4, 2024
b83cdad
avoid multipl for loops → `deps.forEach`
Raruto Apr 4, 2024
f69a047
shorten `getDataForSearchInput`
Raruto Apr 5, 2024
f797285
single assignment to `input.values` within `createInputsFormFromFilter`
Raruto Apr 5, 2024
b84ca03
decrease nesting: `doSearch`
Raruto Apr 8, 2024
032e486
`showCustomOutputDataPromise` → `showEmptyOutputs`
Raruto Apr 8, 2024
9853e49
superfluous condition: `search_1n`
Raruto Apr 8, 2024
2d6d0bc
clean code
volterra79 Apr 8, 2024
434b5ab
clean code
volterra79 Apr 8, 2024
3e23c19
hotfix `numberfield`
Raruto Apr 8, 2024
02bc4bd
remove dead code within: `createFilterFormInputs`
Raruto Apr 8, 2024
0d8ea33
refactor function: `doSearch` (single and multi field relations)
Raruto Apr 8, 2024
fb9041e
Merge branch 'refactor-panels-and-components' of https://github.com/g…
Raruto Apr 8, 2024
93575df
comments
Raruto Apr 8, 2024
0fef150
console.log
Raruto Apr 8, 2024
6892187
remove `search_by_return`
Raruto Apr 8, 2024
ab13790
unusued import
Raruto Apr 8, 2024
a0b02c3
spacing
Raruto Apr 8, 2024
28435f2
sorted `<option>`
Raruto Apr 8, 2024
ea6e5ac
deprecate `search_endpoint = 'ows'`
Raruto Apr 9, 2024
03a1790
clean code
volterra79 Apr 10, 2024
169a795
hotfix for autocomplete + `RelationReference`
Raruto Apr 11, 2024
b9d9da6
Fix global range change of props value from parent component
volterra79 Apr 11, 2024
c54825f
sort searches by name
Raruto Apr 11, 2024
114f9f5
localeCompare
Raruto Apr 11, 2024
00cee8f
hotfix: `selectfield` that depends on `autompletefield`
Raruto Apr 12, 2024
76dc1a1
Remove unused uniqueId method
volterra79 Apr 12, 2024
3bb131b
Merge branch 'refactor-panels-and-components' of https://github.com/g…
volterra79 Apr 12, 2024
1f3a8d9
show input description below field
Raruto Apr 12, 2024
8f1001e
Merge branch 'refactor-panels-and-components' of https://github.com/g…
Raruto Apr 12, 2024
1eaf0a7
Merge branch 'dev' into refactor-panels-and-components
volterra79 Apr 12, 2024
e108bcd
wrong name: `querybuildersearch` → `search`
Raruto Apr 15, 2024
bfa9cdb
Merge branch 'dev' into refactor-panels-and-components
Raruto Apr 15, 2024
f99134b
hotfix for: automplete + `RelationReference`
Raruto Apr 17, 2024
165dcae
code format
Raruto Apr 17, 2024
0f6dff1
missing async
Raruto Apr 17, 2024
9618ec2
Merge branch 'dev' into refactor-panels-and-components
Raruto Apr 18, 2024
397fda5
takes care of: https://github.com/g3w-suite/g3w-client/pull/574#discu…
Raruto Apr 19, 2024
7220c03
console.log
Raruto Apr 19, 2024
efe9074
refs instead of label
Raruto Apr 19, 2024
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: 0 additions & 2 deletions src/app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ const FormComponent = require('gui/form/vue/form');
const FormService = require('gui/form/formservice');
const InputsComponents = require('gui/inputs/inputs');
const Fields = require('gui/fields/fields');
const SearchPanelService = require('gui/search/vue/panel/searchservice');

/**
* G3W-OL modules
Expand Down Expand Up @@ -376,7 +375,6 @@ const g3wsdk = {
Fields,
Mixins,
services: {
SearchPanel: SearchPanelService,
FormService
}
}
Expand Down
56 changes: 0 additions & 56 deletions src/app/core/data/service.js

This file was deleted.

162 changes: 162 additions & 0 deletions src/app/core/g3w-barstack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/**
* @file
* @since 3.10.0
*/

import Panel from 'core/g3w-panel';
import Component from 'core/g3w-component';
import G3WObject from 'core/g3wobject';

/**
* Barstack Class - used to mount panels stack on top of each parent
*
* ORIGINAL SOURCE src/app/gui/utils/[email protected]
*
*/
export class BarStack extends G3WObject {

constructor() {

super();

/** identify the DOM element where insert the component/panel */
this._parent = null;

/** barstack state. It stores the panel array */
this.state = {
contentsdata: [] // Array<{ content, options }>
}

}

/**
* push componenet on top of parent
*/
push(content, options={}) {
this._parent = options.parent;
return this._mount(content, options);
}

/**
* remove the last component from stack
*/
pop() {
const d = $.Deferred();
const data = this.state.contentsdata;
if (data.length) {
this._unmount(data.slice(-1)[0].content).then(() => { d.resolve(data.pop()) });
} else {
d.resolve();
}
return d.promise();
}

/**
* clear all stacks
*/
clear() {
const d = $.Deferred();
const data = this.state.contentsdata;
if (data.length) {
$
.when(data.map(d => this._unmount(d.content)))
.then(() => { data.splice(0, data.length); d.resolve(); });
} else {
d.resolve();
}
this.emit('clear');
return d.promise();
}

getContentData() {
return this.state.contentsdata;
}

getCurrentContentData() {
return this.state.contentsdata[this.state.contentsdata.length - 1];
}

getPreviousContentData() {
return this.state.contentsdata[this.state.contentsdata.length - 2];
}

/**
* Mount component to parent
*/
_mount(content, options) {
const d = $.Deferred();
const data = this.state.contentsdata;

// check the type of content:

// String or JQuery
if (content instanceof jQuery || _.isString(content)) {
let el = _.isString(content) ? ($(content).length ? $('<div>' + content + '</div>') : $(content)) : content
$(this._parent).append(el);
data.push({ content: el, options });
console.warn('[G3W-CLIENT] jQuery components will be discontinued, please update your code as soon as possible', data[data.length - 1]);
d.resolve();
}

// Vue element
else if (content.mount && 'function' === typeof content.mount) {
// Check duplicate element by component id (if already exist)
let id = data.findIndex(d => d.content.getId && (d.content.getId() === content.getId()));
if (-1 !== id) {
data[id].content.unmount().then(() => data.splice(id, 1));
}
// Mount vue component
content
.mount(this._parent, options.append || false)
.then(() => {
$(this._parent).localize();
data.push({ content, options });
d.resolve(content);
});

}

// DOM element
else {
this._parent.appendChild(content);
data.push({ content, options });
d.resolve();
}

return d.promise();

}

/**
* unmount component
*/
_unmount(content) {
const d = $.Deferred();
if (content instanceof Component || content instanceof Panel) {
content.unmount().then(() => d.resolve());
} else {
$(this._parent).empty();
d.resolve();
}
return d.promise();
}

forEach(cbk) {
this.state.contentsdata.forEach(d => cbk(d.content));
}

/**
* @returns number of elements stored in stack
*/
getLength() {
return this.state.contentsdata.length;
}

/**
* @since 3.10.0
*/
getComponentById(id) {
return (this.getContentData().find(d => d.content.id == id) || {}).content;
}

}
Loading