Skip to content

Commit f85c299

Browse files
committed
feat: add select all feature
1 parent 0c647d5 commit f85c299

File tree

107 files changed

+2144
-1268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2144
-1268
lines changed

packages/modules/data-widgets/src/themesource/datawidgets/web/_datagrid.scss

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ $root: ".widget-datagrid";
311311
justify-content: flex-end;
312312
white-space: nowrap;
313313
align-items: baseline;
314-
margin: 0 16px;
314+
margin: 16px;
315315
color: $pagination-caption-color;
316316

317317
.paging-status {
@@ -428,7 +428,8 @@ $root: ".widget-datagrid";
428428
align-items: center;
429429
}
430430

431-
&-exporting {
431+
&-exporting,
432+
&-selecting-all-pages {
432433
.widget-datagrid-top-bar,
433434
.widget-datagrid-header,
434435
.widget-datagrid-content,
@@ -525,7 +526,7 @@ $root: ".widget-datagrid";
525526

526527
.widget-datagrid .widget-datagrid-load-more {
527528
display: block !important;
528-
margin: 0;
529+
margin: var(--spacing-small, 8px) 0;
529530
}
530531

531532
.infinite-loading.widget-datagrid-grid-body {
@@ -563,33 +564,51 @@ $root: ".widget-datagrid";
563564
:where(#{$root}-pb-start, #{$root}-tb-start, #{$root}-pb-end, #{$root}-tb-end, #{$root}-pb-middle) {
564565
flex-grow: 1;
565566
flex-basis: 33.33%;
566-
min-height: 20px;
567-
height: 54px;
568-
padding: var(--spacing-small) 0;
567+
}
568+
569+
:where(#{$root}-pb-middle) {
570+
display: flex;
571+
justify-content: center;
569572
}
570573

571574
:where(#{$root}-pb-start, #{$root}-tb-start) {
572-
padding-inline: var(--spacing-medium);
573575
display: flex;
574576
align-items: center;
575577
}
576578

577-
#{$root}-clear-selection {
579+
#{$root}-btn-link {
578580
cursor: pointer;
579581
background: transparent;
580582
border: none;
581-
text-decoration: underline;
582583
color: var(--link-color);
583-
padding: 0;
584+
padding: 0.3em 0.5em;
585+
border-radius: 6px;
584586
display: inline-block;
587+
white-space: nowrap;
585588

586-
&:focus:not(:focus-visible) {
587-
outline: none;
589+
&:hover,
590+
&:focus-visible {
591+
background-color: var(--brand-primary-50, #e6e7f2);
588592
}
593+
}
589594

590-
&:focus-visible {
591-
outline: 1px solid var(--brand-primary, $brand-primary);
592-
outline-offset: 2px;
595+
:where(#{$root}-selection-counter) {
596+
display: flex;
597+
align-items: center;
598+
height: 54px;
599+
padding: var(--spacing-small) var(--spacing-medium);
600+
}
601+
602+
:where(#{$root}-select-all-bar) {
603+
grid-column: 1 / -1;
604+
background-color: #f0f1f2;
605+
display: flex;
606+
flex-flow: row nowrap;
607+
align-items: center;
608+
padding: var(--spacing-smaller, 8px) var(--spacing-medium, 16px);
609+
610+
#{$root}-spinner {
611+
padding: 6.2px;
593612
}
594613
}
595614

packages/pluggableWidgets/custom-chart-web/src/controllers/ChartPropsController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { EditorStoreState } from "@mendix/shared-charts/main";
2-
import { DerivedPropsGate, ReactiveController, ReactiveControllerHost } from "@mendix/widget-plugin-mobx-kit/main";
2+
import { DerivedPropsGate, SetupComponent, SetupComponentHost } from "@mendix/widget-plugin-mobx-kit/main";
33
import { executeAction } from "@mendix/widget-plugin-platform/framework/execute-action";
44
import { makeAutoObservable } from "mobx";
55
import { Config, Data, Layout } from "plotly.js-dist-min";
@@ -18,14 +18,14 @@ interface ChartPropsControllerSpec {
1818
editorStateGate: DerivedPropsGate<EditorStoreState>;
1919
}
2020

21-
export class ChartPropsController implements ReactiveController {
21+
export class ChartPropsController implements SetupComponent {
2222
private cleanup: undefined | (() => void) = undefined;
2323
private editorStateGate: DerivedPropsGate<EditorStoreState>;
2424
private propsGate: DerivedPropsGate<ControllerProps>;
2525
private sizeProvider: SizeProvider;
2626

27-
constructor(host: ReactiveControllerHost, spec: ChartPropsControllerSpec) {
28-
host.addController(this);
27+
constructor(host: SetupComponentHost, spec: ChartPropsControllerSpec) {
28+
host.add(this);
2929

3030
this.editorStateGate = spec.editorStateGate;
3131
this.propsGate = spec.propsGate;

packages/pluggableWidgets/custom-chart-web/src/controllers/CustomChartControllerHost.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import { EditorStoreState } from "@mendix/shared-charts/main";
2-
import { BaseControllerHost } from "@mendix/widget-plugin-mobx-kit/BaseControllerHost";
3-
import { DerivedPropsGate } from "@mendix/widget-plugin-mobx-kit/props-gate";
4-
import { ResizeController } from "./ResizeController";
2+
import { DerivedPropsGate, SetupHost } from "@mendix/widget-plugin-mobx-kit/main";
53
import { ChartPropsController } from "./ChartPropsController";
6-
import { ControllerProps } from "./typings";
74
import { PlotlyController } from "./PlotlyController";
5+
import { ResizeController } from "./ResizeController";
6+
import { ControllerProps } from "./typings";
87

98
interface CustomChartControllerHostSpec {
109
propsGate: DerivedPropsGate<ControllerProps>;
1110
editorStateGate: DerivedPropsGate<EditorStoreState>;
1211
}
1312

14-
export class CustomChartControllerHost extends BaseControllerHost {
13+
export class CustomChartControllerHost extends SetupHost {
1514
resizeCtrl: ResizeController;
1615
chartPropsController: ChartPropsController;
1716
plotlyController: PlotlyController;

packages/pluggableWidgets/custom-chart-web/src/controllers/PlotlyController.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ChartProps, PlotlyChart } from "../components/PlotlyChart";
21
import { autorun } from "mobx";
2+
import { ChartProps, PlotlyChart } from "../components/PlotlyChart";
33

44
interface PropsProvider {
55
mergedProps: ChartProps;
@@ -23,8 +23,6 @@ export class PlotlyController {
2323
} else {
2424
const chart = new PlotlyChart(target, this.propsProvider.mergedProps);
2525

26-
// const [updatePlotlyDebounced, abort] = debounce((props: ChartProps) => chart.update(props), 100);
27-
2826
const dispose = autorun(
2927
() => {
3028
chart.update(this.propsProvider.mergedProps);

packages/pluggableWidgets/custom-chart-web/src/controllers/ResizeController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ReactiveController, ReactiveControllerHost } from "@mendix/widget-plugin-mobx-kit/main";
1+
import { SetupComponent, SetupComponentHost } from "@mendix/widget-plugin-mobx-kit/main";
22
import { debounce } from "@mendix/widget-plugin-platform/utils/debounce";
33
import { action, makeObservable, observable } from "mobx";
44

5-
export class ResizeController implements ReactiveController {
5+
export class ResizeController implements SetupComponent {
66
width = 0;
77
height = 0;
88
private cleanup: undefined | (() => void) = undefined;
99

10-
constructor(host: ReactiveControllerHost) {
11-
host.addController(this);
10+
constructor(host: SetupComponentHost) {
11+
host.add(this);
1212

1313
makeObservable(this, {
1414
width: observable,

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/hocs/withLinkedRefStore.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { RefFilterStore } from "@mendix/widget-plugin-dropdown-filter/stores/Ref
33
import { FilterAPI, useFilterAPI } from "@mendix/widget-plugin-filtering/context";
44
import { BaseStoreProvider } from "@mendix/widget-plugin-filtering/custom-filter-api/BaseStoreProvider";
55
import { GateProvider } from "@mendix/widget-plugin-mobx-kit/GateProvider";
6-
import { DerivedPropsGate } from "@mendix/widget-plugin-mobx-kit/props-gate";
6+
import { DerivedPropsGate } from "@mendix/widget-plugin-mobx-kit/main";
77
import { useConst } from "@mendix/widget-plugin-mobx-kit/react/useConst";
88
import { useSetup } from "@mendix/widget-plugin-mobx-kit/react/useSetup";
99
import { AssociationMetaData, ListAttributeValue, ListExpressionValue, ListValue } from "mendix";

packages/pluggableWidgets/datagrid-web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
"@mendix/widget-plugin-mobx-kit": "workspace:*",
5151
"@mendix/widget-plugin-platform": "workspace:*",
5252
"@radix-ui/react-progress": "^1.1.7",
53+
"brandi": "^5.0.0",
54+
"brandi-react": "^5.0.0",
5355
"classnames": "^2.5.1",
5456
"mobx": "6.12.3",
5557
"mobx-react-lite": "4.0.7",

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorConfig.ts

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import {
33
hideNestedPropertiesIn,
44
hidePropertiesIn,
55
hidePropertyIn,
6-
Properties,
7-
transformGroupsIntoTabs
6+
Properties
87
} from "@mendix/pluggable-widgets-tools";
98
import {
109
container,
@@ -19,11 +18,7 @@ import {
1918

2019
import { ColumnsPreviewType, DatagridPreviewProps } from "../typings/DatagridProps";
2120

22-
export function getProperties(
23-
values: DatagridPreviewProps,
24-
defaultProperties: Properties,
25-
platform: "web" | "desktop"
26-
): Properties {
21+
export function getProperties(values: DatagridPreviewProps, defaultProperties: Properties): Properties {
2722
values.columns.forEach((column, index) => {
2823
if (column.showContentAs !== "attribute" && !column.sortable && !values.columnsFilterable) {
2924
hidePropertyIn(defaultProperties, values, "columns", index, "attribute");
@@ -65,15 +60,6 @@ export function getProperties(
6560
if (column.minWidth !== "manual") {
6661
hidePropertyIn(defaultProperties, values, "columns", index, "minWidthLimit");
6762
}
68-
if (!values.advanced && platform === "web") {
69-
hideNestedPropertiesIn(defaultProperties, values, "columns", index, [
70-
"columnClass",
71-
"sortable",
72-
"resizable",
73-
"draggable",
74-
"hidable"
75-
]);
76-
}
7763
});
7864

7965
if (values.pagination === "buttons") {
@@ -125,28 +111,6 @@ export function getProperties(
125111
"columns"
126112
);
127113

128-
if (platform === "web") {
129-
if (!values.advanced) {
130-
hidePropertiesIn(defaultProperties, values, [
131-
"pagination",
132-
"pagingPosition",
133-
"showEmptyPlaceholder",
134-
"rowClass",
135-
"columnsSortable",
136-
"columnsDraggable",
137-
"columnsResizable",
138-
"columnsHidable",
139-
"configurationAttribute",
140-
"onConfigurationChange",
141-
"filterSectionTitle"
142-
]);
143-
}
144-
145-
transformGroupsIntoTabs(defaultProperties);
146-
} else {
147-
hidePropertyIn(defaultProperties, values, "advanced");
148-
}
149-
150114
if (values.configurationStorageType === "localStorage") {
151115
hidePropertiesIn(defaultProperties, values, ["configurationAttribute", "onConfigurationChange"]);
152116
}
@@ -172,8 +136,9 @@ function hideSelectionProperties(defaultProperties: Properties, values: Datagrid
172136
if (itemSelection !== "Multi") {
173137
hidePropertiesIn(defaultProperties, values, [
174138
"keepSelection",
175-
"selectionCountPosition",
176-
"clearSelectionButtonLabel"
139+
"selectionCounterPosition",
140+
"clearSelectionButtonLabel",
141+
"enableSelectAll"
177142
]);
178143
}
179144
}

0 commit comments

Comments
 (0)