-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support `ListObject` * chore: add listbox fixture * refactor: refactor * refactor: refactor * refactor: update error message Co-authored-by: Christoffer Åström <stoffeastrom@gmail.com> Co-authored-by: Tobias Åström <tsm@qlik.com>
- Loading branch information
1 parent
c7529f5
commit c0daa04
Showing
13 changed files
with
283 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ describe('hc-handler', () => { | |
}; | ||
|
||
h = handler({ | ||
hc, | ||
dc: hc, | ||
def, | ||
properties: 'props', | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* eslint no-param-reassign:0 */ | ||
|
||
import uid from './uid'; | ||
|
||
const nxDimension = (f) => ({ | ||
qDef: { | ||
qFieldDefs: [f], | ||
}, | ||
}); | ||
|
||
export default function loHandler({ dc: lo, def, properties }) { | ||
lo.qInitialDataFetch = lo.qInitialDataFetch || []; | ||
|
||
const objectProperties = properties; | ||
|
||
const handler = { | ||
dimensions() { | ||
if (!lo.qDef || !lo.qDef.qFieldDefs || lo.qDef.qFieldDefs.length === 0) return []; | ||
return [lo]; | ||
}, | ||
measures() { | ||
return []; | ||
}, | ||
addDimension(d) { | ||
const dimension = | ||
typeof d === 'string' | ||
? nxDimension(d) | ||
: { | ||
...d, | ||
qDef: d.qDef || {}, | ||
}; | ||
dimension.qDef.cId = dimension.qDef.cId || uid(); | ||
|
||
dimension.qDef.qSortCriterias = dimension.qDef.qSortCriterias || [ | ||
{ | ||
qSortByState: 1, | ||
qSortByLoadOrder: 1, | ||
qSortByNumeric: 1, | ||
qSortByAscii: 1, | ||
}, | ||
]; | ||
Object.keys(dimension).forEach((k) => { | ||
lo[k] = dimension[k]; | ||
}); | ||
def.dimensions.added(dimension, objectProperties); | ||
}, | ||
removeDimension(idx) { | ||
const dimension = lo; | ||
Object.keys(dimension).forEach((k) => { | ||
delete lo[k]; | ||
}); | ||
def.dimensions.removed(dimension, objectProperties, idx); | ||
}, | ||
addMeasure() {}, | ||
removeMeasure() {}, | ||
|
||
maxDimensions() { | ||
return 1; | ||
}, | ||
maxMeasures() { | ||
return 0; | ||
}, | ||
canAddDimension() { | ||
return lo.qDef && lo.qDef.qFieldDefs ? lo.qDef.qFieldDefs.length === 0 : !lo.qDef; | ||
}, | ||
canAddMeasure() { | ||
return false; | ||
}, | ||
}; | ||
|
||
return handler; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "listbox", | ||
"main": "dist/listbox.js", | ||
"peerDependencies": { | ||
"@nebula.js/stardust": "*" | ||
} | ||
} |
Oops, something went wrong.