neo.mjs 7.6.0 → 7.8.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/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/neo-config.json +1 -0
- package/apps/portal/resources/data/examples_devmode.json +20 -21
- package/apps/portal/resources/data/examples_dist_dev.json +19 -20
- package/apps/portal/resources/data/examples_dist_prod.json +19 -20
- package/apps/portal/view/ViewportController.mjs +20 -4
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/{ContentView.mjs → ContentComponent.mjs} +98 -38
- package/apps/portal/view/learn/CubeLayoutButton.mjs +77 -0
- package/apps/portal/view/learn/MainContainerController.mjs +1 -0
- package/apps/portal/view/learn/PageContainer.mjs +4 -4
- package/apps/shareddialog/view/DemoDialog.mjs +2 -10
- package/apps/shareddialog/view/MainContainerController.mjs +137 -126
- package/buildScripts/webpack/json/myApps.template.json +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +3 -3
- package/resources/data/deck/learnneo/pages/Welcome.md +1 -1
- package/resources/data/deck/learnneo/pages/benefits/FormsEngine.md +1 -1
- package/resources/data/deck/learnneo/pages/guides/PortalApp.md +35 -0
- package/resources/data/deck/learnneo/tree.json +1 -0
- package/resources/scss/src/apps/colors/TableContainer.scss +11 -9
- package/resources/scss/src/apps/portal/blog/List.scss +1 -0
- package/resources/scss/src/apps/portal/examples/List.scss +1 -0
- package/resources/scss/src/apps/portal/services/Component.scss +7 -8
- package/resources/scss/theme-dark/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-dark/button/Base.scss +3 -1
- package/resources/scss/theme-dark/list/Base.scss +3 -1
- package/resources/scss/theme-dark/table/header/Button.scss +3 -1
- package/resources/scss/theme-dark/tree/List.scss +3 -1
- package/resources/scss/theme-light/apps/covid/HeaderContainer.scss +6 -4
- package/resources/scss/theme-light/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-light/button/Base.scss +3 -1
- package/resources/scss/theme-light/grid/View.scss +8 -6
- package/resources/scss/theme-light/list/Base.scss +6 -4
- package/resources/scss/theme-light/table/View.scss +8 -6
- package/resources/scss/theme-light/table/header/Button.scss +3 -1
- package/resources/scss/theme-neo-light/apps/covid/HeaderContainer.scss +6 -4
- package/resources/scss/theme-neo-light/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-neo-light/design-tokens/Core.scss +11 -9
- package/resources/scss/theme-neo-light/grid/View.scss +8 -6
- package/resources/scss/theme-neo-light/table/View.scss +8 -6
- package/resources/scss/theme-neo-light/table/header/Button.scss +3 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/collection/Base.mjs +4 -3
- package/src/container/Base.mjs +12 -7
- package/src/draggable/DragProxyComponent.mjs +10 -20
- package/src/main/addon/Navigator.mjs +34 -32
- package/src/main/addon/WindowPosition.mjs +13 -15
- package/src/plugin/Resizable.mjs +20 -11
- package/src/tab/Container.mjs +5 -1
- package/src/table/View.mjs +2 -2
- package/test/siesta/siesta.js +1 -0
- package/test/siesta/tests/ManagerInstance.mjs +35 -0
- package/apps/krausest/README.md +0 -3
- package/apps/krausest/TableCollection.mjs +0 -46
- package/apps/krausest/app.mjs +0 -8
- package/apps/krausest/css/currentStyle.css +0 -2
- package/apps/krausest/css/main.css +0 -26
- package/apps/krausest/index.html +0 -12
- package/apps/krausest/neo-config.json +0 -10
- package/apps/krausest/view/MainComponent.mjs +0 -122
- package/apps/krausest/view/MainComponentController.mjs +0 -33
- package/apps/krausest/view/TableComponent.mjs +0 -152
- /package/resources/scss/src/apps/portal/learn/{ContentView.scss → ContentComponent.scss} +0 -0
package/apps/ServiceWorker.mjs
CHANGED
package/apps/portal/index.html
CHANGED
@@ -37,93 +37,92 @@
|
|
37
37
|
"sharedWorkers": true,
|
38
38
|
"url" : "https://neomjs.github.io/pages2/workspace/neo-shared-offscreen-canvas-demo/apps/mainapp/index.html"
|
39
39
|
}, {
|
40
|
-
"id"
|
40
|
+
"id" : 16,
|
41
|
+
"image" : "devmode/multi_window_dd.png",
|
42
|
+
"name" : "Multi-Window Drag&Drop",
|
43
|
+
"sharedWorkers": true,
|
44
|
+
"sourceUrl" : "apps/shareddialog",
|
45
|
+
"url" : "apps/shareddialog/index.html"
|
46
|
+
}, {
|
47
|
+
"id" : 15,
|
41
48
|
"image" : "devmode/tabContainer.png",
|
42
49
|
"name" : "tab.Container",
|
43
50
|
"sourceUrl": "examples/tab/container",
|
44
51
|
"url" : "examples/tab/container/index.html"
|
45
52
|
}, {
|
46
|
-
"id" :
|
53
|
+
"id" : 14,
|
47
54
|
"image" : "devmode/model-component-example.png",
|
48
55
|
"name" : "View Models Example",
|
49
56
|
"sourceUrl": "examples/model/advanced",
|
50
57
|
"url" : "examples/model/advanced/index.html"
|
51
58
|
}, {
|
52
|
-
"id" :
|
59
|
+
"id" : 13,
|
53
60
|
"image" : "devmode/dragdrop.png",
|
54
61
|
"name" : "Dialog drag&drop",
|
55
62
|
"sourceUrl": "examples/dialog",
|
56
63
|
"url" : "examples/dialog/"
|
57
64
|
}, {
|
58
|
-
"id" :
|
65
|
+
"id" : 12,
|
59
66
|
"image" : "dist_prod/colorsApp.png",
|
60
67
|
"name" : "Colors Dashboard",
|
61
68
|
"sharedWorkers": true,
|
62
69
|
"sourceUrl" : "apps/colors",
|
63
70
|
"url" : "apps/colors/index.html"
|
64
71
|
}, {
|
65
|
-
"id" :
|
72
|
+
"id" : 11,
|
66
73
|
"image" : "devmode/covidDashboard.png",
|
67
74
|
"name" : "Covid Dashboard",
|
68
75
|
"sourceUrl": "apps/covid",
|
69
76
|
"url" : "apps/covid/index.html"
|
70
77
|
}, {
|
71
|
-
"id" :
|
78
|
+
"id" : 10,
|
72
79
|
"image" : "devmode/coronaHelix.png",
|
73
80
|
"name" : "COVID-19 Helix",
|
74
81
|
"sourceUrl": "examples/component/coronaHelix",
|
75
82
|
"url" : "examples/component/coronaHelix/index.html"
|
76
83
|
}, {
|
77
|
-
"id" :
|
84
|
+
"id" : 9,
|
78
85
|
"image" : "devmode/gallery.png",
|
79
86
|
"name" : "component.Gallery",
|
80
87
|
"sourceUrl": "examples/component/gallery",
|
81
88
|
"url" : "examples/component/gallery/index.html"
|
82
89
|
}, {
|
83
|
-
"id" :
|
90
|
+
"id" : 8,
|
84
91
|
"image" : "devmode/tableFiltering.png",
|
85
92
|
"name" : "Table Filtering",
|
86
93
|
"sourceUrl": "examples/tableFiltering",
|
87
94
|
"url" : "examples/tableFiltering/"
|
88
95
|
}, {
|
89
|
-
"id" :
|
96
|
+
"id" : 7,
|
90
97
|
"image" : "devmode/dateSelector.png",
|
91
98
|
"name" : "component.DateSelector",
|
92
99
|
"sourceUrl": "examples/component/dateSelector",
|
93
100
|
"url" : "examples/component/dateSelector/index.html"
|
94
101
|
}, {
|
95
|
-
"id" :
|
102
|
+
"id" : 6,
|
96
103
|
"image" : "devmode/dateField.png",
|
97
104
|
"name" : "form.field.Date",
|
98
105
|
"sourceUrl": "examples/form/field/date",
|
99
106
|
"url" : "examples/form/field/date/index.html"
|
100
107
|
}, {
|
101
|
-
"id" :
|
108
|
+
"id" : 5,
|
102
109
|
"image" : "devmode/selectField.png",
|
103
110
|
"name" : "form.field.ComboBox",
|
104
111
|
"sourceUrl": "examples/form/field/combobox",
|
105
112
|
"url" : "examples/form/field/combobox/index.html"
|
106
113
|
}, {
|
107
|
-
"id" :
|
114
|
+
"id" : 4,
|
108
115
|
"image" : "dist_prod/portalApp.png",
|
109
116
|
"name" : "Portal App",
|
110
117
|
"sharedWorkers": true,
|
111
118
|
"sourceUrl" : "apps/portal",
|
112
119
|
"url" : "apps/portal/index.html"
|
113
120
|
}, {
|
114
|
-
"id" :
|
121
|
+
"id" : 3,
|
115
122
|
"image" : "devmode/siesta.png",
|
116
123
|
"name" : "Siesta Unit Tests",
|
117
124
|
"sourceUrl": "test/siesta",
|
118
125
|
"url" : "test/siesta/index.html"
|
119
|
-
}, {
|
120
|
-
"hidden" : true,
|
121
|
-
"id" : 3,
|
122
|
-
"image" : "devmode/multi_window_dd.png",
|
123
|
-
"name" : "Multi Window Drag&Drop",
|
124
|
-
"sharedWorkers": true,
|
125
|
-
"sourceUrl" : "apps/shareddialog",
|
126
|
-
"url" : "apps/shareddialog/index.html"
|
127
126
|
}, {
|
128
127
|
"hidden" : true,
|
129
128
|
"id" : 2,
|
@@ -37,87 +37,86 @@
|
|
37
37
|
"sourceUrl" : "https://github.com/neomjs/shared-offscreen",
|
38
38
|
"url" : "https://neomjs.github.io/pages2/workspace/neo-shared-offscreen-canvas-demo/dist/development/apps/mainapp/index.html"
|
39
39
|
}, {
|
40
|
-
"id"
|
40
|
+
"id" : 15,
|
41
|
+
"image" : "devmode/multi_window_dd.png",
|
42
|
+
"name" : "Multi-Window Drag&Drop",
|
43
|
+
"sharedWorkers": true,
|
44
|
+
"sourceUrl" : "apps/shareddialog",
|
45
|
+
"url" : "dist/development/apps/shareddialog/index.html"
|
46
|
+
}, {
|
47
|
+
"id" : 14,
|
41
48
|
"image" : "devmode/tabContainer.png",
|
42
49
|
"name" : "tab.Container",
|
43
50
|
"sourceUrl": "examples/tab/container",
|
44
51
|
"url" : "dist/development/examples/tab/container/index.html"
|
45
52
|
}, {
|
46
|
-
"id" :
|
53
|
+
"id" : 13,
|
47
54
|
"image" : "devmode/model-component-example.png",
|
48
55
|
"name" : "View Models Example",
|
49
56
|
"sourceUrl": "examples/model/advanced",
|
50
57
|
"url" : "dist/development/examples/model/advanced/index.html"
|
51
58
|
}, {
|
52
|
-
"id" :
|
59
|
+
"id" : 12,
|
53
60
|
"image" : "devmode/dragdrop.png",
|
54
61
|
"name" : "Dialog drag&drop",
|
55
62
|
"sourceUrl": "examples/dialog",
|
56
63
|
"url" : "dist/development/examples/dialog/"
|
57
64
|
}, {
|
58
|
-
"id" :
|
65
|
+
"id" : 11,
|
59
66
|
"image" : "dist_prod/colorsApp.png",
|
60
67
|
"name" : "Colors Dashboard",
|
61
68
|
"sharedWorkers": true,
|
62
69
|
"sourceUrl" : "apps/colors",
|
63
70
|
"url" : "dist/development/apps/colors/index.html"
|
64
71
|
}, {
|
65
|
-
"id" :
|
72
|
+
"id" : 10,
|
66
73
|
"image" : "devmode/covidDashboard.png",
|
67
74
|
"name" : "Covid Dashboard",
|
68
75
|
"sourceUrl": "apps/covid",
|
69
76
|
"url" : "dist/development/apps/covid/index.html#mainview=table"
|
70
77
|
}, {
|
71
|
-
"id" :
|
78
|
+
"id" : 9,
|
72
79
|
"image" : "devmode/coronaHelix.png",
|
73
80
|
"name" : "COVID-19 Helix",
|
74
81
|
"sourceUrl": "examples/component/coronaHelix",
|
75
82
|
"url" : "dist/development/examples/component/coronaHelix/index.html"
|
76
83
|
}, {
|
77
|
-
"id" :
|
84
|
+
"id" : 8,
|
78
85
|
"image" : "devmode/gallery.png",
|
79
86
|
"name" : "component.Gallery",
|
80
87
|
"sourceUrl": "examples/component/gallery",
|
81
88
|
"url" : "dist/development/examples/component/gallery/index.html"
|
82
89
|
}, {
|
83
|
-
"id" :
|
90
|
+
"id" : 7,
|
84
91
|
"image" : "devmode/tableFiltering.png",
|
85
92
|
"name" : "Table Filtering",
|
86
93
|
"sourceUrl": "examples/tableFiltering",
|
87
94
|
"url" : "dist/development/examples/tableFiltering/"
|
88
95
|
}, {
|
89
|
-
"id" :
|
96
|
+
"id" : 6,
|
90
97
|
"image" : "devmode/dateSelector.png",
|
91
98
|
"name" : "component.DateSelector",
|
92
99
|
"sourceUrl": "examples/component/dateSelector",
|
93
100
|
"url" : "dist/development/examples/component/dateSelector/index.html"
|
94
101
|
}, {
|
95
|
-
"id" :
|
102
|
+
"id" : 5,
|
96
103
|
"image" : "devmode/dateField.png",
|
97
104
|
"name" : "form.field.Date",
|
98
105
|
"sourceUrl": "examples/form/field/date",
|
99
106
|
"url" : "dist/development/examples/form/field/date/index.html"
|
100
107
|
}, {
|
101
|
-
"id" :
|
108
|
+
"id" : 4,
|
102
109
|
"image" : "devmode/selectField.png",
|
103
110
|
"name" : "form.field.ComboBox",
|
104
111
|
"sourceUrl": "examples/form/field/combobox",
|
105
112
|
"url" : "dist/development/examples/form/field/combobox/index.html"
|
106
113
|
}, {
|
107
|
-
"id" :
|
114
|
+
"id" : 3,
|
108
115
|
"image" : "dist_prod/portalApp.png",
|
109
116
|
"name" : "Portal App",
|
110
117
|
"sharedWorkers": true,
|
111
118
|
"sourceUrl" : "apps/portal",
|
112
119
|
"url" : "dist/development/apps/portal/index.html"
|
113
|
-
}, {
|
114
|
-
"hidden" : true,
|
115
|
-
"id" : 3,
|
116
|
-
"image" : "devmode/multi_window_dd.png",
|
117
|
-
"name" : "Multi Window Drag&Drop",
|
118
|
-
"sharedWorkers": true,
|
119
|
-
"sourceUrl" : "apps/shareddialog",
|
120
|
-
"url" : "dist/development/apps/shareddialog/index.html"
|
121
120
|
}, {
|
122
121
|
"hidden" : true,
|
123
122
|
"id" : 2,
|
@@ -37,87 +37,86 @@
|
|
37
37
|
"sourceUrl" : "https://github.com/neomjs/shared-offscreen",
|
38
38
|
"url" : "https://neomjs.github.io/pages2/workspace/neo-shared-offscreen-canvas-demo/dist/production/apps/mainapp/index.html"
|
39
39
|
}, {
|
40
|
-
"id"
|
40
|
+
"id" : 15,
|
41
|
+
"image" : "devmode/multi_window_dd.png",
|
42
|
+
"name" : "Multi-Window Drag&Drop",
|
43
|
+
"sharedWorkers": true,
|
44
|
+
"sourceUrl" : "apps/shareddialog",
|
45
|
+
"url" : "dist/production/apps/shareddialog/index.html"
|
46
|
+
}, {
|
47
|
+
"id" : 14,
|
41
48
|
"image" : "devmode/tabContainer.png",
|
42
49
|
"name" : "tab.Container",
|
43
50
|
"sourceUrl": "examples/tab/container",
|
44
51
|
"url" : "dist/production/examples/tab/container/index.html"
|
45
52
|
}, {
|
46
|
-
"id" :
|
53
|
+
"id" : 13,
|
47
54
|
"image" : "devmode/model-component-example.png",
|
48
55
|
"name" : "View Models Example",
|
49
56
|
"sourceUrl": "examples/model/advanced",
|
50
57
|
"url" : "dist/production/examples/model/advanced/index.html"
|
51
58
|
}, {
|
52
|
-
"id" :
|
59
|
+
"id" : 12,
|
53
60
|
"image" : "devmode/dragdrop.png",
|
54
61
|
"name" : "Dialog drag&drop",
|
55
62
|
"sourceUrl": "examples/dialog",
|
56
63
|
"url" : "dist/production/examples/dialog/"
|
57
64
|
}, {
|
58
|
-
"id" :
|
65
|
+
"id" : 11,
|
59
66
|
"image" : "dist_prod/colorsApp.png",
|
60
67
|
"name" : "Colors Dashboard",
|
61
68
|
"sharedWorkers": true,
|
62
69
|
"sourceUrl" : "apps/colors",
|
63
70
|
"url" : "dist/production/apps/colors/index.html"
|
64
71
|
}, {
|
65
|
-
"id" :
|
72
|
+
"id" : 10,
|
66
73
|
"image" : "devmode/covidDashboard.png",
|
67
74
|
"name" : "Covid Dashboard",
|
68
75
|
"sourceUrl": "apps/covid",
|
69
76
|
"url" : "dist/production/apps/covid/index.html#mainview=table"
|
70
77
|
}, {
|
71
|
-
"id" :
|
78
|
+
"id" : 9,
|
72
79
|
"image" : "devmode/coronaHelix.png",
|
73
80
|
"name" : "COVID-19 Helix",
|
74
81
|
"sourceUrl": "examples/component/coronaHelix",
|
75
82
|
"url" : "dist/production/examples/component/coronaHelix/index.html"
|
76
83
|
}, {
|
77
|
-
"id" :
|
84
|
+
"id" : 8,
|
78
85
|
"image" : "devmode/gallery.png",
|
79
86
|
"name" : "component.Gallery",
|
80
87
|
"sourceUrl": "examples/component/gallery",
|
81
88
|
"url" : "dist/production/examples/component/gallery/index.html"
|
82
89
|
}, {
|
83
|
-
"id" :
|
90
|
+
"id" : 7,
|
84
91
|
"image" : "devmode/tableFiltering.png",
|
85
92
|
"name" : "Table Filtering",
|
86
93
|
"sourceUrl": "examples/tableFiltering",
|
87
94
|
"url" : "dist/production/examples/tableFiltering/"
|
88
95
|
}, {
|
89
|
-
"id" :
|
96
|
+
"id" : 6,
|
90
97
|
"image" : "devmode/dateSelector.png",
|
91
98
|
"name" : "component.DateSelector",
|
92
99
|
"sourceUrl": "examples/component/dateSelector",
|
93
100
|
"url" : "dist/production/examples/component/dateSelector/index.html"
|
94
101
|
}, {
|
95
|
-
"id" :
|
102
|
+
"id" : 5,
|
96
103
|
"image" : "devmode/dateField.png",
|
97
104
|
"name" : "form.field.Date",
|
98
105
|
"sourceUrl": "examples/form/field/date",
|
99
106
|
"url" : "dist/production/examples/form/field/date/index.html"
|
100
107
|
}, {
|
101
|
-
"id" :
|
108
|
+
"id" : 4,
|
102
109
|
"image" : "devmode/selectField.png",
|
103
110
|
"name" : "form.field.ComboBox",
|
104
111
|
"sourceUrl": "examples/form/field/combobox",
|
105
112
|
"url" : "dist/production/examples/form/field/combobox/index.html"
|
106
113
|
}, {
|
107
|
-
"id" :
|
114
|
+
"id" : 3,
|
108
115
|
"image" : "dist_prod/portalApp.png",
|
109
116
|
"name" : "Portal App",
|
110
117
|
"sharedWorkers": true,
|
111
118
|
"sourceUrl" : "apps/portal",
|
112
119
|
"url" : "dist/production/apps/portal/index.html"
|
113
|
-
}, {
|
114
|
-
"hidden" : true,
|
115
|
-
"id" : 3,
|
116
|
-
"image" : "devmode/multi_window_dd.png",
|
117
|
-
"name" : "Multi Window Drag&Drop",
|
118
|
-
"sharedWorkers": true,
|
119
|
-
"sourceUrl" : "apps/shareddialog",
|
120
|
-
"url" : "dist/production/apps/shareddialog/index.html"
|
121
120
|
}, {
|
122
121
|
"hidden" : true,
|
123
122
|
"id" : 2,
|
@@ -36,9 +36,9 @@ class ViewportController extends Controller {
|
|
36
36
|
*/
|
37
37
|
defaultHash: '/home',
|
38
38
|
/**
|
39
|
-
* @member {String} mainContentLayout_='
|
39
|
+
* @member {String} mainContentLayout_='card'
|
40
40
|
*/
|
41
|
-
mainContentLayout_: '
|
41
|
+
mainContentLayout_: 'card',
|
42
42
|
/**
|
43
43
|
* @member {Object} routes
|
44
44
|
*/
|
@@ -88,14 +88,30 @@ class ViewportController extends Controller {
|
|
88
88
|
* @protected
|
89
89
|
*/
|
90
90
|
afterSetMainContentLayout(value, oldValue) {
|
91
|
-
let
|
92
|
-
|
91
|
+
let me = this,
|
92
|
+
{activeIndex, windowId} = me,
|
93
|
+
container = me.component.getItem('main-content'); // happens before instantiation
|
94
|
+
|
95
|
+
if (oldValue === undefined) {
|
96
|
+
// We can not turn this method itself into async and await the addon response,
|
97
|
+
// since the container needs its layout right away
|
98
|
+
Neo.main.addon.LocalStorage.readLocalStorageItem({
|
99
|
+
key: 'mainContentLayout',
|
100
|
+
windowId
|
101
|
+
}).then(data => {
|
102
|
+
if (data.value !== 'card') {
|
103
|
+
me.mainContentLayout = data.value
|
104
|
+
}
|
105
|
+
})
|
106
|
+
}
|
93
107
|
|
94
108
|
if (value === 'cube') {
|
95
109
|
container.layout = {ntype: 'cube', activeIndex, fitContainer: true, hideInactiveCardsOnDestroy: true}
|
96
110
|
} else {
|
97
111
|
container.layout = {ntype: 'card', activeIndex}
|
98
112
|
}
|
113
|
+
|
114
|
+
Neo.main.addon.LocalStorage.updateLocalStorageItem({key: 'mainContentLayout', value, windowId})
|
99
115
|
}
|
100
116
|
|
101
117
|
/**
|
@@ -10,16 +10,16 @@ const
|
|
10
10
|
preNeoComponentRegex = /<pre\s+data-neo-component\s*>([\s\S]*?)<\/pre>/g;
|
11
11
|
|
12
12
|
/**
|
13
|
-
* @class Portal.view.learn.
|
13
|
+
* @class Portal.view.learn.ContentComponent
|
14
14
|
* @extends Neo.component.Base
|
15
15
|
*/
|
16
|
-
class
|
16
|
+
class ContentComponent extends Component {
|
17
17
|
static config = {
|
18
18
|
/**
|
19
|
-
* @member {String} className='Portal.view.learn.
|
19
|
+
* @member {String} className='Portal.view.learn.ContentComponent'
|
20
20
|
* @protected
|
21
21
|
*/
|
22
|
-
className: 'Portal.view.learn.
|
22
|
+
className: 'Portal.view.learn.ContentComponent',
|
23
23
|
/**
|
24
24
|
* @member {String[]} baseCls=['learn-content']
|
25
25
|
* @protected
|
@@ -41,6 +41,17 @@ class ContentView extends Component {
|
|
41
41
|
tag: 'article'
|
42
42
|
}
|
43
43
|
|
44
|
+
/**
|
45
|
+
*
|
46
|
+
* @member {Neo.component.Base[]} customComponents=[]
|
47
|
+
*/
|
48
|
+
customComponents = []
|
49
|
+
/**
|
50
|
+
*
|
51
|
+
* @member {Neo.code.LivePreview[]} livePreviews=[]
|
52
|
+
*/
|
53
|
+
livePreviews = []
|
54
|
+
|
44
55
|
/**
|
45
56
|
* @param {Object} config
|
46
57
|
*/
|
@@ -71,14 +82,36 @@ class ContentView extends Component {
|
|
71
82
|
|
72
83
|
let me = this;
|
73
84
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
85
|
+
if (value) {
|
86
|
+
me.timeout(50).then(() => {
|
87
|
+
me.customComponents.forEach(component => {
|
88
|
+
if (!component.mounted && !component.rendering) {
|
89
|
+
component.render(true)
|
90
|
+
}
|
91
|
+
});
|
92
|
+
|
93
|
+
me.livePreviews.forEach(livePreview => {
|
94
|
+
if (!livePreview.mounted && !livePreview.rendering) {
|
95
|
+
livePreview.render(true)
|
96
|
+
}
|
97
|
+
});
|
98
|
+
|
99
|
+
Neo.main.addon.IntersectionObserver.register({
|
100
|
+
callback: 'findTopmostItem',
|
101
|
+
id : me.id,
|
102
|
+
root : `#${me.parentId}`,
|
103
|
+
windowId: me.windowId
|
104
|
+
})
|
80
105
|
})
|
81
|
-
})
|
106
|
+
} else if (oldValue !== undefined) {
|
107
|
+
me.customComponents.forEach(component => {
|
108
|
+
component.mounted = false
|
109
|
+
});
|
110
|
+
|
111
|
+
me.livePreviews.forEach(livePreview => {
|
112
|
+
livePreview.mounted = false
|
113
|
+
});
|
114
|
+
}
|
82
115
|
}
|
83
116
|
|
84
117
|
/**
|
@@ -90,6 +123,8 @@ class ContentView extends Component {
|
|
90
123
|
if (value) {
|
91
124
|
let me = this;
|
92
125
|
|
126
|
+
oldValue && me.destroyChildInstances();
|
127
|
+
|
93
128
|
await me.doFetchContent(value);
|
94
129
|
|
95
130
|
if (oldValue) {
|
@@ -104,25 +139,55 @@ class ContentView extends Component {
|
|
104
139
|
}
|
105
140
|
}
|
106
141
|
|
142
|
+
/**
|
143
|
+
* Destroy all created child instances
|
144
|
+
* @param args
|
145
|
+
*/
|
146
|
+
destroy(...args) {
|
147
|
+
this.destroyChildInstances();
|
148
|
+
super.destroy(...args)
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
*
|
153
|
+
*/
|
154
|
+
destroyChildInstances() {
|
155
|
+
let me = this;
|
156
|
+
|
157
|
+
me.customComponents.forEach(component => {
|
158
|
+
component.destroy()
|
159
|
+
});
|
160
|
+
|
161
|
+
me.customComponents = [];
|
162
|
+
|
163
|
+
me.livePreviews.forEach(livePreview => {
|
164
|
+
livePreview.destroy()
|
165
|
+
});
|
166
|
+
|
167
|
+
me.livePreviews = []
|
168
|
+
}
|
169
|
+
|
107
170
|
/**
|
108
171
|
* @param {Object} record
|
109
172
|
* @returns {Promise<void>}
|
110
173
|
*/
|
111
174
|
async doFetchContent(record) {
|
112
|
-
let me
|
113
|
-
|
114
|
-
|
175
|
+
let me = this,
|
176
|
+
{appName, windowId} = me,
|
177
|
+
path = me.getModel().getData('contentPath'),
|
178
|
+
baseConfigs, content, data, html, instance, modifiedHtml, neoComponents, neoDivs;
|
115
179
|
|
116
180
|
path += `/pages/${record.id.replaceAll('.', '/')}.md`;
|
117
181
|
|
118
182
|
if (record.isLeaf && path) {
|
183
|
+
baseConfigs = {appName, autoMount: true, autoRender: true, parentComponent: me, windowId};
|
119
184
|
data = await fetch(path);
|
120
185
|
content = await data.text();
|
121
186
|
content = me.updateContentSectionsStore(content); // also replaces ## with h2 tags
|
122
187
|
content = `# ${record.name}\n${content}`;
|
123
188
|
modifiedHtml = await me.highlightPreContent(content);
|
124
189
|
neoComponents = {};
|
125
|
-
neoDivs = {}
|
190
|
+
neoDivs = {};
|
126
191
|
|
127
192
|
// Replace <pre neo-component></pre> with <div id='neo-component-x'/>
|
128
193
|
// and create a map keyed by ID, whose value is the javascript
|
@@ -144,30 +209,25 @@ class ContentView extends Component {
|
|
144
209
|
await me.timeout(Neo.config.environment === 'development' ? 100 : 150);
|
145
210
|
|
146
211
|
Object.keys(neoComponents).forEach(key => {
|
147
|
-
Neo.create({
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
className : 'Neo.component.Base',
|
152
|
-
parentComponent: me,
|
153
|
-
parentId : key,
|
154
|
-
windowId : me.windowId,
|
212
|
+
instance = Neo.create({
|
213
|
+
...baseConfigs,
|
214
|
+
className: 'Neo.component.Base',
|
215
|
+
parentId : key,
|
155
216
|
...neoComponents[key]
|
156
|
-
})
|
217
|
+
});
|
218
|
+
|
219
|
+
me.customComponents.push(instance)
|
157
220
|
});
|
158
221
|
|
159
222
|
Object.keys(neoDivs).forEach(key => {
|
160
|
-
|
161
|
-
|
162
|
-
module
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
value : neoDivs[key],
|
169
|
-
windowId : me.windowId
|
170
|
-
})
|
223
|
+
instance = Neo.create({
|
224
|
+
...baseConfigs,
|
225
|
+
module : LivePreview,
|
226
|
+
parentId: key,
|
227
|
+
value : neoDivs[key]
|
228
|
+
});
|
229
|
+
|
230
|
+
me.livePreviews.push(instance)
|
171
231
|
});
|
172
232
|
|
173
233
|
Neo.main.addon.IntersectionObserver.observe({
|
@@ -278,11 +338,11 @@ class ContentView extends Component {
|
|
278
338
|
record = me.record;
|
279
339
|
|
280
340
|
if (data.altKey && data.shiftKey && !data.metaKey) {
|
281
|
-
me.fire('edit', {
|
341
|
+
me.fire('edit', {component: me, record})
|
282
342
|
}
|
283
343
|
// Command/windows shift click = refresh
|
284
344
|
else if (!data.altKey && data.shiftKey && data.metaKey) {
|
285
|
-
me.fire('refresh', {
|
345
|
+
me.fire('refresh', {component: me, record})
|
286
346
|
}
|
287
347
|
}
|
288
348
|
|
@@ -326,4 +386,4 @@ class ContentView extends Component {
|
|
326
386
|
}
|
327
387
|
}
|
328
388
|
|
329
|
-
export default Neo.setupClass(
|
389
|
+
export default Neo.setupClass(ContentComponent);
|