@openproject/primer-view-components 0.78.0 → 0.78.1-rc.e0961ba5b
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/app/assets/javascripts/components/primer/alpha/tree_view/tree_view.d.ts +1 -0
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/components/primer/alpha/tree_view/tree_view.d.ts +1 -0
- package/app/components/primer/alpha/tree_view/tree_view.js +23 -16
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ export declare class TreeViewElement extends HTMLElement {
|
|
|
38
38
|
changeSelectStrategy(newStrategy: SelectStrategy): void;
|
|
39
39
|
infoFromNode(node: Element, newCheckedValue?: TreeViewCheckedValue): TreeViewNodeInfo | null;
|
|
40
40
|
selectVariant(node: Element): SelectVariant;
|
|
41
|
+
updateHiddenFormInputs(): void;
|
|
41
42
|
}
|
|
42
43
|
declare global {
|
|
43
44
|
interface Window {
|
|
@@ -56,28 +56,17 @@ let TreeViewElement = class TreeViewElement extends HTMLElement {
|
|
|
56
56
|
});
|
|
57
57
|
if (!somethingChanged)
|
|
58
58
|
return;
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line custom-elements/no-dom-traversal-in-connectedcallback
|
|
61
|
-
for (const node of this.querySelectorAll('[role=treeitem][aria-checked=true]')) {
|
|
62
|
-
const newInput = this.formInputPrototype.cloneNode();
|
|
63
|
-
newInput.removeAttribute('data-target');
|
|
64
|
-
newInput.removeAttribute('form');
|
|
65
|
-
const payload = {
|
|
66
|
-
path: this.getNodePath(node),
|
|
67
|
-
};
|
|
68
|
-
const inputValue = this.getFormInputValueForNode(node);
|
|
69
|
-
if (inputValue)
|
|
70
|
-
payload.value = inputValue;
|
|
71
|
-
newInput.value = JSON.stringify(payload);
|
|
72
|
-
newInputs.push(newInput);
|
|
73
|
-
}
|
|
74
|
-
this.formInputContainer.replaceChildren(...newInputs);
|
|
59
|
+
this.updateHiddenFormInputs();
|
|
75
60
|
});
|
|
76
61
|
updateInputsObserver.observe(this, {
|
|
77
62
|
childList: true,
|
|
78
63
|
subtree: true,
|
|
79
64
|
attributeFilter: ['aria-checked'],
|
|
80
65
|
});
|
|
66
|
+
// Correctly initialize the form
|
|
67
|
+
if (this.formInputContainer) {
|
|
68
|
+
this.updateHiddenFormInputs();
|
|
69
|
+
}
|
|
81
70
|
// eslint-disable-next-line github/no-then -- We don't want to wait for this to resolve, just get on with it
|
|
82
71
|
customElements.whenDefined('tree-view-sub-tree-node').then(() => {
|
|
83
72
|
// depends on TreeViewSubTreeNodeElement#eachAncestorSubTreeNode, which may not be defined yet
|
|
@@ -287,6 +276,24 @@ let TreeViewElement = class TreeViewElement extends HTMLElement {
|
|
|
287
276
|
selectVariant(node) {
|
|
288
277
|
return (node.getAttribute('data-select-variant') || 'none');
|
|
289
278
|
}
|
|
279
|
+
updateHiddenFormInputs() {
|
|
280
|
+
const newInputs = [];
|
|
281
|
+
// eslint-disable-next-line custom-elements/no-dom-traversal-in-connectedcallback
|
|
282
|
+
for (const node of this.querySelectorAll('[role=treeitem][aria-checked=true]')) {
|
|
283
|
+
const newInput = this.formInputPrototype.cloneNode();
|
|
284
|
+
newInput.removeAttribute('data-target');
|
|
285
|
+
newInput.removeAttribute('form');
|
|
286
|
+
const payload = {
|
|
287
|
+
path: this.getNodePath(node),
|
|
288
|
+
};
|
|
289
|
+
const inputValue = this.getFormInputValueForNode(node);
|
|
290
|
+
if (inputValue)
|
|
291
|
+
payload.value = inputValue;
|
|
292
|
+
newInput.value = JSON.stringify(payload);
|
|
293
|
+
newInputs.push(newInput);
|
|
294
|
+
}
|
|
295
|
+
this.formInputContainer.replaceChildren(...newInputs);
|
|
296
|
+
}
|
|
290
297
|
};
|
|
291
298
|
_TreeViewElement_abortController = new WeakMap();
|
|
292
299
|
_TreeViewElement_instances = new WeakSet();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openproject/primer-view-components",
|
|
3
|
-
"version": "0.78.
|
|
3
|
+
"version": "0.78.1-rc.e0961ba5b",
|
|
4
4
|
"description": "ViewComponents of the Primer Design System for OpenProject",
|
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
|
6
6
|
"module": "app/components/primer/primer.js",
|