@vuu-ui/vuu-ui-controls 4.0.0-alpha.22 → 4.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/drag-drop/useDragDrop.js +7 -1
- package/src/instrument-picker/TablePicker.css.js +1 -0
- package/src/prompt/Prompt.css.js +1 -0
- package/src/table-search/SearchCell.css.js +4 -2
- package/src/table-search/SearchCell.js +3 -2
- package/src/table-search/TableSearch.css.js +4 -0
- package/src/table-search/TableSearch.js +3 -1
- package/src/table-search/useTableSearch.js +14 -6
- package/types/prompt/Prompt.d.ts +2 -2
- package/types/table-search/TableSearch.d.ts +2 -1
- package/types/table-search/useTableSearch.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.0-alpha.
|
|
2
|
+
"version": "4.0.0-alpha.24",
|
|
3
3
|
"description": "VUU UI Controls",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"author": "heswell",
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "4.0.0-alpha.
|
|
14
|
-
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.
|
|
15
|
-
"@vuu-ui/vuu-table-types": "4.0.0-alpha.
|
|
13
|
+
"@vuu-ui/vuu-data-types": "4.0.0-alpha.24",
|
|
14
|
+
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.24",
|
|
15
|
+
"@vuu-ui/vuu-table-types": "4.0.0-alpha.24"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.
|
|
19
|
-
"@vuu-ui/vuu-data-react": "4.0.0-alpha.
|
|
20
|
-
"@vuu-ui/vuu-layout": "4.0.0-alpha.
|
|
21
|
-
"@vuu-ui/vuu-popups": "4.0.0-alpha.
|
|
22
|
-
"@vuu-ui/vuu-table": "4.0.0-alpha.
|
|
23
|
-
"@vuu-ui/vuu-utils": "4.0.0-alpha.
|
|
18
|
+
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.24",
|
|
19
|
+
"@vuu-ui/vuu-data-react": "4.0.0-alpha.24",
|
|
20
|
+
"@vuu-ui/vuu-layout": "4.0.0-alpha.24",
|
|
21
|
+
"@vuu-ui/vuu-popups": "4.0.0-alpha.24",
|
|
22
|
+
"@vuu-ui/vuu-table": "4.0.0-alpha.24",
|
|
23
|
+
"@vuu-ui/vuu-utils": "4.0.0-alpha.24",
|
|
24
24
|
"@salt-ds/core": "1.72.0",
|
|
25
25
|
"@salt-ds/icons": "1.18.3",
|
|
26
26
|
"@salt-ds/styles": "0.4.1",
|
|
@@ -292,6 +292,7 @@ const useDragDrop = ({ allowDragDrop, containerRef, draggableClassName, getDragP
|
|
|
292
292
|
scrollableContainerRef.current = scrollableContainer;
|
|
293
293
|
const containerRect = scrollableContainer.getBoundingClientRect();
|
|
294
294
|
const draggableRect = dragElement.getBoundingClientRect();
|
|
295
|
+
const dragElementStyle = getComputedStyle(dragElement);
|
|
295
296
|
const dragDropState = dragDropStateRef.current = new DragDropState(mousePosition, dragElement);
|
|
296
297
|
setDragBoundaries(containerRect, draggableRect);
|
|
297
298
|
beginDrag(dragElement);
|
|
@@ -303,7 +304,12 @@ const useDragDrop = ({ allowDragDrop, containerRef, draggableClassName, getDragP
|
|
|
303
304
|
onDropped: terminateDrag,
|
|
304
305
|
onTransitionEnd: terminateDrag,
|
|
305
306
|
ref: dragDropState.setDraggable,
|
|
306
|
-
style:
|
|
307
|
+
style: {
|
|
308
|
+
...constrainRect(draggableRect, containerRect),
|
|
309
|
+
backgroundColor: dragElementStyle.backgroundColor,
|
|
310
|
+
color: dragElementStyle.color,
|
|
311
|
+
font: dragElementStyle.font
|
|
312
|
+
},
|
|
307
313
|
wrapperClassName: draggableClassName
|
|
308
314
|
}),
|
|
309
315
|
draggedItemIndex: parseInt(index)
|
package/src/prompt/Prompt.css.js
CHANGED
|
@@ -3,8 +3,10 @@ const css = `
|
|
|
3
3
|
--vuu-icon-left: 0;
|
|
4
4
|
--vuu-icon-size: 16px;
|
|
5
5
|
--vuu-icon-top: -1px;
|
|
6
|
-
color:
|
|
7
|
-
|
|
6
|
+
color: inherit;
|
|
7
|
+
cursor: grab;
|
|
8
|
+
-webkit-user-select: none;
|
|
9
|
+
user-select: none;
|
|
8
10
|
align-items: center;
|
|
9
11
|
padding: 0 8px;
|
|
10
12
|
display: flex;
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
3
3
|
import { useWindow } from "@salt-ds/window";
|
|
4
4
|
import { applyHighlighting } from "@vuu-ui/vuu-table";
|
|
5
|
+
import { Icon } from "../icon-button/index.js";
|
|
5
6
|
import SearchCell from "./SearchCell.css";
|
|
6
7
|
const classBase = "vuuSearchCell";
|
|
7
8
|
const SearchCell_SearchCell = ({ column, dataRow, searchPattern = "" })=>{
|
|
@@ -16,8 +17,8 @@ const SearchCell_SearchCell = ({ column, dataRow, searchPattern = "" })=>{
|
|
|
16
17
|
className: classBase,
|
|
17
18
|
tabIndex: -1,
|
|
18
19
|
children: [
|
|
19
|
-
/*#__PURE__*/ jsx(
|
|
20
|
-
|
|
20
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
21
|
+
name: "draggable"
|
|
21
22
|
}),
|
|
22
23
|
valueWithHighlighting
|
|
23
24
|
]
|
|
@@ -16,7 +16,7 @@ const defaultConfig = {
|
|
|
16
16
|
const searchIcon = /*#__PURE__*/ jsx("span", {
|
|
17
17
|
"data-icon": "search"
|
|
18
18
|
});
|
|
19
|
-
const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus = false, className, placeHolder, searchColumns, ...htmlAttributes })=>{
|
|
19
|
+
const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus = false, baseFilter, className, placeHolder, searchColumns, ...htmlAttributes })=>{
|
|
20
20
|
const targetWindow = useWindow();
|
|
21
21
|
useComponentCssInjection({
|
|
22
22
|
testId: "vuu-table-search",
|
|
@@ -30,6 +30,7 @@ const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...
|
|
|
30
30
|
TableProps?.config
|
|
31
31
|
]);
|
|
32
32
|
const { dataSource, onChange, searchState } = useTableSearch({
|
|
33
|
+
baseFilter,
|
|
33
34
|
dataSource: dataSourceProp,
|
|
34
35
|
searchColumns
|
|
35
36
|
});
|
|
@@ -46,6 +47,7 @@ const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...
|
|
|
46
47
|
/*#__PURE__*/ jsx("div", {
|
|
47
48
|
className: `${classBase}-inputField`,
|
|
48
49
|
children: /*#__PURE__*/ jsx(Input, {
|
|
50
|
+
bordered: true,
|
|
49
51
|
inputProps: {
|
|
50
52
|
onKeyDown
|
|
51
53
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from "react";
|
|
2
|
-
const useTableSearch = ({ dataSource, searchColumns })=>{
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
const useTableSearch = ({ baseFilter = "", dataSource, searchColumns })=>{
|
|
3
3
|
const [searchState, setSearchState] = useState({
|
|
4
4
|
searchText: "",
|
|
5
5
|
filter: ""
|
|
@@ -14,12 +14,20 @@ const useTableSearch = ({ dataSource, searchColumns })=>{
|
|
|
14
14
|
searchText: value,
|
|
15
15
|
filter
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}, [
|
|
18
|
+
baseFilterPattern
|
|
19
|
+
]);
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
dataSource.filter = {
|
|
22
|
+
filter: [
|
|
23
|
+
baseFilter,
|
|
24
|
+
searchState.filter
|
|
25
|
+
].filter(Boolean).map((filter)=>`(${filter})`).join(" and ")
|
|
19
26
|
};
|
|
20
27
|
}, [
|
|
21
|
-
|
|
22
|
-
dataSource
|
|
28
|
+
baseFilter,
|
|
29
|
+
dataSource,
|
|
30
|
+
searchState.filter
|
|
23
31
|
]);
|
|
24
32
|
return {
|
|
25
33
|
dataSource,
|
package/types/prompt/Prompt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DialogHeaderProps, DialogProps } from "@salt-ds/core";
|
|
2
|
-
import { HTMLAttributes, ReactNode, RefObject } from "react";
|
|
1
|
+
import { type DialogHeaderProps, type DialogProps } from "@salt-ds/core";
|
|
2
|
+
import { type HTMLAttributes, type ReactNode, type RefObject } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Allow fine grained configuration of Prompt buttons
|
|
5
5
|
* The ref is provided to facilitate programmatic focus.
|
|
@@ -3,7 +3,8 @@ import { HTMLAttributes } from "react";
|
|
|
3
3
|
export interface TableSearchProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
TableProps: TableProps;
|
|
5
5
|
autoFocus?: boolean;
|
|
6
|
+
baseFilter?: string;
|
|
6
7
|
placeHolder?: string;
|
|
7
8
|
searchColumns: string[];
|
|
8
9
|
}
|
|
9
|
-
export declare const TableSearch: ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus, className, placeHolder, searchColumns, ...htmlAttributes }: TableSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const TableSearch: ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus, baseFilter, className, placeHolder, searchColumns, ...htmlAttributes }: TableSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FormEventHandler } from "react";
|
|
2
2
|
import { TableSearchProps } from "./TableSearch";
|
|
3
3
|
import { DataSource } from "@vuu-ui/vuu-data-types";
|
|
4
|
-
export interface TableSearchHookProps extends Pick<TableSearchProps, "searchColumns"> {
|
|
4
|
+
export interface TableSearchHookProps extends Pick<TableSearchProps, "searchColumns" | "baseFilter"> {
|
|
5
5
|
dataSource: DataSource;
|
|
6
6
|
label?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const useTableSearch: ({ dataSource, searchColumns, }: TableSearchHookProps) => {
|
|
8
|
+
export declare const useTableSearch: ({ baseFilter, dataSource, searchColumns, }: TableSearchHookProps) => {
|
|
9
9
|
dataSource: DataSource;
|
|
10
10
|
onChange: FormEventHandler;
|
|
11
11
|
searchState: {
|