@grucloud/bau-ui 0.60.0 → 0.61.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/autocomplete/autocomplete.js +8 -5
- package/modal/index.d.ts +3 -1
- package/modal/modal.js +25 -2
- package/package.json +4 -4
|
@@ -115,7 +115,6 @@ export default function (context, componentOptions = {}) {
|
|
|
115
115
|
const dialogClose = () => {
|
|
116
116
|
popoverEl.closeDialog();
|
|
117
117
|
openState.val = false;
|
|
118
|
-
inputState.val = "";
|
|
119
118
|
itemIndexActive.val = 0;
|
|
120
119
|
};
|
|
121
120
|
|
|
@@ -135,10 +134,15 @@ export default function (context, componentOptions = {}) {
|
|
|
135
134
|
popoverEl.open ? dialogClose() : dialogOpen();
|
|
136
135
|
};
|
|
137
136
|
|
|
137
|
+
const saveOption = (option) => {
|
|
138
|
+
selectedState.val = option;
|
|
139
|
+
inputShadowEl.value = getOptionValue(option);
|
|
140
|
+
};
|
|
141
|
+
|
|
138
142
|
const onclickItem =
|
|
139
143
|
({ option, index }) =>
|
|
140
144
|
(event) => {
|
|
141
|
-
|
|
145
|
+
saveOption(option);
|
|
142
146
|
itemIndexActive.val = index;
|
|
143
147
|
dialogClose();
|
|
144
148
|
};
|
|
@@ -173,8 +177,7 @@ export default function (context, componentOptions = {}) {
|
|
|
173
177
|
break;
|
|
174
178
|
case "Enter":
|
|
175
179
|
if (popoverEl.open) {
|
|
176
|
-
|
|
177
|
-
inputState.val = "";
|
|
180
|
+
saveOption(optionsFilteredState.val[itemIndexActive.val]);
|
|
178
181
|
dialogClose();
|
|
179
182
|
} else {
|
|
180
183
|
dialogOpen();
|
|
@@ -227,7 +230,7 @@ export default function (context, componentOptions = {}) {
|
|
|
227
230
|
position: absolute;
|
|
228
231
|
`,
|
|
229
232
|
tabindex: -1,
|
|
230
|
-
|
|
233
|
+
defaultValue: defaultOption && getOptionValue(defaultOption),
|
|
231
234
|
required,
|
|
232
235
|
name,
|
|
233
236
|
});
|
package/modal/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ declare module "@grucloud/bau-ui/modal" {
|
|
|
2
2
|
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
3
|
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
4
|
|
|
5
|
-
export type ModalProps = {
|
|
5
|
+
export type ModalProps = {
|
|
6
|
+
id: string;
|
|
7
|
+
} & DefaultDesignProps;
|
|
6
8
|
|
|
7
9
|
type Component = import("../bau-ui").Component<ModalProps, HTMLDialogElement>;
|
|
8
10
|
|
package/modal/modal.js
CHANGED
|
@@ -3,7 +3,7 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
|
3
3
|
import { Colors } from "../constants.js";
|
|
4
4
|
|
|
5
5
|
export default function (context, options = {}) {
|
|
6
|
-
const { bau, css } = context;
|
|
6
|
+
const { bau, css, window } = context;
|
|
7
7
|
const { dialog, div } = bau.tags;
|
|
8
8
|
|
|
9
9
|
const colorsToCss = () =>
|
|
@@ -78,8 +78,16 @@ export default function (context, options = {}) {
|
|
|
78
78
|
...children
|
|
79
79
|
] = toPropsAndChildren(args);
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
const dialogEl = dialog(
|
|
82
82
|
{
|
|
83
|
+
...props,
|
|
84
|
+
bauMounted: () => {
|
|
85
|
+
const search = new URLSearchParams(window.location.search);
|
|
86
|
+
const modalId = search.get("modal");
|
|
87
|
+
if (modalId == (props.id ?? "modal")) {
|
|
88
|
+
dialogEl.showModal();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
83
91
|
class: classNames(
|
|
84
92
|
"modal",
|
|
85
93
|
className,
|
|
@@ -92,5 +100,20 @@ export default function (context, options = {}) {
|
|
|
92
100
|
},
|
|
93
101
|
div(children)
|
|
94
102
|
);
|
|
103
|
+
|
|
104
|
+
const observer = new MutationObserver((events) => {
|
|
105
|
+
const search = new URLSearchParams(window.location.search);
|
|
106
|
+
if (events[0].attributeName == "open") {
|
|
107
|
+
if (dialogEl.open) {
|
|
108
|
+
search.set("modal", dialogEl.id ?? "modal");
|
|
109
|
+
} else {
|
|
110
|
+
search.delete("modal");
|
|
111
|
+
}
|
|
112
|
+
window.history.pushState("", "", `?${search.toString()}`);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
observer.observe(dialogEl, { attributes: true });
|
|
116
|
+
|
|
117
|
+
return dialogEl;
|
|
95
118
|
};
|
|
96
119
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grucloud/bau-ui",
|
|
3
3
|
"description": "Components library built with Bau",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.61.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"directory": "bau-ui"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grucloud/bau": "^0.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.61.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.61.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "0cf66900b8223139cfa88414fe562887aefe0e0f"
|
|
30
30
|
}
|