neo.mjs 6.9.10 → 6.9.12
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/learnneo/index.html +4 -3
- package/apps/learnneo/neo-config.json +2 -1
- package/apps/learnneo/store/Content.mjs +1 -1
- package/apps/learnneo/view/Viewport.mjs +18 -0
- package/apps/learnneo/view/ViewportController.mjs +2 -2
- package/apps/learnneo/view/home/ContentTreeList.mjs +22 -14
- package/apps/learnneo/view/home/ContentView.mjs +60 -0
- package/apps/learnneo/view/home/MainContainer.mjs +14 -6
- package/apps/learnneo/view/home/MainContainerController.mjs +57 -18
- package/apps/learnneo/view/home/MainContainerModel.mjs +3 -5
- package/apps/newwebsite/app.mjs +6 -0
- package/apps/newwebsite/index.html +13 -0
- package/apps/newwebsite/neo-config.json +7 -0
- package/apps/newwebsite/view/MainContainer.mjs +59 -0
- package/buildScripts/convertDesignTokens.mjs +173 -0
- package/buildScripts/webpack/json/myApps.template.json +1 -0
- package/examples/ConfigurationViewport.mjs +12 -9
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +3 -2
- package/resources/data/{learnneo → deck/learnneo}/p/2023-10-01T18-29-19-158Z.md +3 -6
- package/resources/data/deck/learnneo/p/2023-10-08T20-20-37-336Z.md +36 -0
- package/resources/data/deck/learnneo/p/stylesheet.md +58 -0
- package/resources/data/{learnneo → deck/learnneo}/t.json +19 -2
- package/resources/data/deck/training/p/2022-12-27T21-54-52-300Z.md +11 -0
- package/resources/data/deck/training/p/2022-12-27T21-55-23-144Z.md +43 -0
- package/resources/data/deck/training/p/2022-12-27T21-55-30-948Z.md +1 -0
- package/resources/data/deck/training/p/2022-12-27T21-55-43-542Z.md +84 -0
- package/resources/data/deck/training/p/2022-12-27T22-23-55-083Z.md +1 -0
- package/resources/data/deck/training/p/2022-12-27T22-24-07-886Z.md +8 -0
- package/resources/data/deck/training/p/2022-12-27T22-24-52-295Z.md +8 -0
- package/resources/data/deck/training/p/2022-12-27T22-25-03-853Z.md +5 -0
- package/resources/data/deck/training/p/2022-12-27T22-43-58-924Z.md +10 -0
- package/resources/data/deck/training/p/2022-12-27T22-44-28-881Z.md +3 -0
- package/resources/data/deck/training/p/2022-12-27T22-44-41-791Z.md +4 -0
- package/resources/data/deck/training/p/2022-12-27T22-45-21-032Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-27T22-49-22-078Z.md +4 -0
- package/resources/data/deck/training/p/2022-12-27T22-50-20-626Z.md +4 -0
- package/resources/data/deck/training/p/2022-12-28T16-58-47-786Z.md +0 -0
- package/resources/data/deck/training/p/2022-12-28T16-58-55-192Z.md +9 -0
- package/resources/data/deck/training/p/2022-12-28T17-10-18-058Z.md +15 -0
- package/resources/data/deck/training/p/2022-12-28T17-10-42-296Z.md +40 -0
- package/resources/data/deck/training/p/2022-12-28T17-11-34-653Z.md +41 -0
- package/resources/data/deck/training/p/2022-12-28T17-13-09-994Z.md +0 -0
- package/resources/data/deck/training/p/2022-12-28T21-32-14-420Z.md +0 -0
- package/resources/data/deck/training/p/2022-12-29T01-43-32-431Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-29T15-56-54-485Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-29T15-57-11-499Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-29T16-00-13-223Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-29T18-34-25-826Z.md +4 -0
- package/resources/data/deck/training/p/2022-12-29T18-36-08-226Z.md +106 -0
- package/resources/data/deck/training/p/2022-12-29T18-36-56-893Z.md +112 -0
- package/resources/data/deck/training/p/2022-12-29T19-31-30-507Z.md +31 -0
- package/resources/data/deck/training/p/2022-12-29T19-31-55-091Z.md +14 -0
- package/resources/data/deck/training/p/2022-12-29T20-03-42-628Z.md +9 -0
- package/resources/data/deck/training/p/2022-12-29T20-21-20-669Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-29T20-37-08-919Z.md +46 -0
- package/resources/data/deck/training/p/2022-12-29T20-37-20-344Z.md +43 -0
- package/resources/data/deck/training/p/2022-12-30T19-04-30-990Z.md +8 -0
- package/resources/data/deck/training/p/2022-12-31T18-43-56-338Z.md +7 -0
- package/resources/data/deck/training/p/2022-12-31T18-51-50-682Z.md +1 -0
- package/resources/data/deck/training/p/2022-12-31T18-54-04-176Z.md +4 -0
- package/resources/data/deck/training/p/2022-12-31T22-11-55-555Z.md +112 -0
- package/resources/data/deck/training/p/2022-12-31T23-00-41-222Z.md +6 -0
- package/resources/data/deck/training/p/2022-12-31T23-18-55-655Z.md +69 -0
- package/resources/data/deck/training/p/2022-12-31T23-25-40-735Z.md +21 -0
- package/resources/data/deck/training/p/2022-12-31T23-25-51-014Z.md +7 -0
- package/resources/data/deck/training/p/2023-01-01T17-49-18-429Z.md +3 -0
- package/resources/data/deck/training/p/2023-01-01T18-44-07-034Z.md +34 -0
- package/resources/data/deck/training/p/2023-01-01T18-47-39-766Z.md +15 -0
- package/resources/data/deck/training/p/2023-01-01T19-04-22-830Z.md +4 -0
- package/resources/data/deck/training/p/2023-01-01T21-11-58-025Z.md +25 -0
- package/resources/data/deck/training/p/2023-01-01T21-12-37-340Z.md +23 -0
- package/resources/data/deck/training/p/2023-01-01T21-13-13-880Z.md +8 -0
- package/resources/data/deck/training/p/2023-01-01T21-14-45-740Z.md +98 -0
- package/resources/data/deck/training/p/2023-01-01T21-18-23-886Z.md +26 -0
- package/resources/data/deck/training/p/2023-01-01T21-18-31-316Z.md +19 -0
- package/resources/data/deck/training/p/2023-01-01T21-18-42-290Z.md +23 -0
- package/resources/data/deck/training/p/2023-01-01T21-19-57-020Z.md +24 -0
- package/resources/data/deck/training/p/2023-01-01T21-22-31-184Z.md +13 -0
- package/resources/data/deck/training/p/2023-01-01T21-22-38-317Z.md +17 -0
- package/resources/data/deck/training/p/2023-01-01T21-22-47-693Z.md +20 -0
- package/resources/data/deck/training/p/2023-01-01T21-23-17-716Z.md +39 -0
- package/resources/data/deck/training/p/2023-01-01T21-23-28-532Z.md +22 -0
- package/resources/data/deck/training/p/2023-01-01T21-25-23-899Z.md +3 -0
- package/resources/data/deck/training/p/2023-01-01T21-25-59-742Z.md +1 -0
- package/resources/data/deck/training/p/2023-01-01T21-26-53-748Z.md +12 -0
- package/resources/data/deck/training/p/2023-01-01T23-38-42-863Z.md +2 -0
- package/resources/data/deck/training/p/2023-01-03T02-07-19-014Z.md +143 -0
- package/resources/data/deck/training/p/2023-01-04T01-52-23-454Z.md +76 -0
- package/resources/data/deck/training/p/2023-01-06T23-21-12-009Z.md +127 -0
- package/resources/data/deck/training/p/2023-01-06T23-21-31-685Z.md +81 -0
- package/resources/data/deck/training/p/2023-01-06T23-21-59-596Z.md +36 -0
- package/resources/data/deck/training/p/2023-01-06T23-34-13-897Z.md +87 -0
- package/resources/data/deck/training/p/2023-01-06T23-44-02-340Z.md +0 -0
- package/resources/data/deck/training/p/2023-01-06T23-46-36-687Z.md +1 -0
- package/resources/data/deck/training/p/2023-01-06T23-46-45-783Z.md +33 -0
- package/resources/data/deck/training/p/2023-01-08T00-45-11-144Z.md +50 -0
- package/resources/data/deck/training/p/2023-01-08T01-06-31-267Z.md +41 -0
- package/resources/data/deck/training/p/2023-01-08T01-24-21-088Z.md +95 -0
- package/resources/data/deck/training/p/2023-01-08T01-25-12-557Z.md +11 -0
- package/resources/data/deck/training/p/2023-01-08T01-46-50-723Z.md +25 -0
- package/resources/data/deck/training/p/2023-01-08T02-09-07-802Z.md +18 -0
- package/resources/data/deck/training/p/2023-01-08T02-09-19-678Z.md +66 -0
- package/resources/data/deck/training/p/2023-01-08T02-11-26-333Z.md +29 -0
- package/resources/data/deck/training/p/2023-01-08T17-22-48-841Z.md +14 -0
- package/resources/data/deck/training/p/2023-01-08T20-46-11-806Z.md +5 -0
- package/resources/data/deck/training/p/2023-01-08T20-47-23-682Z.md +5 -0
- package/resources/data/deck/training/p/2023-01-08T20-47-32-064Z.md +13 -0
- package/resources/data/deck/training/p/2023-01-08T20-47-57-045Z.md +0 -0
- package/resources/data/deck/training/p/2023-01-08T20-48-03-791Z.md +18 -0
- package/resources/data/deck/training/p/2023-01-08T20-48-32-466Z.md +9 -0
- package/resources/data/deck/training/p/2023-01-08T20-48-51-322Z.md +20 -0
- package/resources/data/deck/training/p/2023-01-08T20-49-52-741Z.md +0 -0
- package/resources/data/deck/training/p/2023-01-08T20-52-03-556Z.md +0 -0
- package/resources/data/deck/training/p/2023-01-08T20-57-36-333Z.md +2 -0
- package/resources/data/deck/training/p/2023-01-08T20-57-51-136Z.md +5 -0
- package/resources/data/deck/training/p/2023-01-09T00-07-37-951Z.md +0 -0
- package/resources/data/deck/training/p/2023-01-09T00-35-40-671Z.md +3 -0
- package/resources/data/deck/training/p/2023-01-10T01-29-38-148Z.md +10 -0
- package/resources/data/deck/training/p/2023-01-10T01-43-12-166Z.md +31 -0
- package/resources/data/deck/training/p/2023-01-10T02-21-54-303Z.md +10 -0
- package/resources/data/deck/training/p/2023-01-12T01-50-54-617Z.md +74 -0
- package/resources/data/deck/training/p/2023-01-13T19-55-24-735Z.md +14 -0
- package/resources/data/deck/training/p/2023-01-13T20-08-27-068Z.md +28 -0
- package/resources/data/deck/training/p/2023-01-13T20-23-38-411Z.md +25 -0
- package/resources/data/deck/training/p/2023-01-13T20-37-06-267Z.md +13 -0
- package/resources/data/deck/training/p/2023-01-13T21-05-57-708Z.md +8 -0
- package/resources/data/deck/training/p/2023-01-13T21-48-17-258Z.md +20 -0
- package/resources/data/deck/training/p/2023-01-13T22-05-05-799Z.md +14 -0
- package/resources/data/deck/training/p/2023-01-13T22-08-30-863Z.md +17 -0
- package/resources/data/deck/training/p/2023-01-13T23-01-50-449Z.md +4 -0
- package/resources/data/deck/training/p/2023-01-14T00-33-05-958Z.md +62 -0
- package/resources/data/deck/training/p/2023-01-14T00-40-27-784Z.md +229 -0
- package/resources/data/deck/training/p/2023-01-14T00-41-59-081Z.md +153 -0
- package/resources/data/deck/training/p/2023-01-14T13-50-28-199Z.md +19 -0
- package/resources/data/deck/training/p/2023-01-14T13-59-20-275Z.md +6 -0
- package/resources/data/deck/training/p/2023-01-14T14-03-29-456Z.md +3 -0
- package/resources/data/deck/training/p/2023-01-14T14-27-57-678Z.md +7 -0
- package/resources/data/deck/training/p/2023-01-14T17-30-18-228Z.md +33 -0
- package/resources/data/deck/training/p/2023-01-14T18-28-39-316Z.md +1 -0
- package/resources/data/deck/training/p/2023-01-14T18-28-44-115Z.md +4 -0
- package/resources/data/deck/training/p/2023-01-14T18-28-49-548Z.md +18 -0
- package/resources/data/deck/training/p/2023-01-14T18-40-13-758Z.md +10 -0
- package/resources/data/deck/training/p/2023-01-14T19-29-15-291Z.md +12 -0
- package/resources/data/deck/training/p/2023-01-15T18-51-52-134Z.md +83 -0
- package/resources/data/deck/training/p/2023-01-15T20-03-30-073Z.md +11 -0
- package/resources/data/deck/training/p/2023-01-15T22-07-52-073Z.md +16 -0
- package/resources/data/deck/training/p/2023-01-15T22-22-13-517Z.md +12 -0
- package/resources/data/deck/training/p/2023-01-15T22-28-57-508Z.md +131 -0
- package/resources/data/deck/training/p/2023-01-15T22-36-30-913Z.md +115 -0
- package/resources/data/deck/training/p/2023-01-16T16-03-40-770Z.md +12 -0
- package/resources/data/deck/training/p/2023-01-16T20-21-56-859Z.md +5 -0
- package/resources/data/deck/training/p/2023-01-16T20-24-09-690Z.md +24 -0
- package/resources/data/deck/training/p/2023-01-20T12-51-22-646Z.md +21 -0
- package/resources/data/deck/training/p/2023-01-20T13-06-46-614Z.md +9 -0
- package/resources/data/deck/training/p/2023-01-20T13-08-51-600Z.md +7 -0
- package/resources/data/deck/training/p/2023-01-20T15-20-13-363Z.md +26 -0
- package/resources/data/deck/training/p/2023-01-20T15-34-58-813Z.md +75 -0
- package/resources/data/deck/training/p/2023-01-21T16-33-20-458Z.md +33 -0
- package/resources/data/deck/training/p/2023-01-21T16-45-28-263Z.md +28 -0
- package/resources/data/deck/training/p/2023-01-21T16-56-25-452Z.md +3 -0
- package/resources/data/deck/training/p/2023-01-21T17-28-31-493Z.md +6 -0
- package/resources/data/deck/training/p/2023-01-21T19-49-51-918Z.md +13 -0
- package/resources/data/deck/training/p/2023-01-21T20-08-24-452Z.md +15 -0
- package/resources/data/deck/training/p/2023-01-21T20-35-54-947Z.md +20 -0
- package/resources/data/deck/training/p/2023-01-21T20-54-47-603Z.md +39 -0
- package/resources/data/deck/training/p/2023-01-21T20-56-28-184Z.md +25 -0
- package/resources/data/deck/training/p/2023-01-21T20-57-32-927Z.md +4 -0
- package/resources/data/deck/training/p/2023-01-21T23-13-33-394Z.md +6 -0
- package/resources/data/deck/training/p/2023-01-28T19-11-37-464Z.md +24 -0
- package/resources/data/deck/training/p/2023-01-28T20-43-41-188Z.md +9 -0
- package/resources/data/deck/training/p/2023-01-28T20-53-56-476Z.md +8 -0
- package/resources/data/deck/training/p/2023-01-28T20-58-43-776Z.md +10 -0
- package/resources/data/deck/training/p/2023-01-28T22-18-41-259Z.md +33 -0
- package/resources/data/deck/training/p/2023-01-28T22-24-34-808Z.md +24 -0
- package/resources/data/deck/training/p/2023-01-29T16-25-24-528Z.md +44 -0
- package/resources/data/deck/training/p/2023-01-29T21-14-32-588Z.md +12 -0
- package/resources/data/deck/training/p/2023-01-31T19-24-53-504Z.md +8 -0
- package/resources/data/deck/training/p/2023-01-31T20-33-55-855Z.md +11 -0
- package/resources/data/deck/training/p/2023-01-31T20-34-30-261Z.md +7 -0
- package/resources/data/deck/training/p/2023-01-31T20-52-53-367Z.md +43 -0
- package/resources/data/deck/training/p/2023-02-04T15-18-35-682Z.md +20 -0
- package/resources/data/deck/training/p/2023-02-04T15-49-47-597Z.md +14 -0
- package/resources/data/deck/training/p/2023-02-04T18-58-57-808Z.md +1 -0
- package/resources/data/deck/training/p/2023-02-04T20-07-11-288Z.md +1 -0
- package/resources/data/deck/training/p/2023-02-04T20-09-50-169Z.md +1 -0
- package/resources/data/deck/training/p/2023-02-04T20-19-42-740Z.md +8 -0
- package/resources/data/deck/training/p/2023-02-04T20-23-56-013Z.md +12 -0
- package/resources/data/deck/training/p/2023-02-04T20-28-12-391Z.md +20 -0
- package/resources/data/deck/training/p/2023-02-05T00-20-32-554Z.md +16 -0
- package/resources/data/deck/training/p/2023-02-05T00-35-56-282Z.md +13 -0
- package/resources/data/deck/training/p/2023-02-05T15-36-57-182Z.md +24 -0
- package/resources/data/deck/training/p/2023-02-05T17-39-51-712Z.md +70 -0
- package/resources/data/deck/training/p/2023-02-05T17-44-53-815Z.md +195 -0
- package/resources/data/deck/training/p/2023-02-05T17-45-40-114Z.md +92 -0
- package/resources/data/deck/training/p/2023-02-05T18-12-14-489Z.md +60 -0
- package/resources/data/deck/training/p/2023-02-06T00-14-54-457Z.md +9 -0
- package/resources/data/deck/training/p/2023-06-28T18-03-14-313Z.md +8 -0
- package/resources/data/deck/training/p/2023-06-28T18-26-17-290Z.md +7 -0
- package/resources/data/deck/training/p/2023-06-28T21-16-24-034Z.md +40 -0
- package/resources/data/deck/training/p/2023-06-28T21-16-34-972Z.md +16 -0
- package/resources/data/deck/training/p/2023-06-28T21-28-28-379Z.md +4 -0
- package/resources/data/deck/training/p/2023-06-29T23-15-10-411Z.md +5 -0
- package/resources/data/deck/training/p/2023-07-01T15-42-45-193Z.md +433 -0
- package/resources/data/deck/training/p/2023-07-01T21-54-31-329Z.md +6 -0
- package/resources/data/deck/training/p/2023-07-02T16-14-06-970Z.md +14 -0
- package/resources/data/deck/training/p/2023-07-31T00-26-03-842Z.md +4 -0
- package/resources/data/deck/training/p/2023-07-31T00-31-51-933Z.md +10 -0
- package/resources/data/deck/training/p/2023-07-31T00-37-21-927Z.md +205 -0
- package/resources/data/deck/training/p/2023-10-01T18-29-19-158Z.md +76 -0
- package/resources/data/deck/training/p/2023-10-07T19-18-28-517Z.md +102 -0
- package/resources/data/deck/training/p/2023-10-08T20-20-07-934Z.md +75 -0
- package/resources/data/deck/training/p/2023-10-08T20-37-30-658Z.md +0 -0
- package/resources/data/deck/training/p/2023-10-08T21-58-25-809Z.md +68 -0
- package/resources/data/deck/training/p/2023-10-08T22-22-11-013Z.md +0 -0
- package/resources/data/deck/training/p/2023-10-14T19-25-08-153Z.md +119 -0
- package/resources/data/deck/training/t.json +1276 -0
- package/resources/design-tokens/json/component.json +288 -0
- package/resources/design-tokens/json/core.json +352 -0
- package/resources/design-tokens/json/semantic.json +231 -0
- package/resources/scss/src/apps/learnneo/Viewport.scss +3 -0
- package/resources/scss/src/apps/learnneo/home/ContentTreeList.scss +60 -13
- package/resources/scss/src/apps/learnneo/home/ContentView.scss +58 -0
- package/resources/scss/src/apps/newwebsite/MainContainer.scss +32 -0
- package/resources/scss/src/list/Base.scss +1 -1
- package/resources/scss/theme-neo-light/Global.scss +65 -1
- package/resources/scss/theme-neo-light/design-tokens/Component.scss +64 -0
- package/resources/scss/theme-neo-light/design-tokens/Core.scss +67 -0
- package/resources/scss/theme-neo-light/design-tokens/Semantic.scss +61 -0
- package/resources/scss/theme-neo-light/design-tokens/_all.scss +4 -0
- package/resources/scss/theme-neo-light/list/Base.scss +29 -6
- package/src/DefaultConfig.mjs +4 -4
- package/src/controller/Base.mjs +31 -23
- package/src/data/connection/Xhr.mjs +1 -1
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-07T19-18-28-517Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-08T20-20-07-934Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-08T20-37-30-658Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-08T21-58-25-809Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-08T22-22-11-013Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/p/2023-10-14T19-25-08-153Z.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/pages/whyneo.md +0 -0
- /package/resources/data/{learnneo → deck/learnneo}/tree.json +0 -0
- /package/resources/data/{learnneo → deck/training}/p/2023-10-08T20-20-37-336Z.md +0 -0
- /package/resources/{deck → data/deck}/whyneo.md +0 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
#Introduction
|
2
|
+
|
3
|
+
In this lab you'll change the detail view to be a tab panel,
|
4
|
+
then use the `vdom` property to render content.
|
5
|
+
|
6
|
+
#Steps
|
7
|
+
|
8
|
+
??Change the details container to be a tab container
|
9
|
+
|
10
|
+
Import `src/tab/Container.mjs` and Import `src/component/Base.mjs`.
|
11
|
+
|
12
|
+
Change the view to extend tab container.
|
13
|
+
|
14
|
+
Code an items array. Since we'll be needing references to the
|
15
|
+
two items, each has a `reference`. Note the `vdom` and padding
|
16
|
+
on the first item. You'll be dynamically updating the vdom
|
17
|
+
in the `afterSetBusiness()` method.
|
18
|
+
|
19
|
+
items: [{
|
20
|
+
module: Component,
|
21
|
+
reference: 'view',
|
22
|
+
tabButtonConfig: {
|
23
|
+
text: 'View'
|
24
|
+
},
|
25
|
+
style: {
|
26
|
+
padding: '8px'
|
27
|
+
},
|
28
|
+
vdom: {
|
29
|
+
cn: [{
|
30
|
+
tag: 'h2',
|
31
|
+
innerHTML: 'foo'
|
32
|
+
}]
|
33
|
+
}
|
34
|
+
}, {
|
35
|
+
reference: 'form',
|
36
|
+
tabButtonConfig: {
|
37
|
+
text: 'Edit'
|
38
|
+
}
|
39
|
+
}]
|
40
|
+
|
41
|
+
Save and refresh, and you should see the _foo_ in the detail container.
|
42
|
+
|
43
|
+
??Update the field when a record is set
|
44
|
+
|
45
|
+
Change the detail view's `afterSetBusiness()` method to update the `vdom`.
|
46
|
+
|
47
|
+
afterSetBusiness(business){
|
48
|
+
if (!business) return;
|
49
|
+
const view = this.getReference('view');
|
50
|
+
view.vdom.cn[0].innerHTML = business.title;
|
51
|
+
view.update();
|
52
|
+
}
|
53
|
+
|
54
|
+
<b>Important: </b>The `update()` method tells Neo to apply vdom changes to the DOM.
|
55
|
+
Any time you change a set of vdom properties you need to run `update()`.
|
56
|
+
|
57
|
+
You don't need the first item's `innerHTML:'foo'` property any more, so you can
|
58
|
+
remove that from the first item's config.
|
59
|
+
|
60
|
+
Save, refresh, and confirm that the title is shown as the business is set.
|
61
|
+
|
62
|
+
??Use a convenience function
|
63
|
+
|
64
|
+
Neo has a convenience method that lets you abstract the vdom a little.
|
65
|
+
|
66
|
+
Edit the detail view's first item, and add a `id` to the element showing the title.
|
67
|
+
|
68
|
+
vdom: {
|
69
|
+
cn: [{
|
70
|
+
tag: 'h2',
|
71
|
+
id: 'title'
|
72
|
+
}]
|
73
|
+
}
|
74
|
+
|
75
|
+
The util method lets you find the node using the id (or using a more complex selector).
|
76
|
+
Use the utility method, replacing the statement referencing the vdom hierarchy.
|
77
|
+
|
78
|
+
<pre>
|
79
|
+
<s>view.vdom.cn[0].innerHTML = business.title;</s>
|
80
|
+
Neo.util.VDom.findVdomChild(view.vdom, 'title').vdom.innerHTML = business.title;
|
81
|
+
</pre>
|
82
|
+
|
83
|
+
|
84
|
+
We'll be updating several vdom nodes, so we can create a more convenient way of
|
85
|
+
calling the function.
|
86
|
+
|
87
|
+
Code a new class member.
|
88
|
+
|
89
|
+
findVdomChild = Neo.util.VDom.findVdomChild
|
90
|
+
|
91
|
+
Then use it in the after set method. Here's how that part of the code will look afterwards.
|
92
|
+
|
93
|
+
<pre style="color:gray; padding: 8px; border: thin solid lightgray;">
|
94
|
+
findVdomChild = Neo.util.VDom.findVdomChild;
|
95
|
+
|
96
|
+
afterSetBusiness(business){
|
97
|
+
if (!business) return;
|
98
|
+
const view = this.getReference('view');
|
99
|
+
this.findVdomChild(view.vdom, 'title').vdom.innerHTML = business.title;
|
100
|
+
view.update();
|
101
|
+
}
|
102
|
+
</pre>
|
103
|
+
|
104
|
+
??Add the thumbnail
|
105
|
+
|
106
|
+
The Yelp businesses store doesn't have a field value for the image. Add this
|
107
|
+
to the main view model _businesses_ store `fields:[]`.
|
108
|
+
|
109
|
+
{
|
110
|
+
name: 'imageUrl',
|
111
|
+
mapping: 'image_url'
|
112
|
+
}
|
113
|
+
|
114
|
+
Then back in the details view, update the vdom as follows.
|
115
|
+
|
116
|
+
vdom: {
|
117
|
+
tag: 'div',
|
118
|
+
cn: [{
|
119
|
+
tag: 'h2',
|
120
|
+
id: 'title'
|
121
|
+
}, {
|
122
|
+
tag: 'img',
|
123
|
+
id: 'thumbnail',
|
124
|
+
style: {
|
125
|
+
width: '100%'
|
126
|
+
}
|
127
|
+
}]
|
128
|
+
}
|
129
|
+
|
130
|
+
Then modify the `afterSetBusiness()` method to update the element's `src`.
|
131
|
+
|
132
|
+
this.findVdomChild(view.vdom, 'thumbnail').vdom.src = business.imageUrl;
|
133
|
+
|
134
|
+
??Add the address
|
135
|
+
|
136
|
+
Depending on how you left the store's `address` config, you may need to change two things.
|
137
|
+
|
138
|
+
First, in the businesses store config and make sure the address field is defined like this.
|
139
|
+
|
140
|
+
{
|
141
|
+
name: 'address',
|
142
|
+
mapping: 'location.display_address'
|
143
|
+
},
|
144
|
+
|
145
|
+
Second, look at the address column in the table and make sure it uses a renderer.
|
146
|
+
|
147
|
+
{
|
148
|
+
text: 'Address',
|
149
|
+
dataField: 'address',
|
150
|
+
renderer: data => data.value.join(', ')
|
151
|
+
}
|
152
|
+
|
153
|
+
Now edit the details view and a `vdom` child element between the _h2_ and the _img_ to
|
154
|
+
be a div that shows the address.
|
155
|
+
|
156
|
+
vdom: {
|
157
|
+
tag: 'div',
|
158
|
+
cn: [{
|
159
|
+
tag: 'h2',
|
160
|
+
id: 'title'
|
161
|
+
}, {
|
162
|
+
tag: 'div',
|
163
|
+
id: 'address',
|
164
|
+
cn: []
|
165
|
+
}, {
|
166
|
+
tag: 'img',
|
167
|
+
id: 'thumbnail',
|
168
|
+
style: {
|
169
|
+
width: '100%' // It would be better to do this via css
|
170
|
+
}
|
171
|
+
}]
|
172
|
+
}
|
173
|
+
|
174
|
+
Then modify the `afterSetBusiness()` method to update the _address_ element's
|
175
|
+
`cn` to be an array of items, one per item in the address array. Each item should
|
176
|
+
be a _div_ with its `innerHTML` set to that part of the address.
|
177
|
+
|
178
|
+
Hint: The business record's `address` property is an array, and the `cn` is
|
179
|
+
also an array. Maybe there's a easy way to map the address array into a new
|
180
|
+
array you assign to `cn`? How would you code it? Give it a few minutes
|
181
|
+
of thought and try it. If you get stuck, that code is given in the next lab step.
|
182
|
+
|
183
|
+
??Here's the code for showing the address
|
184
|
+
|
185
|
+
Here's one way to code it. How does this compare to your solution?
|
186
|
+
|
187
|
+
this.findVdomChild(view.vdom, 'address').vdom.cn = business
|
188
|
+
.address
|
189
|
+
.map(item => ({tag: 'div', innerHTML: item}));
|
190
|
+
|
191
|
+
??One last point...
|
192
|
+
|
193
|
+
The view tab will become more and more complicated as we add content.
|
194
|
+
It should be refactored into its own view class to isolate that complexity.
|
195
|
+
We won't bother, but on a project that would be the right thing to do.
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#Introduction
|
2
|
+
|
3
|
+
In this lab you'll add the form as the second tab.
|
4
|
+
|
5
|
+
#Steps
|
6
|
+
|
7
|
+
??Make the second tab a form
|
8
|
+
|
9
|
+
You'll add a <b>Save</b> button, and in the handler log the contents
|
10
|
+
of the form. This simulates the set of data you'd send to the back-end.
|
11
|
+
|
12
|
+
Import `src/form/Container.mjs`, and use it as the second item.
|
13
|
+
|
14
|
+
Configure the form to use vbox, along with some other configs.
|
15
|
+
|
16
|
+
{
|
17
|
+
module: Form,
|
18
|
+
reference: 'form',
|
19
|
+
tabButtonConfig: {
|
20
|
+
text: 'Edit'
|
21
|
+
},
|
22
|
+
style: {
|
23
|
+
padding: '8px'
|
24
|
+
},
|
25
|
+
itemDefaults: {
|
26
|
+
labelWidth: 80,
|
27
|
+
flex: 'none'
|
28
|
+
},
|
29
|
+
layout: {
|
30
|
+
ntype: 'vbox',
|
31
|
+
pack: 'start',
|
32
|
+
align: 'stretch'
|
33
|
+
},
|
34
|
+
items: []
|
35
|
+
}
|
36
|
+
|
37
|
+
??Add two fields
|
38
|
+
|
39
|
+
Add two fields to the `items:[]`.
|
40
|
+
|
41
|
+
Add a text field. You'll need to import `src/form/field/Text.mjs` and
|
42
|
+
use that module. Configure the field with `labelText:'Name'`
|
43
|
+
and `name:'name'`.
|
44
|
+
|
45
|
+
Add a number field. You'll need to import `src/form/field/Number.mjs`
|
46
|
+
and use that module. Configure the field with `labelText:'Rating'`,
|
47
|
+
`name:'rating'`,
|
48
|
+
along with `minValue:1`, `maxValue:5`, and `stepSize:0.5`.
|
49
|
+
|
50
|
+
The `name` config isn't required, but it makes it easier to
|
51
|
+
initialize, as you'll see in the next step.
|
52
|
+
|
53
|
+
??Initialize the form with values from the record
|
54
|
+
|
55
|
+
In the `afterSetBusiness()` method add code to update the form with
|
56
|
+
values from the record.
|
57
|
+
|
58
|
+
const form = this.getReference('form');
|
59
|
+
form.setValues({
|
60
|
+
name: business.title,
|
61
|
+
rating: business.rating
|
62
|
+
});
|
63
|
+
|
64
|
+
If you save and refresh, then choose businesses, you should see the
|
65
|
+
form updating to reflect the selected record.
|
66
|
+
|
67
|
+
??Add a <b>Save</b> button
|
68
|
+
|
69
|
+
Add _two_ new items to the form's `items:[]`. One to take up available
|
70
|
+
room at the bottom of the form, and the other a save button.
|
71
|
+
|
72
|
+
{
|
73
|
+
flex: 1
|
74
|
+
}, {
|
75
|
+
module: Button,
|
76
|
+
text: 'Save',
|
77
|
+
handler: data => data.component.up({ntype: 'yelp-business-details'}).onSaveClick()
|
78
|
+
}
|
79
|
+
|
80
|
+
As you can see, the button calls an `onSaveClick()` event. Add that as a new member
|
81
|
+
of the view, and log the values in the form.
|
82
|
+
|
83
|
+
onSaveClick() {
|
84
|
+
const form = this.getReference('form');
|
85
|
+
form.getValues().then(data => {
|
86
|
+
console.log(data);
|
87
|
+
// Send the data to the back-end.
|
88
|
+
});
|
89
|
+
}
|
90
|
+
|
91
|
+
Note that in a real-world app you _might_ code a couple of events in the view, but
|
92
|
+
beyond a trivial view, you'll create a view controller and put those events there!
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#Introduction
|
2
|
+
|
3
|
+
In this lab you'll create the details container.
|
4
|
+
|
5
|
+
#Steps
|
6
|
+
|
7
|
+
??Plan your work
|
8
|
+
|
9
|
+
The detail component you're creating in this lab will show details about the selected
|
10
|
+
business.
|
11
|
+
|
12
|
+
Conceptually, the details view "reflects details for the specified business,"
|
13
|
+
so you'll set it up with a _business_ property, just like you did for the tab container.
|
14
|
+
Main will detect the _businessChange_ event, then pass the business to the details
|
15
|
+
view by assigning the business record to the detail view's property.
|
16
|
+
|
17
|
+
The details view will be contained within the main container, off to the right. We have a
|
18
|
+
choice about how to lay things out: we could have main arrange its items via _hbox_ layout,
|
19
|
+
with two items in its `items:[]` — the tab container and the details view —
|
20
|
+
or we could make the details view another docked item, docked on the right. We'll do the latter.
|
21
|
+
|
22
|
+
Main already listens to the _businessChange_ event. You'll modify that code to have it pass the
|
23
|
+
business to the details view you're creating in this lab.
|
24
|
+
|
25
|
+
??Create the panel
|
26
|
+
|
27
|
+
Use the `create-class` script to create a class named `Yelp.view.business.Details`
|
28
|
+
that extends `container.Base`.
|
29
|
+
|
30
|
+
Add a `ntype:'yelp-business-details',` config to the new class. We can use
|
31
|
+
that when we create an instance in the main view, and it might come in handy
|
32
|
+
when debugging.
|
33
|
+
|
34
|
+
??Create a <kbd>business_</kbd> property
|
35
|
+
|
36
|
+
Continue editing `business/Details.mjs` and create a <kbd>business_:null,</kbd>
|
37
|
+
property, and a corresponding `afterSetBusiness(business)` method that logs
|
38
|
+
the passed business.
|
39
|
+
|
40
|
+
??Use the class in the main view
|
41
|
+
|
42
|
+
Import the new details view, and modify the corresponding entry in the `items:[]`
|
43
|
+
to create the details view. Configure it with `reference: 'details'`.
|
44
|
+
|
45
|
+
??Update the business as the user selects items on the map
|
46
|
+
|
47
|
+
The main view controller is detecting changes to the business
|
48
|
+
from the tabs view. Modify that code to pass the information onto the details
|
49
|
+
view.
|
50
|
+
|
51
|
+
onBusinessChange(business){
|
52
|
+
this.getReference('details').business = business;
|
53
|
+
}
|
54
|
+
|
55
|
+
Note that the code no longer needs the console log it had, so we'll
|
56
|
+
delete it to avoid consusion with the console log in the details view.
|
57
|
+
|
58
|
+
Save and refresh, and and as you choose map markers you should
|
59
|
+
see the log emanating from the details view.
|
60
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
I'm too lazy to do anything that isn't extremely easy. So even typing `Neo.findFirst({... `
|
2
|
+
is a burden.
|
3
|
+
|
4
|
+
What's easier is just clicking on a component, and instantly logging the component and its
|
5
|
+
containment hierarchy.
|
6
|
+
|
7
|
+
But a regular click is too commonly used for things like buttons,
|
8
|
+
so we'll choose something more uncommon — _Ctrl-right-click_.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
1. Put the event code in `index.html`
|
2
|
+
1. Copy the code and paste the Neo.mjs method to `MainContainer.mjs`
|
3
|
+
2. Refresh the app
|
4
|
+
1. Ctrl-right-click on one of the tab buttons — the component and hierarchy is logged
|
5
|
+
|
6
|
+
If you need one of those references in a variable — for example, to run a method on it —right-click on the component logged in the console and choose _Store object as global variable_.
|
7
|
+
(Make sure you are viewing the app worker context, or _Store object as global variable_ won't work.)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
A _right-click_ fires the _contextmenu_ event.
|
2
|
+
|
3
|
+
Somewhere, somehow, we need to have the main thread add a DOM event that
|
4
|
+
listens to _contextmenu_, detect if _Ctrl_ is being pressed, then let
|
5
|
+
our Neo app know.
|
6
|
+
|
7
|
+
We could put the code that does that in a bookmarklet, but then we'd have to re-run
|
8
|
+
it every time the browser refreshes. Instead, we'll put that code in `index.html`.
|
9
|
+
|
10
|
+
<pre class="runnable html">
|
11
|
+
<!DOCTYPE HTML>
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
15
|
+
<meta charset="UTF-8">
|
16
|
+
<title>Starter</title>
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<script src="../../src/MicroLoader.mjs" type="module"></script>
|
20
|
+
<script>
|
21
|
+
new MutationObserver((mutationsList, observer) => {
|
22
|
+
for (let mutation of mutationsList) {
|
23
|
+
for (let addedNode of mutation.addedNodes) {
|
24
|
+
if (addedNode.className && addedNode.className.includes('neo-viewport')) {
|
25
|
+
addedNode.addEventListener("contextmenu", function (e) {
|
26
|
+
if (!(e.ctrlKey || e.metaKey)) return;
|
27
|
+
e.stopPropagation();
|
28
|
+
e.preventDefault();
|
29
|
+
const event = new Event('neo-debug-item-select', {bubbles: true});
|
30
|
+
e.target.dispatchEvent(event);
|
31
|
+
});
|
32
|
+
observer.disconnect(); // We found the viewport so we're finished listening
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}).observe(document.body, {childList: true, subtree: false});
|
37
|
+
</script>
|
38
|
+
</body>
|
39
|
+
</html>
|
40
|
+
</pre>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Here's the corresponding method that listens to the custom event. You place this in your main view.
|
2
|
+
|
3
|
+
<pre class="runnable text readonly 280">
|
4
|
+
afterSetMounted(value, oldValue) {
|
5
|
+
super.afterSetMounted(value, oldValue);
|
6
|
+
if (!value) return;
|
7
|
+
this.addDomListeners({
|
8
|
+
"neo-debug-item-select": event => {
|
9
|
+
event.path.forEach(item => {
|
10
|
+
const component = Neo.getComponent(item.id);
|
11
|
+
if (component) console.log(component);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
});
|
15
|
+
}
|
16
|
+
</pre>
|