├── scriptedforms ├── .yarnrc ├── dev_utilities │ ├── __init__.py │ └── jupyterlab_extracts │ │ ├── __init__.py │ │ └── LICENSE ├── e2e │ ├── src │ │ ├── .gitignore │ │ ├── landing-page.md │ │ ├── variable-table.csv │ │ ├── section-start.md │ │ ├── variable-string.md │ │ ├── section-live.md │ │ ├── section-output.md │ │ ├── watchdog-manage.md │ │ ├── section-button.md │ │ ├── watchdog-template.md │ │ ├── protractor.conf.ts │ │ ├── utilities │ │ │ ├── send-token.ts │ │ │ └── before-and-after.ts │ │ ├── variable-table.py │ │ ├── landing-page.spec.ts │ │ ├── section-start.spec.ts │ │ ├── section-live.spec.ts │ │ ├── variable-table.md │ │ ├── section-output.spec.ts │ │ ├── variable-table.spec.ts │ │ ├── watchdog-test.spec.ts │ │ ├── section-button.spec.ts │ │ └── variable-string.spec.ts │ ├── tsconfig.e2e.json │ ├── tsconfig.json │ ├── package.json │ ├── run-test.py │ └── tslint.json ├── src │ ├── docs │ │ ├── landing-page │ │ │ ├── landing-page.component.html │ │ │ └── landing-page.component.ts │ │ ├── doc.component.ts │ │ ├── doc.component.html │ │ ├── doc.routing.ts │ │ ├── style.css │ │ ├── doc.module.ts │ │ └── developer-guide │ │ │ └── README.md │ ├── vendors │ │ ├── misc.ts │ │ ├── angular-styles.ts │ │ ├── jupyterlab-styles.ts │ │ ├── jupyterlab.ts │ │ ├── angular.ts │ │ ├── material.module.ts │ │ └── theme.scss │ ├── polyfills.ts │ ├── tsconfig.app.json │ ├── public-path.ts │ ├── tsconfig.spec.json │ ├── app │ │ ├── types │ │ │ ├── form-status.ts │ │ │ ├── variable-value.ts │ │ │ ├── section-component.ts │ │ │ └── variable-component.ts │ │ ├── interfaces │ │ │ ├── slider.ts │ │ │ ├── variable-store.ts │ │ │ └── pandas-table.ts │ │ ├── variables-module │ │ │ ├── variable-file.component.html │ │ │ ├── number-base.component.ts │ │ │ ├── conditional.component.ts │ │ │ ├── variable-parameter.component.ts │ │ │ ├── tick.component.ts │ │ │ ├── toggle.component.ts │ │ │ ├── number.component.ts │ │ │ ├── variable-file.component.ts │ │ │ ├── string.component.ts │ │ │ ├── variables.module.ts │ │ │ ├── dropdown.component.ts │ │ │ └── slider.component.ts │ │ ├── code-module │ │ │ └── code.module.ts │ │ ├── sections-module │ │ │ ├── start.component.ts │ │ │ ├── sections.module.ts │ │ │ ├── output.component.ts │ │ │ ├── section-file-change.component.ts │ │ │ ├── section-base.component.ts │ │ │ └── button.component.ts │ │ ├── form-builder-module │ │ │ ├── form-builder.module.ts │ │ │ └── session-start-code.ts │ │ ├── app.component.html │ │ ├── services │ │ │ ├── jupyter.service.ts │ │ │ ├── toolbar.service.ts │ │ │ ├── watchdog-code.ts │ │ │ ├── form.service.ts │ │ │ ├── initialisation.service.ts │ │ │ └── watchdog.service.ts │ │ ├── toolbar-module │ │ │ ├── toolbar.module.ts │ │ │ ├── toolbar-button.component.ts │ │ │ └── toolbar-base.component.ts │ │ ├── app-error-handler.ts │ │ ├── app.module.ts │ │ └── style.css │ ├── component-html.d.ts │ ├── docs.ts │ ├── app.ts │ ├── main.ts │ └── dev.ts ├── scripts │ ├── selenium.sh │ ├── pypi.sh │ ├── wait_for_selenium.sh │ ├── travis_script.sh │ ├── pip-freeze.sh │ └── travis_install.sh ├── __main__.py ├── scriptedforms.json ├── webpack.dev.js ├── _version.py ├── docs │ ├── docs-base.md │ ├── landing-page.md │ ├── docs.css │ └── create-your-own-angular-jupyterlab-extension.md ├── webpack.prod.js ├── tsconfig.json ├── __init__.py ├── webpack.config.js ├── index.html ├── _scriptedforms_handlers.py ├── scriptedforms.py ├── forms │ └── agree-to-license.md ├── tslint.json ├── angular.json └── package.json ├── deploy ├── docker │ ├── postgres │ │ └── Dockerfile │ ├── jupyterhub │ │ └── Dockerfile │ ├── nginx.conf │ ├── docker-compose.yml │ └── README.md ├── python-package │ ├── example │ │ ├── experimental │ │ │ ├── __init__.py │ │ │ ├── file-change.csv │ │ │ ├── two-columns.md │ │ │ └── file-change.md │ │ ├── code-template-split │ │ │ ├── __init__.py │ │ │ ├── functions.py │ │ │ ├── data.py │ │ │ └── template-only.md │ │ ├── __init__.py │ │ ├── __main__.py │ │ ├── example.py │ │ └── simple.md │ ├── MANIFEST.in │ ├── setup.py │ └── README.md └── windows-only │ └── portable-zip │ ├── .gitignore │ ├── scriptedforms.bat │ ├── package.json │ ├── README.md │ ├── my-forms │ ├── a-simple-form.md │ ├── landing-page.md │ └── a-slider.md │ └── build-instructions.md ├── images ├── detailed.png └── quick-start.png ├── MANIFEST.in ├── .vscode └── settings.json ├── .travis.yml ├── setup.py ├── .gitignore └── code-of-conduct.md /scriptedforms/.yarnrc: -------------------------------------------------------------------------------- 1 | network-timeout 600000 -------------------------------------------------------------------------------- /scriptedforms/dev_utilities/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deploy/docker/postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres -------------------------------------------------------------------------------- /scriptedforms/e2e/src/.gitignore: -------------------------------------------------------------------------------- 1 | watchdog-test.md -------------------------------------------------------------------------------- /scriptedforms/e2e/src/landing-page.md: -------------------------------------------------------------------------------- 1 | # A landing page -------------------------------------------------------------------------------- /deploy/python-package/example/experimental/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deploy/docker/jupyterhub/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jupyterhub/jupyterhub -------------------------------------------------------------------------------- /deploy/python-package/example/code-template-split/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scriptedforms/dev_utilities/jupyterlab_extracts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deploy/python-package/example/__init__.py: -------------------------------------------------------------------------------- 1 | from .__main__ import main -------------------------------------------------------------------------------- /deploy/windows-only/portable-zip/.gitignore: -------------------------------------------------------------------------------- 1 | python/ 2 | scriptedforms*.zip -------------------------------------------------------------------------------- /deploy/python-package/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE Apache-2.0 2 | include example/*.md 3 | -------------------------------------------------------------------------------- /images/detailed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonBiggs/scriptedforms/HEAD/images/detailed.png -------------------------------------------------------------------------------- /images/quick-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonBiggs/scriptedforms/HEAD/images/quick-start.png -------------------------------------------------------------------------------- /scriptedforms/src/docs/landing-page/landing-page.component.html: -------------------------------------------------------------------------------- 1 |
-------------------------------------------------------------------------------- /scriptedforms/scripts/selenium.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "$0")"/../e2e 3 | yarn selenium 4 | cd - 5 | -------------------------------------------------------------------------------- /deploy/python-package/example/__main__.py: -------------------------------------------------------------------------------- 1 | from .example import main 2 | 3 | if __name__ == '__main__': 4 | main() 5 | -------------------------------------------------------------------------------- /scriptedforms/__main__.py: -------------------------------------------------------------------------------- 1 | from .scriptedforms import main as _main 2 | 3 | if __name__ == '__main__': 4 | _main() 5 | -------------------------------------------------------------------------------- /scriptedforms/scripts/pypi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "$0")"/../../ 3 | python setup.py sdist upload -r pypi 4 | cd - 5 | -------------------------------------------------------------------------------- /scriptedforms/src/vendors/misc.ts: -------------------------------------------------------------------------------- 1 | import '../public-path'; 2 | 3 | import 'json-stable-stringify'; 4 | import 'markdown-it'; 5 | import 'uuid'; 6 | -------------------------------------------------------------------------------- /scriptedforms/scriptedforms.json: -------------------------------------------------------------------------------- 1 | { 2 | "NotebookApp": { 3 | "nbserver_extensions": { 4 | "scriptedforms": true 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /deploy/windows-only/portable-zip/scriptedforms.bat: -------------------------------------------------------------------------------- 1 | start "%~dp0\python\python-3.5.4.amd64\python.exe" -m scriptedforms "%~dp0\my-forms\landing-page.md" 2 | -------------------------------------------------------------------------------- /scriptedforms/e2e/src/variable-table.csv: -------------------------------------------------------------------------------- 1 | index,1st,2nd,3rd,4th,5th,6th 2 | a,False,"""",12,apple,sally,1.2123 3 | b,True,,13,apple,philip,2.0 4 | c,True,,1,pear,green,3.0 -------------------------------------------------------------------------------- /scriptedforms/src/vendors/angular-styles.ts: -------------------------------------------------------------------------------- 1 | import 'style-loader!css-loader!sass-loader!./theme.scss'; 2 | import 'material-design-icons/iconfont/material-icons.css'; 3 | -------------------------------------------------------------------------------- /scriptedforms/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | import './public-path'; 2 | 3 | // Polyfills 4 | import 'core-js/es6/reflect'; 5 | import 'core-js/es7/reflect'; 6 | import 'zone.js/dist/zone'; 7 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft scriptedforms 2 | global-exclude *.py[co] yarn-error.log 3 | prune scriptedforms/node_modules 4 | prune scriptedforms/e2e/node_modules 5 | prune scriptedforms/e2e/build -------------------------------------------------------------------------------- /deploy/python-package/example/experimental/file-change.csv: -------------------------------------------------------------------------------- 1 | index,1st,2nd,3rd,4th,5th,6th 2 | a,False,"""",12,apple,sally,1.2123 3 | b,True,,13,apple,philip,2.0 4 | c,True,,1,pear,green,3.0 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.linting.enabled": true, 3 | "python.linting.pylintEnabled": false, 4 | "python.linting.flake8Enabled": true, 5 | "python.linting.mypyEnabled": false 6 | } 7 | -------------------------------------------------------------------------------- /scriptedforms/scripts/wait_for_selenium.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | printf 'Waiting for Selenium server to load\n' 4 | until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do 5 | printf '.' 6 | sleep 1 7 | done 8 | printf '\n' -------------------------------------------------------------------------------- /scriptedforms/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015" 7 | }, 8 | "exclude": [ 9 | "test.ts", 10 | "**/*.spec.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /scriptedforms/src/public-path.ts: -------------------------------------------------------------------------------- 1 | declare var __webpack_public_path__: any; 2 | const CONFIG_DIV = document.getElementById('scriptedforms-config-data'); 3 | 4 | if (CONFIG_DIV) { 5 | const config = JSON.parse(CONFIG_DIV.textContent); 6 | __webpack_public_path__ = config.publicPath; 7 | } 8 | -------------------------------------------------------------------------------- /scriptedforms/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /deploy/python-package/example/code-template-split/functions.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from IPython.display import display, Markdown 3 | 4 | display(Markdown( 5 | 'Loaded functions.py at {}' 6 | .format(str(datetime.now())) 7 | )) 8 | 9 | 10 | def increment(a_table): 11 | a_table.loc['6MV', 'Meas1'] += 1 12 | -------------------------------------------------------------------------------- /scriptedforms/e2e/src/section-start.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |{{code}}36 | // A Javascript error has occured. This could be due to an error within your 37 | // ScriptedForms template or an issue with ScriptedForms itself. 38 | //
39 | //43 | // ` + error + '
{{code}}{{code}}`
34 | })
35 | export class SectionFileChangeComponent extends SectionBaseComponent implements OnDestroy, AfterViewInit {
36 | sectionType = 'filechange';
37 | watchdogSubscription: Subscription;
38 | pathsConverted: string[];
39 |
40 | @Input() paths: string;
41 |
42 | @ViewChild('variableParameterComponent') variableParameterComponent: VariableParameterComponent;
43 |
44 | constructor(
45 | private myWatchdogService: WatchdogService
46 | ) { super(); }
47 |
48 | updateFilepathObserver() {
49 | this.pathsConverted.forEach(value => {
50 | this.myWatchdogService.addFilepathObserver(value);
51 | });
52 | }
53 |
54 | ngAfterViewInit() {
55 | super.ngAfterViewInit();
56 | // this.updateFilepathObserver()
57 |
58 | this.variableParameterComponent.variableChange.asObservable().subscribe((value: string[]) => {
59 | this.pathsConverted = value;
60 | this.updateFilepathObserver();
61 | });
62 |
63 | this.watchdogSubscription = this.myWatchdogService.fileChanged.subscribe((value: string) => {
64 | if (this.pathsConverted) {
65 | if (
66 | (this.pathsConverted.includes(value)) ||
67 | (this.pathsConverted.includes(`./${value}`)) ||
68 | (this.pathsConverted.includes(`.\\${value}`))
69 | ) {
70 | this.runCode();
71 | }
72 | }
73 | });
74 | }
75 |
76 | ngOnDestroy() {
77 | this.watchdogSubscription.unsubscribe();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Directory for instrumented libs generated by jscoverage/JSCover
15 | lib-cov
16 |
17 | # Coverage directory used by tools like istanbul
18 | coverage
19 |
20 | # nyc test coverage
21 | .nyc_output
22 |
23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24 | .grunt
25 |
26 | # Bower dependency directory (https://bower.io/)
27 | bower_components
28 |
29 | # node-waf configuration
30 | .lock-wscript
31 |
32 | # Compiled binary addons (http://nodejs.org/api/addons.html)
33 | build/Release
34 |
35 | # Dependency directories
36 | node_modules/
37 | jspm_packages/
38 |
39 | # Typescript v1 declaration files
40 | typings/
41 |
42 | # Optional npm cache directory
43 | .npm
44 |
45 | # Optional eslint cache
46 | .eslintcache
47 |
48 | # Optional REPL history
49 | .node_repl_history
50 |
51 | # Output of 'npm pack'
52 | *.tgz
53 |
54 | # Yarn Integrity file
55 | .yarn-integrity
56 |
57 | # dotenv environment variables file
58 | .env
59 |
60 |
61 | build
62 | lib
63 |
64 | # Byte-compiled / optimized / DLL files
65 | __pycache__/
66 | *.py[cod]
67 | *$py.class
68 |
69 | # C extensions
70 | *.so
71 |
72 | # Distribution / packaging
73 | .Python
74 | env/
75 | build/
76 | develop-eggs/
77 | dist/
78 | downloads/
79 | eggs/
80 | .eggs/
81 | lib/
82 | lib64/
83 | parts/
84 | sdist/
85 | var/
86 | wheels/
87 | *.egg-info/
88 | .installed.cfg
89 | *.egg
90 |
91 | # PyInstaller
92 | # Usually these files are written by a python script from a template
93 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
94 | *.manifest
95 | *.spec
96 |
97 | # Installer logs
98 | pip-log.txt
99 | pip-delete-this-directory.txt
100 |
101 | # Unit test / coverage reports
102 | htmlcov/
103 | .tox/
104 | .coverage
105 | .coverage.*
106 | .cache
107 | nosetests.xml
108 | coverage.xml
109 | *.cover
110 | .hypothesis/
111 |
112 | # Translations
113 | *.mo
114 | *.pot
115 |
116 | # Django stuff:
117 | *.log
118 | local_settings.py
119 |
120 | # Flask stuff:
121 | instance/
122 | .webassets-cache
123 |
124 | # Scrapy stuff:
125 | .scrapy
126 |
127 | # Sphinx documentation
128 | docs/_build/
129 |
130 | # PyBuilder
131 | target/
132 |
133 | # Jupyter Notebook
134 | .ipynb_checkpoints
135 |
136 | # pyenv
137 | .python-version
138 |
139 | # celery beat schedule file
140 | celerybeat-schedule
141 |
142 | # SageMath parsed files
143 | *.sage.py
144 |
145 | # dotenv
146 | .env
147 |
148 | # virtualenv
149 | .venv
150 | venv/
151 | ENV/
152 |
153 | # Spyder project settings
154 | .spyderproject
155 | .spyproject
156 |
157 | # Rope project settings
158 | .ropeproject
159 |
160 | # mkdocs documentation
161 | /site
162 |
163 | # mypy
164 | .mypy_cache/
165 |
166 | scriptedforms/jlab-build
167 |
--------------------------------------------------------------------------------
/scriptedforms/src/dev.ts:
--------------------------------------------------------------------------------
1 | // Scripted Forms -- Making GUIs easy for everyone on your team.
2 | // Copyright (C) 2017 Simon Biggs
3 |
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 |
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | import {
17 | PromiseDelegate
18 | } from '@phosphor/coreutils';
19 |
20 | import {
21 | ServerConnection, Session, KernelMessage, ServiceManager
22 | } from '@jupyterlab/services';
23 |
24 |
25 | export function loadDev(serviceManager = new ServiceManager()) {
26 | // const serviceManager = new ServiceManager();
27 | runDevModeWatchdog(serviceManager);
28 | }
29 |
30 | const watchdogDevModeCode = `
31 | import os
32 | from watchdog.observers import Observer
33 | from watchdog.events import FileSystemEventHandler, FileModifiedEvent
34 |
35 | import scriptedforms
36 |
37 | class MyHandler(FileSystemEventHandler):
38 | def on_modified(self, event):
39 | if type(event) == FileModifiedEvent:
40 | print(os.path.abspath(event.src_path))
41 |
42 | event_handler = MyHandler()
43 | observer = Observer()
44 | observer.schedule(
45 | event_handler,
46 | path=os.path.join(os.path.dirname(scriptedforms.__file__), 'lib'),
47 | recursive=True)
48 | observer.start()
49 | `;
50 |
51 | function runDevModeWatchdog(serviceManager: ServiceManager) {
52 | const sessionReady = new PromiseDelegate
50 |
51 | The use of commas or semicolons to separate inputs is deprecated.
52 | Please instead use html parameters like so:
53 | <variable-slider min="{{min}}" max="{{max}}" step="{{step}}">{{variableName}}</variable-slider>
54 |
55 |
56 | {{code}}
72 |
73 | The use of the "name" parameter has been deprecated. Please use the
74 | "value" parameter instead.
75 |
76 | Replace:
77 |
78 | <section-button name="${this.value}">
79 |
80 | With:
81 |
82 | <section-button value="${this.value}">
83 |
84 |
85 | `;
86 | divElement.classList.add('jp-RenderedText');
87 | element.appendChild(divElement);
88 | }
89 |
90 | constructor(
91 | public myElementRef: ElementRef
92 | ) { super(); }
93 |
94 | ngAfterViewInit() {
95 | super.ngAfterViewInit();
96 |
97 | if (this.conditional) {
98 | const value: any = this.conditionalComponent.variableValue;
99 | this.conditionalValue = value;
100 |
101 | this.conditionalComponent.variableChange.asObservable().subscribe((newValue: boolean) => {
102 | this.conditionalValue = newValue;
103 | });
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/scriptedforms/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "scriptedforms": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "architect": {
11 | "build": {
12 | "builder": "@angular-devkit/build-angular:browser",
13 | "options": {
14 | "outputPath": "lib",
15 | "index": "src/index.html",
16 | "main": "src/main.ts",
17 | "tsConfig": "src/tsconfig.app.json",
18 | "polyfills": "src/polyfills.ts",
19 | "assets": [
20 | "src/assets",
21 | "src/favicon.ico"
22 | ],
23 | "styles": [
24 | "src/styles.css"
25 | ],
26 | "scripts": []
27 | },
28 | "configurations": {
29 | "prod": {
30 | "fileReplacements": [
31 | {
32 | "replace": "src/environments/environment.ts",
33 | "with": "src/environments/environment.prod.ts"
34 | }
35 | ]
36 | }
37 | }
38 | },
39 | "serve": {
40 | "builder": "@angular-devkit/build-angular:dev-server",
41 | "options": {
42 | "browserTarget": "scriptedforms:build"
43 | },
44 | "configurations": {
45 | "prod": {
46 | "browserTarget": "scriptedforms:build:prod"
47 | }
48 | }
49 | },
50 | "extract-i18n": {
51 | "builder": "@angular-devkit/build-angular:extract-i18n",
52 | "options": {
53 | "browserTarget": "scriptedforms:build"
54 | }
55 | },
56 | "test": {
57 | "builder": "@angular-devkit/build-angular:karma",
58 | "options": {
59 | "main": "src/test.ts",
60 | "karmaConfig": "./karma.conf.js",
61 | "polyfills": "src/polyfills.ts",
62 | "tsConfig": "src/tsconfig.spec.json",
63 | "scripts": [],
64 | "styles": [
65 | "src/styles.css"
66 | ],
67 | "assets": [
68 | "src/assets",
69 | "src/favicon.ico"
70 | ]
71 | }
72 | },
73 | "lint": {
74 | "builder": "@angular-devkit/build-angular:tslint",
75 | "options": {
76 | "tsConfig": [
77 | "src/tsconfig.app.json",
78 | "src/tsconfig.spec.json"
79 | ],
80 | "exclude": [
81 | "**/node_modules/**"
82 | ]
83 | }
84 | }
85 | }
86 | },
87 | "scriptedforms-e2e": {
88 | "root": "",
89 | "sourceRoot": "",
90 | "projectType": "application",
91 | "architect": {
92 | "e2e": {
93 | "builder": "@angular-devkit/build-angular:protractor",
94 | "options": {
95 | "protractorConfig": "./protractor.conf.js",
96 | "devServerTarget": "scriptedforms:serve"
97 | }
98 | },
99 | "lint": {
100 | "builder": "@angular-devkit/build-angular:tslint",
101 | "options": {
102 | "tsConfig": [
103 | "e2e/tsconfig.e2e.json"
104 | ],
105 | "exclude": [
106 | "**/node_modules/**"
107 | ]
108 | }
109 | }
110 | }
111 | }
112 | },
113 | "defaultProject": "scriptedforms",
114 | "schematics": {
115 | "@schematics/angular:component": {
116 | "prefix": "app",
117 | "styleext": "css"
118 | },
119 | "@schematics/angular:directive": {
120 | "prefix": "app"
121 | }
122 | }
123 | }
--------------------------------------------------------------------------------
/scriptedforms/src/app/toolbar-module/toolbar-base.component.ts:
--------------------------------------------------------------------------------
1 | // Scripted Forms -- Making GUIs easy for everyone on your team.
2 | // Copyright (C) 2017 Simon Biggs
3 |
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 |
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | /*
17 | Creates the [button] section.
18 |
19 | A section that runs all code within it whenever the user presses the provided
20 | button.
21 |
22 | By calling the function `runCode` on this component all code components within
23 | this section will be iteratively run. The button is set to call the runCode
24 | function on click.
25 | */
26 |
27 | import { BehaviorSubject } from 'rxjs';
28 |
29 | import {
30 | ComponentFactoryResolver, AfterViewInit, ComponentFactory, ViewChild,
31 | ViewContainerRef, ChangeDetectorRef
32 | } from '@angular/core';
33 |
34 | import {
35 | Component,
36 | // Input
37 | } from '@angular/core';
38 |
39 | import {
40 | // BoxLayout,
41 | Widget
42 | } from '@phosphor/widgets';
43 |
44 | import {
45 | ToolbarButtonComponent, IOptions
46 | } from './toolbar-button.component';
47 |
48 | import {
49 | ToolbarService
50 | } from '../services/toolbar.service';
51 |
52 | import { FormService } from '../services/form.service';
53 |
54 | @Component({
55 | selector: 'toolbar-base',
56 | template: `