Skip to content
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
5 changes: 4 additions & 1 deletion org.knime.python3.scripting.nodes/js-src/.stylelintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ module.exports = {
"csstools/value-no-unknown-custom-properties": [
true,
{
importFrom: ["node_modules/@knime/styles/css/variables/index.css"],
importFrom: [
"node_modules/@knime/styles/css/variables/index.css",
"node_modules/@knime/kds-styles/dist/tokens/css/_variables.css",
],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type Ref, onMounted, onUnmounted, ref } from "vue";
import { useDebounceFn, useResizeObserver } from "@vueuse/core";

import { Button } from "@knime/components";
import { KdsButton } from "@knime/kds-components";

import {
getPythonInitialData,
Expand All @@ -18,11 +18,13 @@ import PythonWorkspaceHeader, {
const resizeContainer = ref<HTMLElement | null>(null);
const totalWidth: Ref<number> = ref(0);
const headerWidths = ref<ColumnSizes>([100, 100, 100]);
// TODO KDS-690: Replace it once the JS tokens are available
const tableSidePadding = 8;

const useTotalWidth = () => {
const rootResizeCallback = useDebounceFn((entries) => {
const rect = entries[0].contentRect;
totalWidth.value = rect.width;
totalWidth.value = rect.width - tableSidePadding * 2;
});
const resizeObserver = useResizeObserver(resizeContainer, rootResizeCallback);

Expand Down Expand Up @@ -75,15 +77,14 @@ onMounted(() => {
</table>
</div>
<div class="controls">
<Button
<KdsButton
class="reset-button"
:with-border="false"
compact
label="Reset Values"
leading-icon="reset-all"
variant="transparent"
:disabled="!resetButtonEnabled"
@click="resetWorkspace"
>
Reset values
</Button>
/>
</div>
</div>
</template>
Expand All @@ -94,25 +95,24 @@ onMounted(() => {
flex-direction: column;
justify-content: space-between;
height: 100%;
background-color: var(--knime-gray-ultra-light);
}

.workspace {
--controls-height: 40px;

position: relative;
min-width: 120px;

/* padding to match tableSidePadding in script */
padding: var(--kds-spacing-container-0-5x) var(--kds-spacing-container-0-5x) 0
var(--kds-spacing-container-0-5x);
margin-top: 0;
overflow: hidden auto;

& table {
flex: 1;
max-width: 100%;
height: calc(100% - var(--controls-height));
font-family: "Roboto Mono", sans-serif;
font-size: 13px;
line-height: 24px;
color: var(--knime-masala);
text-align: left;
border-collapse: collapse;
}
}
Expand All @@ -121,17 +121,11 @@ onMounted(() => {
display: flex;
flex-direction: row-reverse;
place-content: center space-between;
min-height: var(--controls-height);
max-height: var(--controls-height);
align-items: center;
height: var(--kds-dimension-component-height-2-25x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);
overflow: hidden;
border-top: 1px solid var(--knime-silver-sand);
}

.reset-button {
height: 30px;
margin-top: 5px;
margin-right: 10px;
margin-bottom: 5px;
border-top: var(--kds-border-base-subtle);
}
</style>
@/python-initial-data-service
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,32 @@ const totalWidth = computed(() =>
<style scoped lang="postcss">
tbody {
display: table;
font-size: 13px;
font-weight: 400;
line-height: 18px;
color: var(--knime-dove-gray);
letter-spacing: 0;

& tr {
display: flex;
color: var(--knime-dove-gray);
border-bottom: 1px solid var(--knime-porcelain);

&:hover {
color: var(--knime-masala);
cursor: pointer;
background-color: var(--kds-color-background-neutral-hover);
border-radius: var(--kds-border-radius-container-0-25x);
}

& td {
gap: var(--kds-spacing-container-0-12x);
height: var(--kds-dimension-component-height-1-5x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

& span {
width: inherit;
margin: 6px;
overflow: hidden;
text-overflow: ellipsis;
font: var(--kds-font-base-interactive-small);
color: var(--kds-color-text-and-icon-neutral);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,31 +204,28 @@ const onPointerMove = (event: { clientX: number }) => {

<style lang="postcss" scoped>
thead {
position: sticky;
top: 0;
width: calc(100% - 15px);
font-weight: 500;
line-height: 15px;
text-align: left;
letter-spacing: 0;
table-layout: fixed;
background-color: var(--knime-porcelain);
display: contents;
border-bottom: var(--kds-border-base-subtle);

& tr {
position: sticky;
display: flex;
height: var(--kds-spacing-container-1-5x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);

& th {
display: flex;
justify-content: space-between;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
white-space: nowrap;

& span {
margin: 0 5px;
overflow: hidden;
text-overflow: ellipsis;
font: var(--kds-font-base-interactive-small-strong);
color: var(--kds-color-text-and-icon-neutral);
}

& .drag-handle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { type Ref } from "vue";
import { flushPromises, mount } from "@vue/test-utils";

import { Button } from "@knime/components";
import { KdsButton } from "@knime/kds-components";
import { getScriptingService, initMocked } from "@knime/scripting-editor";

import { DEFAULT_INITIAL_DATA } from "@/__mocks__/mock-data";
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("PythonWorkspace", () => {

it("reset button enabled if inputs are available", async () => {
const { wrapper } = await doMount();
const button = wrapper.findComponent(Button);
const button = wrapper.findComponent(KdsButton);
expect(button.props().disabled).toBeFalsy();
});

Expand All @@ -129,7 +129,7 @@ describe("PythonWorkspace", () => {
});

const { wrapper } = await doMount();
const button = wrapper.findComponent(Button);
const button = wrapper.findComponent(KdsButton);
expect(button.props().disabled).toBeTruthy();
});
});
4 changes: 3 additions & 1 deletion org.knime.python3.scripting.nodes/js-src/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default defineConfig({
environment: "jsdom",
reporters: ["default"],
root: fileURLToPath(new URL("./", import.meta.url)),
server: { deps: { inline: ["@knime/scripting-editor"] } },
server: {
deps: { inline: ["@knime/scripting-editor", "@knime/kds-components"] },
},
pool: "threads",
alias: {
"monaco-editor": fileURLToPath(
Expand Down