@grucloud/bau-ui 0.62.0 → 0.63.1
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/animate/animate.js +31 -27
- package/checkbox/checkbox.js +1 -0
- package/drillDownMenu/drillDownMenu.js +48 -38
- package/form/form.js +0 -2
- package/globalStyle/globalStyle.js +4 -0
- package/modal/modal.js +2 -0
- package/package.json +4 -4
- package/paper/paper.js +1 -0
- package/radioButton/radioButton.js +1 -0
package/animate/animate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
2
|
|
|
3
3
|
export default function (context, options = {}) {
|
|
4
|
-
const { bau } = context;
|
|
4
|
+
const { bau, window } = context;
|
|
5
5
|
const { div } = bau.tags;
|
|
6
6
|
const noop = () => undefined;
|
|
7
7
|
|
|
@@ -17,36 +17,40 @@ export default function (context, options = {}) {
|
|
|
17
17
|
[...record.removedNodes].forEach((childNode) => {
|
|
18
18
|
if (!animationHide() || childNode.getAttribute("cloned")) return;
|
|
19
19
|
const nodeCloned = childNode.cloneNode(true);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
nodeCloned.
|
|
30
|
-
|
|
20
|
+
window.requestAnimationFrame(() => {
|
|
21
|
+
nodeCloned.setAttribute("cloned", true);
|
|
22
|
+
nodeCloned.style.top = 0;
|
|
23
|
+
nodeCloned.style.left = 0;
|
|
24
|
+
nodeCloned.style.width = childNode.getAttribute("width");
|
|
25
|
+
nodeCloned.style.height = childNode.getAttribute("height");
|
|
26
|
+
nodeCloned.style.position = "absolute";
|
|
27
|
+
nodeCloned.style.animation = animationHide();
|
|
28
|
+
record.target.appendChild(nodeCloned);
|
|
29
|
+
nodeCloned.addEventListener("animationend", () =>
|
|
30
|
+
nodeCloned.parentNode?.removeChild(nodeCloned)
|
|
31
|
+
);
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
// Added Nodes
|
|
33
35
|
[...record.addedNodes].forEach((childNode) => {
|
|
34
36
|
if (childNode.getAttribute("cloned")) return;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
window.requestAnimationFrame(() => {
|
|
38
|
+
element.style.position = "relative";
|
|
39
|
+
const rect = childNode.getBoundingClientRect();
|
|
40
|
+
childNode.setAttribute("width", rect.width + "px");
|
|
41
|
+
childNode.setAttribute("height", rect.height + "px");
|
|
42
|
+
if (animationShow()) {
|
|
43
|
+
childNode.style.animation = animationShow();
|
|
44
|
+
const animationEndHandler = () => {
|
|
45
|
+
childNode.removeEventListener(
|
|
46
|
+
"animationend",
|
|
47
|
+
animationEndHandler
|
|
48
|
+
);
|
|
49
|
+
childNode.style.animation = "";
|
|
50
|
+
};
|
|
51
|
+
childNode.addEventListener("animationend", animationEndHandler);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
50
54
|
});
|
|
51
55
|
},
|
|
52
56
|
...props,
|
package/checkbox/checkbox.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
1
|
import cn from "@grucloud/bau-css/classNames.js";
|
|
3
2
|
import animate from "../animate/animate.js";
|
|
4
3
|
import button from "../button/button.js";
|
|
@@ -200,8 +199,6 @@ export default function (context, options = {}) {
|
|
|
200
199
|
|
|
201
200
|
const Menu = ({ variant, color, size, currentTree, pathnameState }) => {
|
|
202
201
|
const { children, parentTree, data, renderList } = currentTree;
|
|
203
|
-
if (renderList) {
|
|
204
|
-
}
|
|
205
202
|
return div(
|
|
206
203
|
{ class: cn("drillDownMenu", variant, color, size) },
|
|
207
204
|
parentTree && renderHeader({ variant, color, size, data, currentTree }),
|
|
@@ -222,7 +219,7 @@ export default function (context, options = {}) {
|
|
|
222
219
|
let currentTree = treeAddParent({})({ ...tree });
|
|
223
220
|
let subTree = findSubTree(pathname)(currentTree);
|
|
224
221
|
if (!subTree) {
|
|
225
|
-
//
|
|
222
|
+
//console.error("drilldown no sub tree", pathname);
|
|
226
223
|
subTree = currentTree;
|
|
227
224
|
}
|
|
228
225
|
return subTree;
|
|
@@ -232,23 +229,14 @@ export default function (context, options = {}) {
|
|
|
232
229
|
window.location.pathname.replace(baseUrl, "")
|
|
233
230
|
);
|
|
234
231
|
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
if (
|
|
239
|
-
target.
|
|
240
|
-
href &&
|
|
241
|
-
!href.startsWith("http") &&
|
|
242
|
-
!href.startsWith("#") &&
|
|
243
|
-
!href.startsWith("?")
|
|
244
|
-
) {
|
|
245
|
-
let path = href.replace(baseUrl, "");
|
|
246
|
-
if (!hashBased) {
|
|
247
|
-
path = path.replace(target.hash, "");
|
|
248
|
-
}
|
|
249
|
-
pathnameState.val = path;
|
|
232
|
+
const pathFromHref = ({ target }) => {
|
|
233
|
+
const href = target.closest("a").getAttribute("href");
|
|
234
|
+
let path = href.replace(baseUrl, "");
|
|
235
|
+
if (!hashBased) {
|
|
236
|
+
path = path.replace(target.hash, "");
|
|
250
237
|
}
|
|
251
|
-
|
|
238
|
+
return path;
|
|
239
|
+
};
|
|
252
240
|
|
|
253
241
|
return function DrillDownMenu(props) {
|
|
254
242
|
const {
|
|
@@ -258,25 +246,47 @@ export default function (context, options = {}) {
|
|
|
258
246
|
tree,
|
|
259
247
|
...otherProps
|
|
260
248
|
} = props;
|
|
261
|
-
|
|
262
|
-
let
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
pathname: pathnameState.val,
|
|
266
|
-
});
|
|
267
|
-
return _currentTree;
|
|
249
|
+
|
|
250
|
+
let _currentTree = findInitialTree({
|
|
251
|
+
tree,
|
|
252
|
+
pathname: pathnameState.val,
|
|
268
253
|
});
|
|
269
254
|
|
|
270
|
-
let
|
|
255
|
+
let _direction;
|
|
256
|
+
window.document.addEventListener("click", (event) => {
|
|
257
|
+
const { target } = event;
|
|
258
|
+
const anchor = target.closest("a");
|
|
259
|
+
if (!anchor) return;
|
|
260
|
+
const href = anchor.getAttribute("href");
|
|
261
|
+
|
|
262
|
+
if (
|
|
263
|
+
href &&
|
|
264
|
+
!href.startsWith("http") &&
|
|
265
|
+
!href.startsWith("#") &&
|
|
266
|
+
!href.startsWith("?")
|
|
267
|
+
) {
|
|
268
|
+
_currentTree = findInitialTree({
|
|
269
|
+
tree,
|
|
270
|
+
pathname: pathFromHref(event),
|
|
271
|
+
});
|
|
272
|
+
console.log("direction", _direction);
|
|
273
|
+
|
|
274
|
+
const { ischild } = event.target.dataset;
|
|
275
|
+
|
|
276
|
+
if (ischild !== "true") {
|
|
277
|
+
pathnameState.val = pathFromHref({ target });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
271
281
|
|
|
272
282
|
const onclick = (event) => {
|
|
273
|
-
const {
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
} else if (
|
|
277
|
-
|
|
278
|
-
} else if (
|
|
279
|
-
|
|
283
|
+
const { buttonback, ischild } = event.target.dataset;
|
|
284
|
+
if (buttonback == "true") {
|
|
285
|
+
_direction = -1;
|
|
286
|
+
} else if (ischild == "false") {
|
|
287
|
+
_direction = 1;
|
|
288
|
+
} else if (ischild == "true") {
|
|
289
|
+
_direction = 0;
|
|
280
290
|
}
|
|
281
291
|
};
|
|
282
292
|
|
|
@@ -316,11 +326,11 @@ export default function (context, options = {}) {
|
|
|
316
326
|
},
|
|
317
327
|
Animate(
|
|
318
328
|
{
|
|
319
|
-
animationHide: () => animationHide(
|
|
320
|
-
animationShow: () => animationShow(
|
|
329
|
+
animationHide: () => animationHide(_direction),
|
|
330
|
+
animationShow: () => animationShow(_direction),
|
|
321
331
|
},
|
|
322
332
|
bau.bind({
|
|
323
|
-
deps: [
|
|
333
|
+
deps: [pathnameState],
|
|
324
334
|
render: () => () =>
|
|
325
335
|
Menu({
|
|
326
336
|
variant,
|
package/form/form.js
CHANGED
package/modal/modal.js
CHANGED
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.63.1",
|
|
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.63.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.63.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "d83473dc2d988c6e4d1c2d589c65c9e52605f4cd"
|
|
30
30
|
}
|
package/paper/paper.js
CHANGED