Skip to content

Commit

Permalink
Merge pull request #2301 from evidence-dev/feat/dropdown-overhaul
Browse files Browse the repository at this point in the history
Rewrite Dropdown
  • Loading branch information
ItsMeBrianD authored Aug 15, 2024
2 parents ec2934e + c24f8ad commit bd93a8f
Show file tree
Hide file tree
Showing 30 changed files with 2,638 additions and 2,254 deletions.
6 changes: 6 additions & 0 deletions .changeset/bright-shirts-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/core-components': patch
---

- Switch to perfect-debounce instead of lodash.debounce
- Remove all lodash.library in favor of better supported lodash/library
5 changes: 5 additions & 0 deletions .changeset/few-worms-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Rewrite Dropdown + DropdownOptionStore
9 changes: 9 additions & 0 deletions .changeset/large-coins-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@evidence-dev/component-utilities': patch
'@evidence-dev/plugin-connector': patch
'@evidence-dev/preprocess': patch
'@evidence-dev/universal-sql': patch
'@evidence-dev/core-components': patch
---

Update vitest to latest
5 changes: 5 additions & 0 deletions .changeset/lucky-hounds-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/sdk': patch
---

Modify default search threshold behavior for Query
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ packages/extension/out
packages/extension/dist
packages/extension/.vscode-test
packages/extension/*.vsix
packages/extension/.DS_Store
packages/extension/.DS_Store
packages/ui/core-components/coverage
sites/docs/.evidence/meta/query-cache/hashes.json
2 changes: 1 addition & 1 deletion packages/lib/component-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"vitest": "^0.34.1"
"vitest": "^2.0.5"
},
"scripts": {
"test": "vitest --run",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/component-utilities/src/echarts.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default (node, option) => {
registerTheme('evidence-light', evidenceThemeLight);

const chart = init(node, 'evidence-light', {
renderer: useSvg ? 'svg' : option.renderer ?? 'canvas'
renderer: useSvg ? 'svg' : (option.renderer ?? 'canvas')
});

// If connectGroup supplied, connect chart to other charts matching that connectGroup
Expand Down
2 changes: 0 additions & 2 deletions packages/lib/component-utilities/src/getStackPercentages.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default function getStackPercentages(data, groupCol, valueCol) {
groupBy(groupCol, mutateWithSummary({ xTotal: sum(valueCol) })),
mutate({ percentOfX: rate(valueCol, 'xTotal') }),
rename({
[valueCol]: valueCol + '_raw',
percentOfX: valueCol + '_pct'
})
);
Expand All @@ -34,7 +33,6 @@ export default function getStackPercentages(data, groupCol, valueCol) {
pctData,
mutate({ percentOfX: rate(valueCol[i], 'xTotal') }),
rename({
[valueCol[i]]: valueCol[i] + '_raw',
percentOfX: valueCol[i] + '_pct'
})
);
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/component-utilities/src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const getStoreVal = (store) => {
* @returns {Writable<T>}
*/
export const localStorageStore = (key, init) => {
const store = writable(browser ? JSON.parse(localStorage.getItem(key)) ?? init : init);
const store = writable(browser ? (JSON.parse(localStorage.getItem(key)) ?? init) : init);
const { subscribe, set } = store;

/** @type {(v: T) => void} */
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/plugin-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"parcel": "2.12.0",
"rollup": "^4.13.0",
"typescript": "5.4.2",
"vitest": "^0.34.1"
"vitest": "^2.0.5"
},
"targets": {
"types": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/preprocess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"mock-fs": "^5.2.0",
"parcel": "^2.8.3",
"typescript": "5.4.2",
"vitest": "^0.34.2"
"vitest": "^2.0.5"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const wrapSimpleConnector = (mod, source) => {
// Why is the dirent interface so unstable?
// This behaves differently depending on which minor version of 18 / 20 you are using
const dirPath =
'parentPath' in sourceFile ? sourceFile.parentPath + '' : sourceFile.path ?? dir;
'parentPath' in sourceFile ? sourceFile.parentPath + '' : (sourceFile.path ?? dir);
if (sourceFile.name === 'connection.yaml' || sourceFile.name === 'connection.options.yaml')
continue;
if (sourceFile.isDirectory()) {
Expand Down
1 change: 1 addition & 0 deletions packages/lib/sdk/src/types/mosaic-sql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare module '@uwdata/mosaic-sql' {
type BuilderFunction = <T extends any[] = unknown[]>(...args: T) => Query;

class Query {
distinct: BuilderFunction;
from: BuilderFunction;
select: BuilderFunction;
$select: BuilderFunction;
Expand Down
9 changes: 6 additions & 3 deletions packages/lib/sdk/src/usql/query/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ DESCRIBE ${this.text.trim()}
};

/**
*
* @param {import('../types.js').QueryReactivityOpts<any>} reactiveOpts Callback that is executed when the new query is ready
* @param {import('../types.js').QueryOpts<any>} [opts]
* @param {QueryValue<any>} [initialQuery]
Expand Down Expand Up @@ -1195,10 +1194,14 @@ DESCRIBE ${this.text.trim()}
/**
* @param {string} searchTerm
* @param {string | string[]} searchCol
* @param {number} searchThreshold
* @param {number | undefined} [searchThreshold]
* @returns {QueryValue<RowType & {similarity: number}>}
*/
search = (searchTerm, searchCol, searchThreshold = 0.5) => {
search = (searchTerm, searchCol, searchThreshold) => {
if (typeof searchThreshold === 'undefined' || searchThreshold < 0 || searchThreshold > 1) {
// By default, increase threshold as more characters are added
searchThreshold = 1 - 1 / searchTerm.length;
}
/** @type {import('../../types/duckdb-wellknown.js').DescribeResultRow[]} */
const colsWithSimilarity = [
...this.#columns,
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/sdk/src/utils/batchUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { debounce } from 'perfect-debounce';

/**
* @template Input
* @param {(inputs: Input[]) => unknown} fn
* @param {((inputs: Input[]) => unknown) | ((...i: (Input[] | Input)[]) => unknown)} fn
* @param {number} [timeout=200]
* @returns {(i: Input) => unknown}
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/lib/telemetry/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ const logEvent = async (
) => {
try {
const usageStats = settings
? settings.send_anonymous_usage_stats ?? 'yes'
: process.env['SEND_ANONYMOUS_USAGE_STATS'] ??
? (settings.send_anonymous_usage_stats ?? 'yes')
: (process.env['SEND_ANONYMOUS_USAGE_STATS'] ??
process.env['send_anonymous_usage_stats'] ??
'yes';
'yes');
let repo;
let database;
let demoDb;
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/universal-sql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"@types/node": "20.11.28",
"@types/mock-fs": "^4.13.1",
"mock-fs": "^5.2.0",
"vitest": "^0.34.1"
"vitest": "^2.0.5"
}
}
Loading

0 comments on commit bd93a8f

Please sign in to comment.