mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
new CollapsibleSectionContainer WIP
This commit is contained in:
parent
3d808d638a
commit
435200ec5a
132
package-lock.json
generated
132
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.45.1",
|
||||
"version": "0.45.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -586,11 +586,6 @@
|
||||
"defer-to-connect": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"@tokenizer/token": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.1.1.tgz",
|
||||
"integrity": "sha512-XO6INPbZCxdprl+9qa/AAbFFOMzzwqYxpjPgLICrMD6C2FCw6qfJOPcBk6JqqPLSaZ/Qx87qn4rpPmPMwaAK6w=="
|
||||
},
|
||||
"@tootallnate/once": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz",
|
||||
@ -611,7 +606,8 @@
|
||||
"@types/debug": {
|
||||
"version": "4.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz",
|
||||
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ=="
|
||||
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/eslint": {
|
||||
"version": "7.2.4",
|
||||
@ -1347,9 +1343,9 @@
|
||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.20.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
|
||||
"integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
|
||||
"version": "0.21.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
|
||||
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
@ -1828,9 +1824,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001148",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz",
|
||||
"integrity": "sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw==",
|
||||
"version": "1.0.30001154",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001154.tgz",
|
||||
"integrity": "sha512-y9DvdSti8NnYB9Be92ddMZQrcOe04kcQtcxtBx4NkB04+qZ+JUWotnXBJTmxlKudhxNTQ3RRknMwNU2YQl/Org==",
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
@ -2384,9 +2380,9 @@
|
||||
}
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.9.3.tgz",
|
||||
"integrity": "sha512-V+1SyIvkS+HmNbN1G7A9+ERbFTV9KTXu6Oor98v2xHmzzpp52OIJhQuJSTywWuBY5pyAEmlwbCi1Me87n/SLOw=="
|
||||
"version": "1.9.4",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.9.4.tgz",
|
||||
"integrity": "sha512-ABSF3alrldf7nM9sQ2U+Ln67NRwmzlLOqG7kK03kck0mw3wlSSEKv/XhKGGxUjQcS57QeiCyNdrFgtj9nWlrng=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
@ -3232,9 +3228,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.582",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.582.tgz",
|
||||
"integrity": "sha512-0nCJ7cSqnkMC+kUuPs0YgklFHraWGl/xHqtZWWtOeVtyi+YqkoAOMGuZQad43DscXCQI/yizcTa3u6B5r+BLww==",
|
||||
"version": "1.3.584",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.584.tgz",
|
||||
"integrity": "sha512-NB3DzrTzJFhWkUp+nl2KtUtoFzrfGXTir2S+BU4tXGyXH9vlluPuFpE3pTKeH7+PY460tHLjKzh6K2+TWwW+Ww==",
|
||||
"dev": true
|
||||
},
|
||||
"electron-window-state": {
|
||||
@ -3273,9 +3269,9 @@
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.2.0.tgz",
|
||||
"integrity": "sha512-NZlGLl8DxmZoq0uqPPtJfsCAir68uR047+Udsh1FH4+5ydGQdMurn/A430A1BtxASVmMEuS7/XiJ5OxJ9apAzQ==",
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.3.1.tgz",
|
||||
"integrity": "sha512-G1XD3MRGrGfNcf6Hg0LVZG7GIKcYkbfHa5QMxt1HDUTdYoXH0JR1xXyg+MaKLF73E9A27uWNVxvFivNRYeUB6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
@ -3680,17 +3676,6 @@
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
},
|
||||
"file-type": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.0.0.tgz",
|
||||
"integrity": "sha512-0u4D11yDu0NXF+8qp1eiQ/6cOwPI7sbu9/bGzUOhlwzKbB9FYFivgTtsVPtlkXAakfByWjOsLp2/Jx927OVetg==",
|
||||
"requires": {
|
||||
"readable-web-to-node-stream": "^2.0.0",
|
||||
"strtok3": "^6.0.3",
|
||||
"token-types": "^2.0.0",
|
||||
"typedarray-to-buffer": "^3.1.5"
|
||||
}
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
@ -4580,9 +4565,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"jest-worker": {
|
||||
"version": "26.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.5.0.tgz",
|
||||
"integrity": "sha512-kTw66Dn4ZX7WpjZ7T/SUDgRhapFRKWmisVAF0Rv4Fu8SLFD7eLbqpLvbxVqYhSgaWa7I+bW7pHnbyfNsH6stug==",
|
||||
"version": "26.6.1",
|
||||
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.1.tgz",
|
||||
"integrity": "sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
@ -5441,9 +5426,9 @@
|
||||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.63",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.63.tgz",
|
||||
"integrity": "sha512-ukW3iCfQaoxJkSPN+iK7KznTeqDGVJatAEuXsJERYHa9tn/KaT5lBdIyxQjLEVTzSkyjJEuQ17/vaEjrOauDkg==",
|
||||
"version": "1.1.65",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.65.tgz",
|
||||
"integrity": "sha512-YpzJOe2WFIW0V4ZkJQd/DGR/zdVwc/pI4Nl1CZrBO19FdRcSTmsuhdttw9rsTzzJLrNcSloLiBbEYx1C4f6gpA==",
|
||||
"dev": true
|
||||
},
|
||||
"noop-logger": {
|
||||
@ -5882,11 +5867,6 @@
|
||||
"pify": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"peek-readable": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-3.1.0.tgz",
|
||||
"integrity": "sha512-KGuODSTV6hcgdZvDrIDBUkN0utcAVj1LL7FfGbM0viKTtCHmtZcuEJ+lGqsp0fTFkGqesdtemV2yUSMeyy3ddA=="
|
||||
},
|
||||
"pend": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||
@ -6229,11 +6209,6 @@
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"readable-web-to-node-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-+oZJurc4hXpaaqsN68GoZGQAQIA3qr09Or4fqEsargABnbe5Aau8hFn6ISVleT3cpY/0n/8drn7huyyEvTbghA=="
|
||||
},
|
||||
"rechoir": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz",
|
||||
@ -7005,16 +6980,6 @@
|
||||
"resolved": "https://registry.npmjs.org/striptags/-/striptags-3.1.1.tgz",
|
||||
"integrity": "sha1-yMPn/db7S7OjKjt1LltePjgJPr0="
|
||||
},
|
||||
"strtok3": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.0.4.tgz",
|
||||
"integrity": "sha512-rqWMKwsbN9APU47bQTMEYTPcwdpKDtmf1jVhHzNW2cL1WqAxaM9iBb9t5P2fj+RV2YsErUWgQzHD5JwV0uCTEQ==",
|
||||
"requires": {
|
||||
"@tokenizer/token": "^0.1.1",
|
||||
"@types/debug": "^4.1.5",
|
||||
"peek-readable": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
@ -7180,9 +7145,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.3.7",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.3.7.tgz",
|
||||
"integrity": "sha512-lJbKdfxWvjpV330U4PBZStCT9h3N9A4zZVA5Y4k9sCWXknrpdyxi1oMsRKLmQ/YDMDxSBKIh88v0SkdhdqX06w==",
|
||||
"version": "5.3.8",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.3.8.tgz",
|
||||
"integrity": "sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
@ -7205,17 +7170,17 @@
|
||||
}
|
||||
},
|
||||
"terser-webpack-plugin": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.0.0.tgz",
|
||||
"integrity": "sha512-rf7l5a9xamIVX3enQeTl0MY2MNeZClo5yPX/tVPy22oY0nzu0b45h7JqyFi/bygqKWtzXMnml0u12mArhQPsBQ==",
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.0.3.tgz",
|
||||
"integrity": "sha512-zFdGk8Lh9ZJGPxxPE6jwysOlATWB8GMW8HcfGULWA/nPal+3VdATflQvSBSLQJRCmYZnfFJl6vkRTiwJGNgPiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jest-worker": "^26.5.0",
|
||||
"jest-worker": "^26.6.1",
|
||||
"p-limit": "^3.0.2",
|
||||
"schema-utils": "^3.0.0",
|
||||
"serialize-javascript": "^5.0.1",
|
||||
"source-map": "^0.6.1",
|
||||
"terser": "^5.3.5"
|
||||
"terser": "^5.3.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"p-limit": {
|
||||
@ -7293,15 +7258,6 @@
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"token-types": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/token-types/-/token-types-2.0.0.tgz",
|
||||
"integrity": "sha512-WWvu8sGK8/ZmGusekZJJ5NM6rRVTTDO7/bahz4NGiSDb/XsmdYBn6a1N/bymUHuWYTWeuLUg98wUzvE4jPdCZw==",
|
||||
"requires": {
|
||||
"@tokenizer/token": "^0.1.0",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
|
||||
@ -7660,9 +7616,9 @@
|
||||
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.1.3.tgz",
|
||||
"integrity": "sha512-bNBF5EOpt5a6NeCBFu0+8KJtG61cVmOb2b/a5tPNRLz3OWgDpHMbmnDkaSm3nf/UQ6ufw4PWYGVsVOAi8UfL2A==",
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.3.2.tgz",
|
||||
"integrity": "sha512-DXsfHoI6lQAR3KnQh7+FsRfs9fs+TEvzXCA35UbKv4kVuzslg7QCMAcpFRZNDMjdtm9N/PoO54XEzGN9TeacQg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
@ -7671,11 +7627,11 @@
|
||||
"@webassemblyjs/helper-module-context": "1.9.0",
|
||||
"@webassemblyjs/wasm-edit": "1.9.0",
|
||||
"@webassemblyjs/wasm-parser": "1.9.0",
|
||||
"acorn": "^8.0.3",
|
||||
"browserslist": "^4.14.3",
|
||||
"acorn": "^8.0.4",
|
||||
"browserslist": "^4.14.5",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.2.0",
|
||||
"eslint-scope": "^5.1.0",
|
||||
"enhanced-resolve": "^5.3.1",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"events": "^3.2.0",
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
"graceful-fs": "^4.2.4",
|
||||
@ -7686,9 +7642,9 @@
|
||||
"pkg-dir": "^4.2.0",
|
||||
"schema-utils": "^3.0.0",
|
||||
"tapable": "^2.0.0",
|
||||
"terser-webpack-plugin": "^5.0.0",
|
||||
"terser-webpack-plugin": "^5.0.3",
|
||||
"watchpack": "^2.0.0",
|
||||
"webpack-sources": "^2.0.1"
|
||||
"webpack-sources": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
@ -7744,9 +7700,9 @@
|
||||
}
|
||||
},
|
||||
"webpack-sources": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.0.1.tgz",
|
||||
"integrity": "sha512-A9oYz7ANQBK5EN19rUXbvNgfdfZf5U2gP0769OXsj9CvYkCR6OHOsd6OKyEy4H38GGxpsQPKIL83NC64QY6Xmw==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.2.0.tgz",
|
||||
"integrity": "sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-list-map": "^2.0.1",
|
||||
|
@ -85,7 +85,7 @@
|
||||
"jsdoc": "3.6.6",
|
||||
"lorem-ipsum": "2.0.3",
|
||||
"rcedit": "2.2.0",
|
||||
"webpack": "5.2.0",
|
||||
"webpack": "5.3.2",
|
||||
"webpack-cli": "4.1.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
@ -24,6 +24,8 @@ import SimilarNotesWidget from "../widgets/similar_notes.js";
|
||||
import WhatLinksHereWidget from "../widgets/collapsible_widgets/what_links_here.js";
|
||||
import SidePaneToggles from "../widgets/side_pane_toggles.js";
|
||||
import EditedNotesWidget from "../widgets/collapsible_widgets/edited_notes.js";
|
||||
import CollapsibleSectionContainer from "../widgets/collapsible_section_container.js";
|
||||
import PromotedAttributesWidget from "../widgets/promoted_attributes.js";
|
||||
|
||||
const RIGHT_PANE_CSS = `
|
||||
<style>
|
||||
@ -153,7 +155,12 @@ export default class DesktopMainWindowLayout {
|
||||
.child(new NoteTypeWidget().hideInZenMode())
|
||||
.child(new NoteActionsWidget().hideInZenMode())
|
||||
)
|
||||
.child(new TabCachingWidget(() => new AttributeListWidget()))
|
||||
.child(
|
||||
new TabCachingWidget(() => new CollapsibleSectionContainer()
|
||||
.child(new PromotedAttributesWidget())
|
||||
.child(new AttributeListWidget())
|
||||
)
|
||||
)
|
||||
.child(new TabCachingWidget(() => new NoteDetailWidget()))
|
||||
.child(new TabCachingWidget(() => new SimilarNotesWidget()))
|
||||
.child(...this.customWidgets.get('center-pane'))
|
||||
|
30
src/public/app/widgets/abstract_container.js
Normal file
30
src/public/app/widgets/abstract_container.js
Normal file
@ -0,0 +1,30 @@
|
||||
import BasicWidget from "./basic_widget.js";
|
||||
|
||||
export default class AbstractContainer extends BasicWidget {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.children = [];
|
||||
|
||||
this.positionCounter = 10;
|
||||
}
|
||||
|
||||
child(...components) {
|
||||
if (!components) {
|
||||
return this;
|
||||
}
|
||||
|
||||
super.child(...components);
|
||||
|
||||
for (const component of components) {
|
||||
if (!component.position) {
|
||||
component.position = this.positionCounter;
|
||||
this.positionCounter += 10;
|
||||
}
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ import AttributeDetailWidget from "./attribute_detail.js";
|
||||
import attributeRenderer from "../services/attribute_renderer.js";
|
||||
import AttributeEditorWidget from "./attribute_editor.js";
|
||||
import options from '../services/options.js';
|
||||
import PromotedAttributesWidget from "./promoted_attributes.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="attribute-list">
|
||||
@ -108,11 +107,15 @@ export default class AttributeListWidget extends TabAwareWidget {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.promotedAttributesWidget = new PromotedAttributesWidget().setParent(this);
|
||||
this.attributeDetailWidget = new AttributeDetailWidget().setParent(this);
|
||||
this.attributeEditorWidget = new AttributeEditorWidget(this.attributeDetailWidget).setParent(this);
|
||||
|
||||
this.child(this.promotedAttributesWidget, this.attributeEditorWidget, this.attributeDetailWidget);
|
||||
this.child(this.attributeEditorWidget, this.attributeDetailWidget);
|
||||
}
|
||||
|
||||
renderTitle() {
|
||||
this.$title = $('<div>').text('Attribute list');
|
||||
return this.$title;
|
||||
}
|
||||
|
||||
doRender() {
|
||||
@ -159,25 +162,24 @@ export default class AttributeListWidget extends TabAwareWidget {
|
||||
|
||||
this.$inheritedEmptyExpander = this.$widget.find('.attr-inherited-empty-expander');
|
||||
|
||||
this.$widget.find('.promoted-attributes-placeholder').replaceWith(this.promotedAttributesWidget.render());
|
||||
this.$widget.find('.attr-editor-placeholder').replaceWith(this.attributeEditorWidget.render());
|
||||
this.$widget.append(this.attributeDetailWidget.render());
|
||||
}
|
||||
|
||||
async refreshWithNote(note, updateOnly = false) {
|
||||
if (!updateOnly) {
|
||||
const hasPromotedAttrs = this.promotedAttributesWidget.getPromotedDefinitionAttributes().length > 0;
|
||||
|
||||
if (hasPromotedAttrs) {
|
||||
this.$promotedExpander.show();
|
||||
this.$allAttrWrapper.toggle(options.is('promotedAttributesExpanded'));
|
||||
this.$ownedAndInheritedWrapper.hide();
|
||||
this.$inheritedAttributesWrapper.hide();
|
||||
} else {
|
||||
this.$promotedExpander.hide();
|
||||
this.$allAttrWrapper.show();
|
||||
this.$ownedAndInheritedWrapper.toggle(options.is('attributeListExpanded'));
|
||||
}
|
||||
// const hasPromotedAttrs = this.promotedAttributesWidget.getPromotedDefinitionAttributes().length > 0;
|
||||
//
|
||||
// if (hasPromotedAttrs) {
|
||||
// this.$promotedExpander.show();
|
||||
// this.$allAttrWrapper.toggle(options.is('promotedAttributesExpanded'));
|
||||
// this.$ownedAndInheritedWrapper.hide();
|
||||
// this.$inheritedAttributesWrapper.hide();
|
||||
// } else {
|
||||
// this.$promotedExpander.hide();
|
||||
// this.$allAttrWrapper.show();
|
||||
// this.$ownedAndInheritedWrapper.toggle(options.is('attributeListExpanded'));
|
||||
// }
|
||||
}
|
||||
|
||||
const ownedAttributes = note.getOwnedAttributes().filter(attr => !attr.isAutoLink);
|
||||
|
62
src/public/app/widgets/collapsible_section_container.js
Normal file
62
src/public/app/widgets/collapsible_section_container.js
Normal file
@ -0,0 +1,62 @@
|
||||
import AbstractContainer from "./abstract_container.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="section-container">
|
||||
<style>
|
||||
.section-title-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
color: var(--muted-text-color);
|
||||
border-bottom: 1px solid var(--main-border-color);
|
||||
}
|
||||
|
||||
.section-title:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.section-title:hover {
|
||||
color: var(--main-text-color);
|
||||
}
|
||||
|
||||
.section-title-empty {
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="section-title-container"></div>
|
||||
<div class="section-body-container"></div>
|
||||
</div>`;
|
||||
|
||||
export default class CollapsibleSectionContainer extends AbstractContainer {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.contentSized();
|
||||
|
||||
this.$titleContainer = this.$widget.find('.section-title-container');
|
||||
this.$bodyContainer = this.$widget.find('.section-body-container');
|
||||
|
||||
this.$titleContainer.append('<div class="section-title section-title-empty">');
|
||||
|
||||
for (const widget of this.children) {
|
||||
this.$titleContainer.append(
|
||||
$('<div class="section-title">')
|
||||
.append(widget.renderTitle())
|
||||
);
|
||||
|
||||
this.$titleContainer.append('<div class="section-title section-title-empty">');
|
||||
|
||||
this.$bodyContainer.append(
|
||||
$('<div class="section-body">')
|
||||
.append(widget.render())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import BasicWidget from "./basic_widget.js";
|
||||
import AbstractContainer from "./abstract_container.js";
|
||||
|
||||
export default class FlexContainer extends BasicWidget {
|
||||
export default class FlexContainer extends AbstractContainer {
|
||||
constructor(direction) {
|
||||
super();
|
||||
|
||||
@ -9,29 +9,6 @@ export default class FlexContainer extends BasicWidget {
|
||||
}
|
||||
|
||||
this.attrs.style = `display: flex; flex-direction: ${direction};`;
|
||||
|
||||
this.children = [];
|
||||
|
||||
this.positionCounter = 10;
|
||||
}
|
||||
|
||||
child(...components) {
|
||||
if (!components) {
|
||||
return this;
|
||||
}
|
||||
|
||||
super.child(...components);
|
||||
|
||||
for (const component of components) {
|
||||
if (!component.position) {
|
||||
component.position = this.positionCounter;
|
||||
this.positionCounter += 10;
|
||||
}
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
doRender() {
|
||||
|
@ -41,6 +41,11 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
|
||||
this.$container = this.$widget.find(".promoted-attributes-container");
|
||||
}
|
||||
|
||||
renderTitle() {
|
||||
this.$title = $('<div>').text('Promoted attributes');
|
||||
return this.$title;
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
this.$container.empty();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user