@webority/ui-react 0.168.0 → 0.169.0
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/dist/canvas-kit/kit.js +216 -216
- package/dist/canvas-kit/manifest.json +3776 -2325
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAvatar.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppEntryGrid.js +1 -1
- package/dist/components/AppGantt.js +1 -0
- package/dist/components/AppIdleTimeoutDialog.js +1 -0
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppLoadMore.js +1 -0
- package/dist/components/AppQueryBuilder.js +1 -0
- package/dist/components/AppSavedViews.js +1 -0
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppTransferList.js +1 -0
- package/dist/components/AppTreePicker.js +1 -0
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/guidance.json +204 -2
- package/dist/lib/queryBuilder/querySerialise.js +1 -0
- package/dist/lib/queryBuilder/queryTree.js +1 -0
- package/dist/lib/queryBuilder/queryTypes.js +1 -0
- package/dist/lib/queryBuilderView/QueryAppliedBar.js +1 -0
- package/dist/lib/queryBuilderView/QueryConditionRow.js +1 -0
- package/dist/lib/queryBuilderView/QueryGroupBox.js +1 -0
- package/dist/lib/queryBuilderView/QueryRulePanel.js +1 -0
- package/dist/lib/queryBuilderView/QueryValueInput.js +1 -0
- package/dist/lib/queryBuilderView/queryDisplay.js +1 -0
- package/dist/lib/transferList/transferKeys.js +1 -0
- package/dist/lib/transferList/transferState.js +1 -0
- package/dist/lib/transferListView/TransferPanel.js +1 -0
- package/dist/lib/transferListView/TransferRow.js +1 -0
- package/dist/types/components/AppChart.d.ts +3 -2
- package/dist/types/components/AppDataTable.d.ts +6 -0
- package/dist/types/components/AppEntryGrid.d.ts +3 -0
- package/dist/types/components/AppGantt.d.ts +75 -0
- package/dist/types/components/AppIdleTimeoutDialog.d.ts +43 -0
- package/dist/types/components/AppLoadMore.d.ts +47 -0
- package/dist/types/components/AppPopover.d.ts +2 -0
- package/dist/types/components/AppQueryBuilder.d.ts +37 -0
- package/dist/types/components/AppSavedViews.d.ts +21 -0
- package/dist/types/components/AppSearch.d.ts +6 -0
- package/dist/types/components/AppTransferList.d.ts +131 -0
- package/dist/types/components/AppTreePicker.d.ts +92 -0
- package/dist/types/components/AppTreeView.d.ts +4 -0
- package/dist/types/index.d.ts +13 -1
- package/dist/types/lib/queryBuilder/querySerialise.d.ts +31 -0
- package/dist/types/lib/queryBuilder/queryTree.d.ts +37 -0
- package/dist/types/lib/queryBuilder/queryTypes.d.ts +57 -0
- package/dist/types/lib/queryBuilderView/QueryAppliedBar.d.ts +24 -0
- package/dist/types/lib/queryBuilderView/QueryConditionRow.d.ts +16 -0
- package/dist/types/lib/queryBuilderView/QueryGroupBox.d.ts +27 -0
- package/dist/types/lib/queryBuilderView/QueryRulePanel.d.ts +18 -0
- package/dist/types/lib/queryBuilderView/QueryValueInput.d.ts +15 -0
- package/dist/types/lib/queryBuilderView/queryDisplay.d.ts +29 -0
- package/dist/types/lib/transferList/transferKeys.d.ts +44 -0
- package/dist/types/lib/transferList/transferState.d.ts +24 -0
- package/dist/types/lib/transferListView/TransferPanel.d.ts +33 -0
- package/dist/types/lib/transferListView/TransferRow.d.ts +10 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/errors/extractApiError.js +2 -2
- package/package.json +8 -8
- package/dist/lib/initials.js +0 -1
- package/dist/types/lib/initials.d.ts +0 -5
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type JSX } from "react";
|
|
2
|
+
export interface AppSavedViewsProps {
|
|
3
|
+
/** The name this list's views are stored under in the browser; give each list its own. */
|
|
4
|
+
storageKey: string;
|
|
5
|
+
/**
|
|
6
|
+
* Extra CSS class on the element.
|
|
7
|
+
* @default ""
|
|
8
|
+
*/
|
|
9
|
+
className?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A Views menu that saves the page's current filters, sort and page size under a name and opens
|
|
13
|
+
* them again; kept in this browser, 20 per list, and opening a view navigates to its address. Give
|
|
14
|
+
* each list its own `storageKey`. Wraps `<wui-saved-views>`, which Razor `<app-saved-views>`
|
|
15
|
+
* renders too. Table columns are never part of a view.
|
|
16
|
+
*
|
|
17
|
+
* @param props
|
|
18
|
+
* @param [props.storageKey] The name the list's views are stored under.
|
|
19
|
+
* @param [props.className] Extra CSS class on the element.
|
|
20
|
+
*/
|
|
21
|
+
export default function AppSavedViews(props: AppSavedViewsProps): JSX.Element;
|
|
@@ -41,6 +41,11 @@ export interface AppSearchProps extends Omit<ComponentPropsWithoutRef<"input">,
|
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
43
|
disabled?: boolean | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Locks the field against typing and clearing; the value still posts.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
readOnly?: boolean | undefined;
|
|
44
49
|
/**
|
|
45
50
|
* Extra class names for the root element.
|
|
46
51
|
* @default ""
|
|
@@ -66,6 +71,7 @@ export interface AppSearchProps extends Omit<ComponentPropsWithoutRef<"input">,
|
|
|
66
71
|
* @param [props.loading]
|
|
67
72
|
* @param [props.collapsible]
|
|
68
73
|
* @param [props.disabled]
|
|
74
|
+
* @param [props.readOnly] Locks the field against typing; the value still posts and the clear button is hidden.
|
|
69
75
|
* @param [props.className]
|
|
70
76
|
* @param [props.form]
|
|
71
77
|
* @param [props.onKeyDown] Called for every key in the field, before a collapsible search folds on Escape.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type TransferItem } from "../lib/transferList/transferState.ts";
|
|
3
|
+
export type AppTransferListItem = TransferItem;
|
|
4
|
+
export interface AppTransferListProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue"> {
|
|
5
|
+
/** The rows. Available shows the ones not chosen, in this order. Each has an id, a label, an optional secondary line and an optional disabled flag. */
|
|
6
|
+
items: AppTransferListItem[];
|
|
7
|
+
/** The chosen ids, in order. Controlled when given. Ids that match no item are dropped and never posted. */
|
|
8
|
+
value?: string[] | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The chosen ids, in order, when the list is uncontrolled.
|
|
11
|
+
* @default []
|
|
12
|
+
*/
|
|
13
|
+
defaultValue?: string[] | undefined;
|
|
14
|
+
/** Called with the new chosen ids after a user change. Never called for a change that leaves the list as it was. */
|
|
15
|
+
onChange?: ((value: string[]) => void) | undefined;
|
|
16
|
+
/** Posts one hidden input per chosen id, in order, under this name. */
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
/** The visible label above both lists. */
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
/** A hint under the lists. */
|
|
21
|
+
helperText?: ReactNode;
|
|
22
|
+
/** An error message under the lists. Also marks the group as described by it. */
|
|
23
|
+
error?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Stops every move and every search.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Shows a search box on each list.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
searchable?: boolean | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Lets the person reorder Chosen. With false, Chosen keeps the order it was given and rows move by button or drag only.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
reorderable?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Replaces the built-in English text, for other languages.
|
|
41
|
+
* @default "Available"
|
|
42
|
+
*/
|
|
43
|
+
availableTitle?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Replaces the built-in English text, for other languages.
|
|
46
|
+
* @default "Chosen"
|
|
47
|
+
*/
|
|
48
|
+
chosenTitle?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Replaces the built-in English text, for other languages.
|
|
51
|
+
* @default "Add all shown"
|
|
52
|
+
*/
|
|
53
|
+
addAllLabel?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Replaces the built-in English text, for other languages.
|
|
56
|
+
* @default "Remove all"
|
|
57
|
+
*/
|
|
58
|
+
removeAllLabel?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Replaces the built-in English text, for other languages. {name} is the row label.
|
|
61
|
+
* @default "Add {name}"
|
|
62
|
+
*/
|
|
63
|
+
addLabel?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Replaces the built-in English text, for other languages. {name} is the row label.
|
|
66
|
+
* @default "Remove {name}"
|
|
67
|
+
*/
|
|
68
|
+
removeLabel?: string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Replaces the built-in English text, for other languages. {title} is the list title.
|
|
71
|
+
* @default "Search {title}"
|
|
72
|
+
*/
|
|
73
|
+
searchLabel?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Replaces the built-in English text, for other languages.
|
|
76
|
+
* @default "Search"
|
|
77
|
+
*/
|
|
78
|
+
searchPlaceholder?: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Replaces the built-in English text, for other languages. {query} is the search text.
|
|
81
|
+
* @default "No matches for \"{query}\""
|
|
82
|
+
*/
|
|
83
|
+
noMatchText?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Replaces the built-in English text, for other languages.
|
|
86
|
+
* @default "Everything is chosen"
|
|
87
|
+
*/
|
|
88
|
+
emptyAvailableTitle?: string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Replaces the built-in English text, for other languages.
|
|
91
|
+
* @default "Remove an item from Chosen to see it here."
|
|
92
|
+
*/
|
|
93
|
+
emptyAvailableText?: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the built-in English text, for other languages.
|
|
96
|
+
* @default "Nothing chosen yet"
|
|
97
|
+
*/
|
|
98
|
+
emptyChosenTitle?: string | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Replaces the built-in English text, for other languages.
|
|
101
|
+
* @default "Use Add on an item, or press Enter on it."
|
|
102
|
+
*/
|
|
103
|
+
emptyChosenText?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Replaces the built-in English text, for other languages.
|
|
106
|
+
* @default "Press Space to pick up a row, then Left or Right to move it across, or Up and Down to reorder the chosen rows."
|
|
107
|
+
*/
|
|
108
|
+
dragHintText?: string | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Replaces the built-in English text, for other languages.
|
|
111
|
+
* @default "The order of Chosen is kept. Drag the grip to reorder."
|
|
112
|
+
*/
|
|
113
|
+
orderHintText?: string | undefined;
|
|
114
|
+
/** The id of the group's root element. */
|
|
115
|
+
id?: string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Extra classes on the root.
|
|
118
|
+
* @default ""
|
|
119
|
+
*/
|
|
120
|
+
className?: string | undefined;
|
|
121
|
+
/** Names the group when there is no label. */
|
|
122
|
+
ariaLabel?: string | undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Two lists side by side: rows move between Available and Chosen with a button, Enter, or a lifted
|
|
126
|
+
* row (Space to lift, Left and Right to cross, Space or Enter to drop), and Chosen can be reordered.
|
|
127
|
+
* The value is the ordered list of chosen ids.
|
|
128
|
+
* React-only: it has no custom element, so a server-rendered page uses a form control instead.
|
|
129
|
+
*/
|
|
130
|
+
declare const AppTransferList: import("react").ForwardRefExoticComponent<AppTransferListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
131
|
+
export default AppTransferList;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export type AppTreePickerSelection = "single" | "multiple";
|
|
3
|
+
export type AppTreePickerNode = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: string | undefined;
|
|
7
|
+
children?: AppTreePickerNode[] | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
export interface AppTreePickerProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue"> {
|
|
11
|
+
/** The hierarchy to pick from. Ids are strings, unique across the whole tree. A node with children is a parent; only leaves can be chosen. */
|
|
12
|
+
nodes: AppTreePickerNode[];
|
|
13
|
+
/**
|
|
14
|
+
* multiple ticks leaves and parents; single picks one leaf.
|
|
15
|
+
* @default "multiple"
|
|
16
|
+
*/
|
|
17
|
+
selection?: AppTreePickerSelection | undefined;
|
|
18
|
+
/** Chosen leaf ids (controlled): an array in multiple mode, one id in single mode. */
|
|
19
|
+
value?: string | string[] | undefined;
|
|
20
|
+
/** Leaf ids chosen when the field first draws (uncontrolled): an array in multiple mode, one id in single mode. */
|
|
21
|
+
defaultValue?: string | string[] | undefined;
|
|
22
|
+
/** A user changed the choice; `ids` is every chosen leaf id, `value` the same in the selection's shape. */
|
|
23
|
+
onChange?: ((value: string | string[], detail: {
|
|
24
|
+
ids: string[];
|
|
25
|
+
}) => void) | undefined;
|
|
26
|
+
/** Form field name: one hidden value per chosen id. */
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
/** The field label. */
|
|
29
|
+
label?: ReactNode;
|
|
30
|
+
/** Help text under the field. */
|
|
31
|
+
helperText?: ReactNode;
|
|
32
|
+
/** An error message under the field; it also marks the field invalid. */
|
|
33
|
+
error?: ReactNode;
|
|
34
|
+
/** Marks the field as required. */
|
|
35
|
+
required?: boolean | undefined;
|
|
36
|
+
/** Disables the field. */
|
|
37
|
+
disabled?: boolean | undefined;
|
|
38
|
+
/** The id of the field. */
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
/** Accessible name of the tree, when there is no visible label. */
|
|
41
|
+
ariaLabel?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Extra class names on the tree element.
|
|
44
|
+
* @default ""
|
|
45
|
+
*/
|
|
46
|
+
className?: string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Heading of the chosen list.
|
|
49
|
+
* @default "Chosen"
|
|
50
|
+
*/
|
|
51
|
+
chosenTitle?: string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Label of the button that clears every choice.
|
|
54
|
+
* @default "Clear all"
|
|
55
|
+
*/
|
|
56
|
+
clearAllLabel?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Shown in the chosen list when nothing is chosen.
|
|
59
|
+
* @default "Nothing chosen yet"
|
|
60
|
+
*/
|
|
61
|
+
emptyTitle?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Text under the empty title.
|
|
64
|
+
* @default "Tick items in the tree."
|
|
65
|
+
*/
|
|
66
|
+
emptyText?: string | undefined;
|
|
67
|
+
/** Shown when the search matches nothing; {query} is the search text. */
|
|
68
|
+
noMatchText?: string | undefined;
|
|
69
|
+
/** Remove button label; {name} is the chosen item. */
|
|
70
|
+
removeLabel?: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Accessible name of the search box.
|
|
73
|
+
* @default "Search"
|
|
74
|
+
*/
|
|
75
|
+
searchLabel?: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Placeholder of the search box.
|
|
78
|
+
* @default "Search"
|
|
79
|
+
*/
|
|
80
|
+
searchPlaceholder?: string | undefined;
|
|
81
|
+
/** Count line; {n} is the number chosen. */
|
|
82
|
+
selectedText?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A form field that picks leaves from a hierarchy: a searchable tree beside a list of what is
|
|
86
|
+
* chosen. Thin React wrapper over the shared `<wui-tree-picker>` element, which owns the tree logic
|
|
87
|
+
* and the markup; this component adds the field label, the error and helper text, and the form
|
|
88
|
+
* value. Multiple selection ticks leaves and parents (a parent ticks every enabled leaf under it);
|
|
89
|
+
* single selection picks one leaf. The Razor `<app-tree-picker>` renders the same element.
|
|
90
|
+
*/
|
|
91
|
+
declare const AppTreePicker: import("react").ForwardRefExoticComponent<AppTreePickerProps & import("react").RefAttributes<HTMLElement>>;
|
|
92
|
+
export default AppTreePicker;
|
|
@@ -75,6 +75,10 @@ export interface AppTreeViewProps extends Omit<ComponentPropsWithoutRef<"div">,
|
|
|
75
75
|
* Selection: `single` marks one row selected; `multiple` shows a tri-state checkbox per node (a
|
|
76
76
|
* parent is checked, unchecked or mixed from its children, and checking it checks every loaded
|
|
77
77
|
* child). `checked` is controlled by the ids it lists, parents included.
|
|
78
|
+
*
|
|
79
|
+
* A tree of more than 300 visible rows draws only the rows near the scroll position of its nearest
|
|
80
|
+
* scrolling parent (or the page), so give a long tree a scrolling parent with a fixed height; rows
|
|
81
|
+
* outside the view are not in the DOM.
|
|
78
82
|
*/
|
|
79
83
|
declare const AppTreeView: import("react").ForwardRefExoticComponent<AppTreeViewProps & import("react").RefAttributes<HTMLElement>>;
|
|
80
84
|
export default AppTreeView;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -69,8 +69,11 @@ export { default as AppFormRow } from "./components/AppFormRow.tsx";
|
|
|
69
69
|
export { default as AppFormSection } from "./components/AppFormSection.tsx";
|
|
70
70
|
export type { AppFormulaSign, AppFormulaStep, AppFormulaStepsProps } from "./components/AppFormulaSteps.tsx";
|
|
71
71
|
export { default as AppFormulaSteps } from "./components/AppFormulaSteps.tsx";
|
|
72
|
+
export type { AppGanttProps, GanttLayout, GanttRow, GanttState, GanttStatus, GanttZoom } from "./components/AppGantt.tsx";
|
|
73
|
+
export { default as AppGantt } from "./components/AppGantt.tsx";
|
|
72
74
|
export { default as AppHoverCard } from "./components/AppHoverCard.tsx";
|
|
73
75
|
export { default as AppIcon, iconNames, registerIcons } from "./components/AppIcon.tsx";
|
|
76
|
+
export { default as AppIdleTimeoutDialog } from "./components/AppIdleTimeoutDialog.tsx";
|
|
74
77
|
export { default as AppImagePicker } from "./components/AppImagePicker.tsx";
|
|
75
78
|
export { default as AppInfoTip } from "./components/AppInfoTip.tsx";
|
|
76
79
|
export { default as AppInlineEdit } from "./components/AppInlineEdit.tsx";
|
|
@@ -83,6 +86,7 @@ export type { AppLeadPopupElement } from "./components/AppLeadPopup.tsx";
|
|
|
83
86
|
export { default as AppLeadPopup } from "./components/AppLeadPopup.tsx";
|
|
84
87
|
export { default as AppLightbox } from "./components/AppLightbox.tsx";
|
|
85
88
|
export { default as AppLink } from "./components/AppLink.tsx";
|
|
89
|
+
export { default as AppLoadMore } from "./components/AppLoadMore.tsx";
|
|
86
90
|
export { default as AppMarkdown } from "./components/AppMarkdown.tsx";
|
|
87
91
|
export { default as AppMentionInput } from "./components/AppMentionInput.tsx";
|
|
88
92
|
export { default as AppMeter } from "./components/AppMeter.tsx";
|
|
@@ -102,6 +106,8 @@ export { default as AppPopover } from "./components/AppPopover.tsx";
|
|
|
102
106
|
export { default as AppPricingCard } from "./components/AppPricingCard.tsx";
|
|
103
107
|
export { default as AppProgress } from "./components/AppProgress.tsx";
|
|
104
108
|
export { default as AppQrCode } from "./components/AppQrCode.tsx";
|
|
109
|
+
export type { AppQueryBuilderField, AppQueryBuilderProps } from "./components/AppQueryBuilder.tsx";
|
|
110
|
+
export { default as AppQueryBuilder } from "./components/AppQueryBuilder.tsx";
|
|
105
111
|
export { default as AppRadio } from "./components/AppRadio.tsx";
|
|
106
112
|
export { default as AppRadioGroup } from "./components/AppRadioGroup.tsx";
|
|
107
113
|
export { default as AppRating } from "./components/AppRating.tsx";
|
|
@@ -115,6 +121,8 @@ export { default as AppRichText } from "./components/AppRichText.tsx";
|
|
|
115
121
|
export { default as AppRouteError } from "./components/AppRouteError.tsx";
|
|
116
122
|
export type { AppRowAction, AppRowActionEntry, AppRowActionsProps } from "./components/AppRowActions.tsx";
|
|
117
123
|
export { default as AppRowActions } from "./components/AppRowActions.tsx";
|
|
124
|
+
export type { AppSavedViewsProps } from "./components/AppSavedViews.tsx";
|
|
125
|
+
export { default as AppSavedViews } from "./components/AppSavedViews.tsx";
|
|
118
126
|
export { default as AppScoreScale } from "./components/AppScoreScale.tsx";
|
|
119
127
|
export { default as AppScrollbar } from "./components/AppScrollbar.tsx";
|
|
120
128
|
export { default as AppSearch } from "./components/AppSearch.tsx";
|
|
@@ -156,6 +164,10 @@ export { default as AppToast } from "./components/AppToast.tsx";
|
|
|
156
164
|
export { default as AppToolbar } from "./components/AppToolbar.tsx";
|
|
157
165
|
export { default as AppTooltip } from "./components/AppTooltip.tsx";
|
|
158
166
|
export { default as AppTour } from "./components/AppTour.tsx";
|
|
167
|
+
export type { AppTransferListItem, AppTransferListProps } from "./components/AppTransferList.tsx";
|
|
168
|
+
export { default as AppTransferList } from "./components/AppTransferList.tsx";
|
|
169
|
+
export type { AppTreePickerNode, AppTreePickerProps, AppTreePickerSelection } from "./components/AppTreePicker.tsx";
|
|
170
|
+
export { default as AppTreePicker } from "./components/AppTreePicker.tsx";
|
|
159
171
|
export { default as AppTreeView } from "./components/AppTreeView.tsx";
|
|
160
172
|
export { default as AppTruncate } from "./components/AppTruncate.tsx";
|
|
161
173
|
export { default as AppUpdateBar } from "./components/AppUpdateBar.tsx";
|
|
@@ -169,7 +181,7 @@ export type Tone = "primary" | "info" | "success" | "warning" | "danger" | "neut
|
|
|
169
181
|
export { setWuiText, type WuiText } from "@webority/ui-elements/text";
|
|
170
182
|
export type { AppAlertTone } from "./components/AppAlert.tsx";
|
|
171
183
|
export type { ConfirmTone } from "./components/AppConfirmDialog.tsx";
|
|
172
|
-
export type { AppDataTableColumn, AppDataTablePagination, AppDataTableSort } from "./components/AppDataTable.tsx";
|
|
184
|
+
export type { AppDataTableColumn, AppDataTableError, AppDataTablePagination, AppDataTableSort } from "./components/AppDataTable.tsx";
|
|
173
185
|
export type { AppDescriptionItem } from "./components/AppDescriptions.tsx";
|
|
174
186
|
export type { AppProgressTone } from "./components/AppProgress.tsx";
|
|
175
187
|
export type { AppTooltipTone } from "./components/AppTooltip.tsx";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type QueryCondition, type QueryDuration, type QueryField, type QueryGroup, type QueryIssue } from "./queryTypes.ts";
|
|
2
|
+
export type ListFilterRange = {
|
|
3
|
+
from?: string;
|
|
4
|
+
to?: string;
|
|
5
|
+
};
|
|
6
|
+
export type ListFilterValue = string | string[] | ListFilterRange;
|
|
7
|
+
export interface ListFilters {
|
|
8
|
+
filters: Record<string, ListFilterValue>;
|
|
9
|
+
unmapped: QueryCondition[];
|
|
10
|
+
}
|
|
11
|
+
/** Keys are written in one fixed order, so equal queries give equal text. Incomplete conditions are never written. */
|
|
12
|
+
export declare function serialiseQuery(root: QueryGroup, fields: readonly QueryField[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Reads text written by serialiseQuery. Never throws: bad JSON gives an empty query and one issue; a condition
|
|
15
|
+
* that fails the same checks as validateQuery, or a group past MAX_QUERY_DEPTH, is dropped with its issue.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseQuery(text: string, fields: readonly QueryField[]): {
|
|
18
|
+
query: QueryGroup;
|
|
19
|
+
issues: QueryIssue[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The flat list query mapping. Only an `and` root's `is` (scalar), `isAnyOf` (list) and date `between` conditions are
|
|
23
|
+
* written; the rest go to `unmapped`: an `or` root, any nested group, the reserved list params, a second condition
|
|
24
|
+
* on one field, and every other operator. The caller decides what to do with `unmapped`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function toListFilters(root: QueryGroup, fields: readonly QueryField[]): ListFilters;
|
|
27
|
+
/** The local date for `today`, shifted back by the duration; `to` is today. Months clamp to the month's last day. */
|
|
28
|
+
export declare function resolveInLast(duration: QueryDuration, today: Date): {
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type QueryCondition, type QueryField, type QueryGroup, type QueryGroupOp, type QueryIssue, type QueryIssueCode, type QueryNode, type QueryPath } from "./queryTypes.ts";
|
|
2
|
+
export declare function emptyQuery(): QueryGroup;
|
|
3
|
+
export declare function isGroup(node: QueryNode): node is QueryGroup;
|
|
4
|
+
export declare function nodeAt(root: QueryGroup, path: QueryPath): QueryNode | undefined;
|
|
5
|
+
export declare function queryDepth(root: QueryGroup): number;
|
|
6
|
+
/** The depth of the group at `path`; the root is 1. */
|
|
7
|
+
export declare function groupDepthOf(path: QueryPath): number;
|
|
8
|
+
/** Counts the non-root groups. */
|
|
9
|
+
export declare function countGroups(group: QueryGroup): number;
|
|
10
|
+
export declare function countConditions(group: QueryGroup): number;
|
|
11
|
+
export declare function addCondition(root: QueryGroup, groupPath: QueryPath, fields: readonly QueryField[], at?: number): QueryGroup;
|
|
12
|
+
export declare function addGroup(root: QueryGroup, groupPath: QueryPath, at?: number): QueryGroup;
|
|
13
|
+
export declare function removeNode(root: QueryGroup, path: QueryPath): QueryGroup;
|
|
14
|
+
export declare function updateCondition(root: QueryGroup, path: QueryPath, patch: Partial<QueryCondition>, fields: readonly QueryField[]): QueryGroup;
|
|
15
|
+
export declare function setGroupOp(root: QueryGroup, groupPath: QueryPath, op: QueryGroupOp): QueryGroup;
|
|
16
|
+
export declare function isConditionComplete(condition: QueryCondition, fields: readonly QueryField[]): boolean;
|
|
17
|
+
export interface ConditionIssue {
|
|
18
|
+
code: QueryIssueCode;
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The first problem with one condition, or null when it is complete and valid. Takes unknown values so the
|
|
23
|
+
* parser can check raw JSON with the same rules.
|
|
24
|
+
*/
|
|
25
|
+
export declare function conditionIssue(condition: {
|
|
26
|
+
field: string;
|
|
27
|
+
operator: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
}, fields: readonly QueryField[]): ConditionIssue | null;
|
|
30
|
+
/**
|
|
31
|
+
* Checks the whole tree. Reports every problem with its path; never throws on bad content.
|
|
32
|
+
*
|
|
33
|
+
* @param maxDepth Capped to MAX_QUERY_DEPTH. Must be a whole number of 1 or more.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateQuery(root: QueryGroup, fields: readonly QueryField[], maxDepth?: number): QueryIssue[];
|
|
36
|
+
/** Drops incomplete conditions, then the groups they leave empty. The root is never dropped. */
|
|
37
|
+
export declare function pruneIncomplete(root: QueryGroup, fields: readonly QueryField[]): QueryGroup;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const QUERY_OPERATORS: readonly ["is", "isNot", "isAnyOf", "contains", "gt", "lt", "between", "inLast", "isEmpty"];
|
|
2
|
+
export type QueryOperator = (typeof QUERY_OPERATORS)[number];
|
|
3
|
+
export type QueryFieldKind = "text" | "number" | "money" | "date" | "enum" | "boolean";
|
|
4
|
+
export interface QueryField {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
kind: QueryFieldKind;
|
|
8
|
+
options?: readonly {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[] | undefined;
|
|
12
|
+
operators?: readonly QueryOperator[] | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** Every operator a field kind may use. A field narrows this through `QueryField.operators`. */
|
|
15
|
+
export declare const OPERATORS_BY_KIND: Readonly<Record<QueryFieldKind, readonly QueryOperator[]>>;
|
|
16
|
+
/** The operators the flat list-query contract maps today. A field gets these unless it lists its own. */
|
|
17
|
+
export declare const DEFAULT_OPERATORS_BY_KIND: Readonly<Record<QueryFieldKind, readonly QueryOperator[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* The operators a field may use, in kind order. `field.operators` narrows the kind's allowed set;
|
|
20
|
+
* when that leaves nothing, the field gets the defaults.
|
|
21
|
+
*/
|
|
22
|
+
export declare function fieldOperators(field: QueryField): readonly QueryOperator[];
|
|
23
|
+
export type QueryDurationUnit = "days" | "weeks" | "months";
|
|
24
|
+
export declare const DURATION_UNITS: readonly QueryDurationUnit[];
|
|
25
|
+
export interface QueryDuration {
|
|
26
|
+
amount: number;
|
|
27
|
+
unit: QueryDurationUnit;
|
|
28
|
+
}
|
|
29
|
+
export interface QueryRange {
|
|
30
|
+
from?: string | number | null | undefined;
|
|
31
|
+
to?: string | number | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Money is integer paise; dates are yyyy-MM-dd strings. */
|
|
34
|
+
export type QueryValue = string | number | boolean | readonly string[] | readonly number[] | QueryRange | QueryDuration | null;
|
|
35
|
+
export interface QueryCondition {
|
|
36
|
+
field: string;
|
|
37
|
+
operator: QueryOperator;
|
|
38
|
+
value: QueryValue;
|
|
39
|
+
}
|
|
40
|
+
export type QueryGroupOp = "and" | "or";
|
|
41
|
+
export interface QueryGroup {
|
|
42
|
+
op: QueryGroupOp;
|
|
43
|
+
items: readonly QueryNode[];
|
|
44
|
+
}
|
|
45
|
+
export type QueryNode = QueryGroup | QueryCondition;
|
|
46
|
+
/** The root group is depth 1. */
|
|
47
|
+
export declare const MAX_QUERY_DEPTH = 3;
|
|
48
|
+
/** Indexes from the root; `[]` is the root group. */
|
|
49
|
+
export type QueryPath = readonly number[];
|
|
50
|
+
export type QueryIssueCode = "unknownField" | "unknownOperator" | "badOperator" | "missingValue" | "badValue" | "tooDeep" | "emptyGroup";
|
|
51
|
+
export interface QueryIssue {
|
|
52
|
+
path: QueryPath;
|
|
53
|
+
code: QueryIssueCode;
|
|
54
|
+
message: string;
|
|
55
|
+
}
|
|
56
|
+
/** Narrows a value that a `switch` over a closed set did not cover; a new member fails here at run time and in the type check. */
|
|
57
|
+
export declare function assertNever(value: never): never;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type QueryBuilderText } from "@webority/ui-elements/text";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export interface QueryAppliedBarProps {
|
|
4
|
+
/** One sentence per top-level item of the applied rule, in order. */
|
|
5
|
+
clauses: readonly string[];
|
|
6
|
+
/** The root group's and or or word, drawn between chips. */
|
|
7
|
+
connector: string;
|
|
8
|
+
/** Conditions in the applied rule, shown on the Filters button. */
|
|
9
|
+
conditionCount: number;
|
|
10
|
+
text: QueryBuilderText;
|
|
11
|
+
ariaLabel: string;
|
|
12
|
+
titleId: string;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
/** Removes the top-level item at the index and reports at once. */
|
|
17
|
+
onRemoveClause: (index: number) => void;
|
|
18
|
+
/** Empties the applied rule and reports at once. */
|
|
19
|
+
onClear: () => void;
|
|
20
|
+
/** The panel, drawn inside the popover. */
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/** The closed state: the Filters button that opens the panel, one removable chip per applied clause, and Clear all. */
|
|
24
|
+
export default function QueryAppliedBar(props: QueryAppliedBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QueryBuilderText } from "@webority/ui-elements/text";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type QueryCondition, type QueryField, type QueryPath } from "../queryBuilder/queryTypes.ts";
|
|
4
|
+
export interface QueryConditionRowProps {
|
|
5
|
+
condition: QueryCondition;
|
|
6
|
+
path: QueryPath;
|
|
7
|
+
fields: readonly QueryField[];
|
|
8
|
+
text: QueryBuilderText;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
/** True when the condition has an issue; draws the value message. */
|
|
11
|
+
incomplete: boolean;
|
|
12
|
+
onUpdate: (path: QueryPath, patch: Partial<QueryCondition>) => void;
|
|
13
|
+
onRemove: (path: QueryPath) => void;
|
|
14
|
+
}
|
|
15
|
+
/** One condition as a row of the rule panel: field, operator, value and its remove button. */
|
|
16
|
+
export default function QueryConditionRow({ condition, path, fields, text, disabled, incomplete, onUpdate, onRemove, }: QueryConditionRowProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { QueryBuilderText } from "@webority/ui-elements/text";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { QueryCondition, QueryField, QueryGroup, QueryGroupOp, QueryPath } from "../queryBuilder/queryTypes.ts";
|
|
4
|
+
export interface QueryGroupEditProps {
|
|
5
|
+
fields: readonly QueryField[];
|
|
6
|
+
/** Already capped at MAX_QUERY_DEPTH. */
|
|
7
|
+
maxDepth: number;
|
|
8
|
+
text: QueryBuilderText;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
/** pathKey of each condition with an issue. */
|
|
11
|
+
incompletePaths: readonly string[];
|
|
12
|
+
onUpdate: (path: QueryPath, patch: Partial<QueryCondition>) => void;
|
|
13
|
+
/** Removes the condition or the group at the path. */
|
|
14
|
+
onRemove: (path: QueryPath) => void;
|
|
15
|
+
onAddCondition: (groupPath: QueryPath) => void;
|
|
16
|
+
onAddGroup: (groupPath: QueryPath) => void;
|
|
17
|
+
onSetOp: (groupPath: QueryPath, op: QueryGroupOp) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface QueryGroupBoxProps extends QueryGroupEditProps {
|
|
20
|
+
group: QueryGroup;
|
|
21
|
+
/** `[]` for the root group. */
|
|
22
|
+
path: QueryPath;
|
|
23
|
+
/** 1 for the root group. */
|
|
24
|
+
depth: number;
|
|
25
|
+
}
|
|
26
|
+
/** One group of the rule panel: the Match all or any header, its rows and nested groups, and the add buttons. */
|
|
27
|
+
export default function QueryGroupBox({ group, path, depth, fields, maxDepth, text, disabled, incompletePaths, onUpdate, onRemove, onAddCondition, onAddGroup, onSetOp, }: QueryGroupBoxProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { QueryGroup } from "../queryBuilder/queryTypes.ts";
|
|
3
|
+
import { type QueryGroupEditProps } from "./QueryGroupBox.tsx";
|
|
4
|
+
export interface QueryRulePanelProps extends QueryGroupEditProps {
|
|
5
|
+
draft: QueryGroup;
|
|
6
|
+
/** The id the panel's title carries; the popover is labelled by it. */
|
|
7
|
+
titleId: string;
|
|
8
|
+
/** The line shown in the footer when no condition is incomplete. */
|
|
9
|
+
summary: string;
|
|
10
|
+
incompleteCount: number;
|
|
11
|
+
canApply: boolean;
|
|
12
|
+
/** Empties the draft; nothing is reported until Apply. */
|
|
13
|
+
onClear: () => void;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
onApply: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** The body of the rule panel: title and close, the scrolling root group, and the footer with Clear all, Cancel and Apply. */
|
|
18
|
+
export default function QueryRulePanel({ draft, titleId, summary, incompleteCount, canApply, onClear, onCancel, onApply, fields, maxDepth, text, disabled, incompletePaths, onUpdate, onRemove, onAddCondition, onAddGroup, onSetOp, }: QueryRulePanelProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { QueryBuilderText } from "@webority/ui-elements/text";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type QueryField, type QueryOperator, type QueryValue } from "../queryBuilder/queryTypes.ts";
|
|
4
|
+
export interface QueryValueInputProps {
|
|
5
|
+
field: QueryField;
|
|
6
|
+
operator: QueryOperator;
|
|
7
|
+
value: QueryValue;
|
|
8
|
+
text: QueryBuilderText;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
onChange: (value: QueryValue) => void;
|
|
11
|
+
/** Marks the controls invalid for assistive technology and the theme. */
|
|
12
|
+
invalid?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** The value editor for one (field, operator) pair. An `isEmpty` condition has no value, so it draws nothing. */
|
|
15
|
+
export default function QueryValueInput({ field, operator, value, text, disabled, invalid, onChange, }: QueryValueInputProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type QueryBuilderText } from "@webority/ui-elements/text";
|
|
2
|
+
import type { QueryCondition, QueryDuration, QueryDurationUnit, QueryField, QueryFieldKind, QueryGroup, QueryNode, QueryOperator, QueryPath, QueryRange, QueryValue } from "../queryBuilder/queryTypes.ts";
|
|
3
|
+
export interface ChipParts {
|
|
4
|
+
field: string;
|
|
5
|
+
operator: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function operatorLabel(operator: QueryOperator, kind: QueryFieldKind, text: QueryBuilderText): string;
|
|
9
|
+
export declare function unitLabel(unit: QueryDurationUnit, text: QueryBuilderText): string;
|
|
10
|
+
/** yyyy-MM-dd to DD-MMM-YYYY with fixed English month names; null when the text is not a calendar date. */
|
|
11
|
+
export declare function formatDate(isoDate: string): string | null;
|
|
12
|
+
/** Integer paise to "₹1,00,000"; two decimals only when the paise are not a whole rupee. Null when not a safe integer. */
|
|
13
|
+
export declare function formatMoney(paise: number): string | null;
|
|
14
|
+
export declare function isRange(value: QueryValue): value is QueryRange;
|
|
15
|
+
export declare function isDuration(value: QueryValue): value is QueryDuration;
|
|
16
|
+
/** The three display parts of a condition chip. A missing field shows its key. */
|
|
17
|
+
export declare function chipParts(condition: QueryCondition, field: QueryField | undefined, text: QueryBuilderText): ChipParts;
|
|
18
|
+
/** The DOM and state form of a QueryPath: indexes joined by dots; the root group is the empty string. */
|
|
19
|
+
export declare const pathKey: (path: QueryPath) => string;
|
|
20
|
+
/**
|
|
21
|
+
* One node as words. A condition reads "Field operator value". A group reads its members joined by its
|
|
22
|
+
* and or or word, with a group inside it in parentheses.
|
|
23
|
+
*/
|
|
24
|
+
export declare function clauseText(node: QueryNode, fields: readonly QueryField[], text: QueryBuilderText): string;
|
|
25
|
+
/**
|
|
26
|
+
* The line under the panel for a rule with no incomplete condition: the empty sentence for no conditions,
|
|
27
|
+
* the whole rule as a sentence up to two group levels, and the counts ("4 conditions in 3 groups") at three.
|
|
28
|
+
*/
|
|
29
|
+
export declare function querySummary(query: QueryGroup, fields: readonly QueryField[], text: QueryBuilderText): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TransferSide } from "./transferState.ts";
|
|
2
|
+
export type TransferKeyAction = {
|
|
3
|
+
type: "move";
|
|
4
|
+
to: "next" | "prev" | "first" | "last";
|
|
5
|
+
} | {
|
|
6
|
+
type: "tick";
|
|
7
|
+
} | {
|
|
8
|
+
type: "transfer";
|
|
9
|
+
direction: "toChosen" | "toAvailable";
|
|
10
|
+
} | {
|
|
11
|
+
type: "pickUp";
|
|
12
|
+
} | {
|
|
13
|
+
type: "drop";
|
|
14
|
+
} | {
|
|
15
|
+
type: "cancelPickUp";
|
|
16
|
+
} | {
|
|
17
|
+
type: "nudge";
|
|
18
|
+
delta: -1 | 1 | "first" | "last";
|
|
19
|
+
} | {
|
|
20
|
+
type: "crossList";
|
|
21
|
+
to: TransferSide;
|
|
22
|
+
} | {
|
|
23
|
+
type: "focusList";
|
|
24
|
+
side: TransferSide;
|
|
25
|
+
} | {
|
|
26
|
+
type: "none";
|
|
27
|
+
};
|
|
28
|
+
export interface TransferKeyContext {
|
|
29
|
+
side: TransferSide;
|
|
30
|
+
layout: "arrows" | "rows";
|
|
31
|
+
pickedUp: boolean;
|
|
32
|
+
reorderable: boolean;
|
|
33
|
+
rowDisabled: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface TransferKeyInput {
|
|
36
|
+
key: string;
|
|
37
|
+
shiftKey?: boolean;
|
|
38
|
+
altKey?: boolean;
|
|
39
|
+
ctrlKey?: boolean;
|
|
40
|
+
metaKey?: boolean;
|
|
41
|
+
isComposing?: boolean;
|
|
42
|
+
keyCode?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare function transferKeyAction(input: TransferKeyInput, ctx: TransferKeyContext): TransferKeyAction;
|