Skip to content

Commit

Permalink
Merge pull request #667 from lineupjs/release/v4.11.0
Browse files Browse the repository at this point in the history
thinkh authored Jun 18, 2024
2 parents ce578f8 + c35c805 commit 4c2520b
Showing 11 changed files with 4,075 additions and 3,744 deletions.
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ packageExtensions:
dependencies:
typescript: ~4.1.5

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.3.0.cjs
6 changes: 3 additions & 3 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@
"d3-time",
"d3-time-format",
"detect-browser",
"lodash.get",
],
"lodash.get"
]
},
"include": ["**/*.ts"],
"exclude": ["**/*.d.ts"],
"exclude": ["**/*.d.ts"]
}
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lineupjs",
"description": "LineUp is an interactive technique designed to create, visualize and explore rankings of items based on a set of heterogeneous attributes.",
"version": "4.10.0",
"version": "4.11.0",
"author": {
"name": "Samuel Gratzl",
"email": "sam@sgratzl.com",
@@ -98,19 +98,19 @@
"cy:junit": "npm run cy:compile && cypress run --reporter junit --reporter-options 'mochaFile=junit-results/my-test-output.xml'"
},
"resolutions": {
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0"
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^6.5.1",
"@types/jest": "^29.5.11",
"@types/lodash": "4.14.202",
"@types/node": "^20.11.5",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"@yarnpkg/sdks": "^3.1.0",
"css-loader": "^6.9.1",
"cypress": "^13.6.3",
"@fortawesome/fontawesome-free": "^6.5.2",
"@types/jest": "^29.5.12",
"@types/lodash": "4.17.5",
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@yarnpkg/sdks": "^3.1.3",
"css-loader": "^7.1.2",
"cypress": "^13.11.0",
"d3-array": "^3.2.4",
"d3-interpolate": "^3.0.1",
"eslint": "^8.56.0",
@@ -120,38 +120,38 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.7.7",
"mini-css-extract-plugin": "^2.9.0",
"mkdirp": "^3.0.1",
"mocha-junit-reporter": "^2.2.1",
"postcss": "^8.4.33",
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"sass": "^1.70.0",
"sass-loader": "^14.0.0",
"style-loader": "^3.3.4",
"stylelint": "^16.2.0",
"postcss": "^8.4.38",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"sass": "^1.77.5",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"stylelint": "^16.6.1",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard-scss": "^13.0.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-prettier": "^5.0.0",
"stylelint-scss": "^6.1.0",
"stylelint-scss": "^6.3.1",
"thread-loader": "^4.0.2",
"ts-jest": "^29.1.1",
"ts-jest": "^29.1.5",
"ts-loader": "^9.5.1",
"typedoc": "^0.25.7",
"typescript": "^5.3.3",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"url-loader": "^4.1.1",
"webpack": "^5.89.0",
"webpack": "^5.92.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
"webpack-dev-server": "^5.0.4"
},
"dependencies": {
"@popperjs/core": "^2.11.8",
"@floating-ui/dom": "^1.6.5",
"@types/d3-color": "^3.1.3",
"@types/d3-dispatch": "^3.0.6",
"@types/d3-format": "^3.0.4",
@@ -164,14 +164,14 @@
"d3-dispatch": "^3.0.1",
"d3-format": "^3.1.0",
"d3-scale": "^4.0.2",
"d3-scale-chromatic": "^3.0.0",
"d3-scale-chromatic": "^3.1.0",
"d3-time": "^3.1.0",
"d3-time-format": "^4.1.0",
"detect-browser": "^5.3.0",
"fast-deep-equal": "^3.1.3",
"lineupengine": "^2.5.2",
"lodash.get": "^4.4.2",
"reflect-metadata": "^0.2.1"
"reflect-metadata": "^0.2.2"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.3.0"
}
8 changes: 4 additions & 4 deletions src/styles/_dialogs.scss
Original file line number Diff line number Diff line change
@@ -237,28 +237,28 @@

$arrow_size: 5px;

