@homebound/beam 2.331.1 → 2.332.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/components/Table/utils/ColumnState.js +6 -0
- package/dist/components/Table/utils/ColumnStates.js +2 -0
- package/dist/forms/SubmitButton.d.ts +8 -0
- package/dist/forms/SubmitButton.js +23 -0
- package/dist/inputs/TreeSelectField/TreeSelectField.js +2 -0
- package/dist/inputs/index.d.ts +1 -0
- package/dist/inputs/index.js +1 -0
- package/dist/inputs/internal/ComboBoxBase.js +2 -0
- package/package.json +3 -3
|
@@ -22,6 +22,8 @@ class ColumnState {
|
|
|
22
22
|
this.visible = (_a = storage.wasVisible(column.id)) !== null && _a !== void 0 ? _a : (column.canHide ? (_b = column.initVisible) !== null && _b !== void 0 ? _b : false : true);
|
|
23
23
|
if (this.visible && ((_c = storage.wasExpanded(column.id)) !== null && _c !== void 0 ? _c : column.initExpanded)) {
|
|
24
24
|
this.expanded = true;
|
|
25
|
+
// TODO: verify this eslint ignore
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
25
27
|
this.doExpand();
|
|
26
28
|
}
|
|
27
29
|
(0, mobx_1.makeAutoObservable)(this, { column: mobx_1.observable.ref }, { name: `ColumnState@${column.id}` });
|
|
@@ -32,6 +34,8 @@ class ColumnState {
|
|
|
32
34
|
// If an expandable header is becoming visible for the 1st time, expand it
|
|
33
35
|
if (!wasVisible && visible && this.column.initExpanded && this.children === undefined) {
|
|
34
36
|
this.expanded = true;
|
|
37
|
+
// TODO: verify this eslint ignore
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
35
39
|
this.doExpand();
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -44,6 +48,8 @@ class ColumnState {
|
|
|
44
48
|
// The first time we expand, fetch our children. Note that ExpandableHeader
|
|
45
49
|
// technically pre-loads our children, so it can show a spinner while loading,
|
|
46
50
|
// and only after loading is complete, tell our column to expand.
|
|
51
|
+
// TODO: verify this eslint ignore
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
47
53
|
if (!wasExpanded)
|
|
48
54
|
this.doExpand();
|
|
49
55
|
}
|
|
@@ -44,6 +44,8 @@ class ColumnStates {
|
|
|
44
44
|
else {
|
|
45
45
|
existing.column = column;
|
|
46
46
|
// Any time a column is re-added (i.e. props.columns changed), re-expand it
|
|
47
|
+
// TODO: verify this eslint ignore
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
47
49
|
if (existing.isExpanded)
|
|
48
50
|
existing.doExpand(true);
|
|
49
51
|
return existing;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ObjectState } from "@homebound/form-state";
|
|
2
|
+
import { ButtonProps } from "..";
|
|
3
|
+
export type SubmitButtonProps<T> = Omit<ButtonProps, "label"> & {
|
|
4
|
+
label?: ButtonProps["label"];
|
|
5
|
+
form: ObjectState<T>;
|
|
6
|
+
};
|
|
7
|
+
/** Provides a Button that will auto-disable if `formState` is invalid. */
|
|
8
|
+
export declare function SubmitButton<T>(props: SubmitButtonProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubmitButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const src_1 = require("..");
|
|
6
|
+
/** Provides a Button that will auto-disable if `formState` is invalid. */
|
|
7
|
+
function SubmitButton(props) {
|
|
8
|
+
const { form, disabled, onClick, label = "Submit", ...others } = props;
|
|
9
|
+
if (typeof onClick === "string") {
|
|
10
|
+
throw new Error("SubmitButton.onClick doesn't support strings yet");
|
|
11
|
+
}
|
|
12
|
+
// Enable the button whenever the form is dirty, even if the form is partially invalid,
|
|
13
|
+
// because submitting will then force-touch all fields and show all errors instead of
|
|
14
|
+
// just errors-so-far.
|
|
15
|
+
const dirty = (0, src_1.useComputed)(() => form.dirty, [form]);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(src_1.Button, { label: label, disabled: disabled || !dirty, onClick: (e) => {
|
|
17
|
+
// canSave will touch any not-yet-keyed-in fields to show errors
|
|
18
|
+
if (form.canSave()) {
|
|
19
|
+
void onClick(e);
|
|
20
|
+
}
|
|
21
|
+
}, ...others }));
|
|
22
|
+
}
|
|
23
|
+
exports.SubmitButton = SubmitButton;
|
|
@@ -182,6 +182,8 @@ function TreeSelectFieldBase(props) {
|
|
|
182
182
|
const firstOpen = (0, react_1.useRef)(true);
|
|
183
183
|
function onOpenChange(isOpen) {
|
|
184
184
|
if (firstOpen.current && isOpen) {
|
|
185
|
+
// TODO: verify this eslint ignore
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
185
187
|
maybeInitLoad(options, fieldState, setFieldState);
|
|
186
188
|
firstOpen.current = false;
|
|
187
189
|
}
|
package/dist/inputs/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./Checkbox";
|
|
|
3
3
|
export * from "./CheckboxGroup";
|
|
4
4
|
export * from "./ChipSelectField";
|
|
5
5
|
export * from "./DateFields";
|
|
6
|
+
export * from "./ErrorMessage";
|
|
6
7
|
export * from "./MultiLineSelectField";
|
|
7
8
|
export * from "./MultiSelectField";
|
|
8
9
|
export * from "./NumberField";
|
package/dist/inputs/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./Checkbox"), exports);
|
|
|
20
20
|
__exportStar(require("./CheckboxGroup"), exports);
|
|
21
21
|
__exportStar(require("./ChipSelectField"), exports);
|
|
22
22
|
__exportStar(require("./DateFields"), exports);
|
|
23
|
+
__exportStar(require("./ErrorMessage"), exports);
|
|
23
24
|
__exportStar(require("./MultiLineSelectField"), exports);
|
|
24
25
|
__exportStar(require("./MultiSelectField"), exports);
|
|
25
26
|
__exportStar(require("./NumberField"), exports);
|
|
@@ -106,6 +106,8 @@ function ComboBoxBase(props) {
|
|
|
106
106
|
const firstOpen = (0, react_1.useRef)(true);
|
|
107
107
|
function onOpenChange(isOpen) {
|
|
108
108
|
if (firstOpen.current && isOpen) {
|
|
109
|
+
// TODO: verify this eslint ignore
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
109
111
|
maybeInitLoad();
|
|
110
112
|
firstOpen.current = false;
|
|
111
113
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebound/beam",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.332.0",
|
|
4
4
|
"author": "Homebound",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@emotion/babel-preset-css-prop": "^11.10.0",
|
|
76
76
|
"@emotion/jest": "^11.10.5",
|
|
77
77
|
"@emotion/react": "^11.10.6",
|
|
78
|
-
"@homebound/eslint-config": "^1.
|
|
78
|
+
"@homebound/eslint-config": "^1.10.2",
|
|
79
79
|
"@homebound/rtl-react-router-utils": "1.0.3",
|
|
80
80
|
"@homebound/rtl-utils": "^2.65.0",
|
|
81
81
|
"@homebound/truss": "^1.132.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"babel-loader": "^8.2.2",
|
|
109
109
|
"chromatic": "^6.17.0",
|
|
110
110
|
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
111
|
-
"eslint": "^8.
|
|
111
|
+
"eslint": "^8.52.0",
|
|
112
112
|
"eslint-plugin-storybook": "^0.6.14",
|
|
113
113
|
"husky": "^5.1.1",
|
|
114
114
|
"identity-obj-proxy": "^3.0.0",
|