&[data-popper-placement='bottom'] div[data-popper-arrow] {
&[data-popper-placement^='bottom'] div[data-popper-arrow] {
border-left: $arrow_size solid transparent;
border-right: $arrow_size solid transparent;
border-bottom: $arrow_size solid black;
top: -$arrow_size;
}

&[data-popper-placement='left'] div[data-popper-arrow] {
&[data-popper-placement^='left'] div[data-popper-arrow] {
border-top: $arrow_size solid transparent;
border-bottom: $arrow_size solid transparent;
border-left: $arrow_size solid black;
right: -$arrow_size;
}

&[data-popper-placement='right'] div[data-popper-arrow] {
&[data-popper-placement^='right'] div[data-popper-arrow] {
border-top: $arrow_size solid transparent;
border-bottom: $arrow_size solid transparent;
border-right: $arrow_size solid black;
left: -$arrow_size;
}

&[data-popper-placement='top'] div[data-popper-arrow] {
&[data-popper-placement^='top'] div[data-popper-arrow] {
border-left: $arrow_size solid transparent;
border-right: $arrow_size solid transparent;
border-top: $arrow_size solid black;
2 changes: 2 additions & 0 deletions src/styles/header/_toolbar.scss
Original file line number Diff line number Diff line change
@@ -214,6 +214,8 @@
cursor: pointer;
padding-left: 0;

&.#{$lu_css_prefix}-active,
&:focus,
&:hover {
background: $lu_hover_button_color;
}
49 changes: 33 additions & 16 deletions src/ui/dialogs/ADialog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPopper, type Placement, type Instance } from '@popperjs/core';
import { computePosition, autoUpdate, flip, shift, limitShift, size } from '@floating-ui/dom';
import type DialogManager from './DialogManager';
import { cssClass } from '../../styles';
import type { IRankingHeaderContext } from '../interfaces';
@@ -9,7 +9,6 @@ export interface IDialogOptions {
livePreview: boolean | keyof ILivePreviewOptions;
popup: boolean;
// popper options
placement?: Placement;
eventsEnabled?: boolean;
toggleDialog: boolean;
cancelSubDialogs?: boolean;
@@ -46,14 +45,13 @@ abstract class ADialog {
title: '',
livePreview: false,
popup: false,
placement: 'bottom-start',
toggleDialog: true,
cancelSubDialogs: false,
autoClose: false,
};

readonly node: HTMLFormElement;
private popper: Instance | null = null;
protected floatingUiCleanup: (() => void) | null = null;

constructor(
protected readonly dialog: Readonly<IDialogContext>,
@@ -138,16 +136,35 @@ abstract class ADialog {
}

parent.appendChild(this.node);
this.popper = createPopper(this.attachment, this.node, {
modifiers: [
{
name: 'preventOverflow',
options: {
boundariesElement: parent,
},
},
],
...this.options,
this.floatingUiCleanup = autoUpdate(this.attachment, this.node, () => {
computePosition(this.attachment, this.node, {
placement: this.dialog.level === 0 ? 'bottom-start' : 'right-start',
middleware: [
flip(),
shift({ limiter: limitShift() }),
size({
apply({ availableWidth, availableHeight, elements }) {
const offset = 12;
Object.assign(elements.floating.style, {
maxWidth: `${availableWidth}px`,
maxHeight: `${availableHeight - offset}px`,
overflowY: 'auto', // add vertical scrollbar if needed
});
},
}),
],
}).then(({ x, y }) => {
function roundByDPR(value) {
const dpr = window.devicePixelRatio || 1;
return Math.round(value * dpr) / dpr;
}

Object.assign(this.node.style, {
top: '0',
left: '0',
transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
});
});
});

const auto = this.find<HTMLInputElement>('input[autofocus]');
@@ -230,8 +247,8 @@ abstract class ADialog {
this.dialog.manager.triggerDialogClosed(this, action);
}

if (this.popper) {
this.popper.destroy();
if (this.floatingUiCleanup) {
this.floatingUiCleanup();
}
this.node.remove();
}
13 changes: 13 additions & 0 deletions src/ui/headerTooltip.ts
Original file line number Diff line number Diff line change
@@ -45,6 +45,19 @@ export function addIconDOM(
i.onclick = (evt) => {
evt.stopPropagation();
ctx.dialogManager.setHighlightColumn(col);

// highlight node as active when the next dialog is opened
ctx.dialogManager.on(`dialogOpened.${col.fqid}`, () => {
ctx.dialogManager.on(`dialogOpened.${col.fqid}`, null);
i.classList.add(cssClass('active'));

// remove active state when dialog is closed
ctx.dialogManager.on(`dialogClosed.${col.fqid}`, () => {
ctx.dialogManager.on(`dialogClosed.${col.fqid}`, null);
i.classList.remove(cssClass('active'));
});
});

action.onClick(col, evt as any, ctx, level, !showLabel);
};
return i;
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@
"baseUrl": "./",
"paths": {
"@": ["./src"],
"*": ["*", "node_modules/*"],
},
"*": ["*", "node_modules/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "tsd.d.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "tsd.d.ts"]
}
Loading
Oops, something went wrong.

0 comments on commit 4c2520b

Please sign in to comment.