├── .gitattributes ├── .gitignore ├── README.md ├── Resources ├── builder.png └── viewer.png ├── build ├── optimajet-builder.js └── optimajet-form.js ├── demo ├── ajaxinterceptor.js ├── application-form-data.json ├── application-form.json ├── build │ ├── optimajet-builder.js │ └── optimajet-form.js ├── builder.html ├── contactform.json ├── css │ ├── fonts │ │ ├── lato-bold-700-latin-ext.woff2 │ │ ├── lato-bold-700-latin.woff2 │ │ ├── lato-bolditalic-700-latin-ext.woff2 │ │ ├── lato-bolditalic-700-latin.woff2 │ │ ├── lato-italic-400-latin-ext.woff2 │ │ ├── lato-italic-400-latin.woff2 │ │ ├── lato-regular-400-latin-ext.woff2 │ │ ├── lato-regular-400-latin.woff2 │ │ └── semantic-font.css │ ├── optimajet-formbuilder.css │ ├── semantic.min.css │ └── themes │ │ └── default │ │ └── assets │ │ └── fonts │ │ ├── icons.eot │ │ ├── icons.svg │ │ ├── icons.ttf │ │ ├── icons.woff │ │ └── icons.woff2 ├── download.html ├── favicon.ico ├── formbuilderdev-builder.js ├── formbuilderdev-viewer.js ├── formsample.html ├── formsample.js ├── images │ ├── builder.png │ ├── collapse.svg │ ├── dwkitbuilder-copy.svg │ ├── dwkitbuilder-delete.svg │ ├── dwkitbuilder-edit.svg │ ├── dwkitbuilder-info.png │ ├── dwkitbuilder-move.svg │ ├── dwkitbuilder-sarr.png │ ├── dwkitbuilder-toolbar-move.png │ ├── expand.svg │ ├── formsample.png │ ├── logo.svg │ ├── logoviewer.svg │ ├── mobile-frame.png │ ├── unknown.png │ └── viewer.png ├── index.html ├── package-lock.json ├── package.json ├── scripts │ ├── Chart.min.js │ ├── ace.js │ ├── jquery.js │ ├── json5.js │ ├── mode-csharp.js │ ├── mode-javascript.js │ ├── mode-json.js │ ├── react-data-grid.js │ ├── theme-monokai.js │ ├── worker-javascript.js │ └── worker-json.js ├── src │ └── readme.md ├── toolbarbuttons.json ├── tsconfig.json ├── upload.html ├── viewer.html └── webpack.config.js ├── eula.txt ├── readme.md ├── release-notes.md └── version.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | [Bb]in/ 15 | [Oo]bj/ 16 | 17 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 18 | !packages/*/build/ 19 | 20 | #node.js 21 | node_modules/ 22 | 23 | # MSTest test Results 24 | [Tt]est[Rr]esult*/ 25 | [Bb]uild[Ll]og.* 26 | 27 | *_i.c 28 | *_p.c 29 | *.ilk 30 | # *.meta 31 | *.obj 32 | *.pch 33 | *.pdb 34 | *.pgc 35 | *.pgd 36 | *.rsp 37 | *.sbr 38 | *.tlb 39 | *.tli 40 | *.tlh 41 | *.tmp 42 | *.tmp_proj 43 | *.log 44 | *.vspscc 45 | *.vssscc 46 | .builds 47 | *.pidb 48 | *.log 49 | *.scc 50 | 51 | # Visual C++ cache files 52 | ipch/ 53 | *.aps 54 | *.ncb 55 | *.opensdf 56 | *.sdf 57 | *.cachefile 58 | 59 | # Visual Studio profiler 60 | *.psess 61 | *.vsp 62 | *.vspx 63 | .vs/ 64 | 65 | # Guidance Automation Toolkit 66 | *.gpState 67 | 68 | # ReSharper is a .NET coding add-in 69 | _ReSharper*/ 70 | *.[Rr]e[Ss]harper 71 | 72 | # TeamCity is a build add-in 73 | _TeamCity* 74 | 75 | #IDEA 76 | .idea/ 77 | 78 | # DotCover is a Code Coverage Tool 79 | *.dotCover 80 | 81 | # NCrunch 82 | *.ncrunch* 83 | .*crunch*.local.xml 84 | 85 | # Installshield output folder 86 | [Ee]xpress/ 87 | 88 | # DocProject is a documentation generator add-in 89 | DocProject/buildhelp/ 90 | DocProject/Help/*.HxT 91 | DocProject/Help/*.HxC 92 | DocProject/Help/*.hhc 93 | DocProject/Help/*.hhk 94 | DocProject/Help/*.hhp 95 | DocProject/Help/Html2 96 | DocProject/Help/html 97 | 98 | # Click-Once directory 99 | publish/ 100 | 101 | # Publish Web Output 102 | *.Publish.xml 103 | 104 | # NuGet Packages Directory 105 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 106 | packages/ 107 | 108 | # Windows Azure Build Output 109 | csx 110 | *.build.csdef 111 | 112 | # Windows Store app package directory 113 | AppPackages/ 114 | 115 | # Others 116 | *.Cache 117 | ClientBin/ 118 | [Ss]tyle[Cc]op.* 119 | ~$* 120 | *~ 121 | *.dbmdl 122 | *.[Pp]ublish.xml 123 | *.pfx 124 | *.publishsettings 125 | 126 | # RIA/Silverlight projects 127 | Generated_Code/ 128 | 129 | # Backup & report files from converting an old project file to a newer 130 | # Visual Studio version. Backup files are not needed, because we have git ;-) 131 | _UpgradeReport_Files/ 132 | UpgradeLog*.XML 133 | UpgradeLog*.htm 134 | 135 | # SQL Server files 136 | App_Data/*.mdf 137 | App_Data/*.ldf 138 | 139 | 140 | #LightSwitch generated files 141 | GeneratedArtifacts/ 142 | _Pvt_Extensions/ 143 | ModelManifest.xml 144 | 145 | # ========================= 146 | # Windows detritus 147 | # ========================= 148 | 149 | # Windows image file caches 150 | Thumbs.db 151 | ehthumbs.db 152 | 153 | # Folder config file 154 | Desktop.ini 155 | 156 | # Recycle Bin used on file shares 157 | $RECYCLE.BIN/ 158 | 159 | # Mac desktop service store files 160 | .DS_Store 161 | Logs/ 162 | Optimajet.DWKit.StarterApplication/bower_components/ 163 | Samples/VacationRequest/OptimaJet.DWKit.StarterApplication/bower_components/ 164 | .vs/ 165 | *.lock 166 | 167 | .archives 168 | *.app.js.map 169 | *.nupkg 170 | *.js.map 171 | aspnet-keys 172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OptimaJet FormBuilder 2 | 3 | FormBuilder - is a lightweight, user-friendly, effective and essential form tool used to create and manage forms. It is based on React and 4 | can be integrated into any web app. 5 | 6 | For deployment and further development, you will need the following toolkit: 7 | 8 | - npm; 9 | - webpack 3 (!); 10 | 11 | 1. Run the commands in the project's root folder: 12 | ```bash 13 | cd demo 14 | npm install --legacy-peer-deps 15 | npm run start 16 | ``` 17 | 18 | 2. Open the sample in a browser (by default at http://localhost:8080/) 19 | 20 | ## Features 21 | 22 | - Drag-&-drop form builder 23 | - Templates 24 | - Inline parameters 25 | - Event-based 26 | - JSON file format 27 | - Clean HTML layout 28 | 29 | ## Screenshots 30 | 31 | [![Form Builder](https://raw.githubusercontent.com/optimajet/formbuilder/master/Resources/builder.png "Form Builder")](https://formbuilder.dev/demo/) 32 | 33 | [![Form Viewer](https://raw.githubusercontent.com/optimajet/formbuilder/master/Resources/viewer.png "Form Viewer")](https://formbuilder.dev/viewer/) 34 | 35 | ## Information 36 | 37 | - **Official website** - [https://formbuilder.dev](https://formbuilder.dev) 38 | - **Documentation** - [https://formbuilder.dev/documentation/](https://formbuilder.dev/documentation/) 39 | - **Demo** - [https://formbuilder.dev/demo/](https://formbuilder.dev/demo/) 40 | 41 | For commercial use, please contact [support@optimajet.com](mailto:support@optimajet.com). 42 | -------------------------------------------------------------------------------- /Resources/builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/Resources/builder.png -------------------------------------------------------------------------------- /Resources/viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/Resources/viewer.png -------------------------------------------------------------------------------- /demo/ajaxinterceptor.js: -------------------------------------------------------------------------------- 1 | // based on https://github.com/slorber/ajax-interceptor 2 | 3 | // restore prototype chain: https://github.com/HubSpot/pace/issues/261 4 | 5 | const XMLHttpRequestProto = Object.getPrototypeOf(new XMLHttpRequest); 6 | if (XMLHttpRequestProto !== XMLHttpRequest.prototype) { 7 | XMLHttpRequest.prototype = XMLHttpRequestProto; 8 | } 9 | 10 | const RealXHRSend = XMLHttpRequest.prototype.send; 11 | const RealXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; 12 | 13 | let authToken = null; 14 | const browserFetch = window.fetch; 15 | 16 | const requestCallbacks = []; 17 | let onRequestCallback = null; 18 | 19 | let wired = false; 20 | 21 | function arrayRemove(array, item) { 22 | const index = array.indexOf(item); 23 | if (index > -1) { 24 | array.splice(index, 1); 25 | } else { 26 | throw new Error('Could not remove ' + item + ' from array'); 27 | } 28 | } 29 | 30 | function fireCallbacks(callbacks, xhr) { 31 | for (let i = 0; i < callbacks.length; i++) { 32 | callbacks[i](xhr); 33 | } 34 | } 35 | 36 | const ajaxInterceptor = { 37 | addRequestCallback: function (callback) { 38 | requestCallbacks.push(callback); 39 | }, 40 | removeRequestCallback: function (callback) { 41 | arrayRemove(requestCallbacks, callback); 42 | }, 43 | 44 | isWired: function () { 45 | return wired; 46 | }, 47 | 48 | wire: function () { 49 | if (wired) { 50 | throw new Error('Ajax interceptor already wired'); 51 | } 52 | 53 | // Override send method of all XHR requests 54 | XMLHttpRequest.prototype.send = function () { 55 | 56 | // Fire request callbacks before sending the request 57 | fireCallbacks(requestCallbacks, this); 58 | 59 | if (this.authToken) { // setting Authorization header for the last saved token 60 | RealXHRSetRequestHeader.apply(this, ['Authorization', this.authToken]); 61 | } 62 | 63 | RealXHRSend.apply(this, arguments); 64 | }; 65 | 66 | XMLHttpRequest.prototype.setRequestHeader = function (name, value) { 67 | 68 | if (name === 'Authorization') { 69 | this.authToken = value; //saving authToken instead of creating the header 70 | authToken = this.authToken; 71 | } else { 72 | RealXHRSetRequestHeader.apply(this, arguments); 73 | } 74 | }; 75 | 76 | 77 | wired = true; 78 | }, 79 | 80 | unwire: function () { 81 | if (!wired) { 82 | throw new Error('Ajax interceptor not currently wired'); 83 | } 84 | XMLHttpRequest.prototype.send = RealXHRSend; 85 | XMLHttpRequest.prototype.setRequestHeader = RealXHRSetRequestHeader; 86 | wired = false; 87 | }, 88 | 89 | fetch: function (resource, init) { 90 | const newInit = init || {}; 91 | const headers = newInit.headers || new Headers(); 92 | if (authToken) { 93 | headers.append('Authorization', authToken); 94 | } 95 | newInit.headers = headers; 96 | return browserFetch(resource, newInit); 97 | }, 98 | 99 | configureHeaders: function (accessToken) { 100 | let options = null; 101 | 102 | if (window.globalFetchOptions) { 103 | options = window.globalFetchOptions(); 104 | } 105 | 106 | if (!options) { 107 | options = {headers : {}}; 108 | } 109 | 110 | const bearerHeader = accessToken ? ('Bearer ' + accessToken) : null; 111 | 112 | options.headers = { 113 | ...options.headers, 114 | 'Authorization': bearerHeader 115 | }; 116 | 117 | if (onRequestCallback) { 118 | ajaxInterceptor.removeRequestCallback(onRequestCallback); 119 | } else { 120 | ajaxInterceptor.wire(); 121 | } 122 | 123 | onRequestCallback = (xhr) => { 124 | xhr.setRequestHeader('Authorization', bearerHeader); 125 | }; 126 | 127 | ajaxInterceptor.addRequestCallback(onRequestCallback); 128 | } 129 | 130 | }; 131 | 132 | export default ajaxInterceptor; -------------------------------------------------------------------------------- /demo/application-form-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Test application", 3 | "firstname": "John", 4 | "lastname": "Doe", 5 | "type": 2, 6 | "comment": "This is a test application for John Doe" 7 | } -------------------------------------------------------------------------------- /demo/application-form.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "header_1", 4 | "data-buildertype": "header", 5 | "content": "Application Form", 6 | "size": "medium", 7 | "subheader": "Make it easier", 8 | "textAlign": "center" 9 | }, 10 | { 11 | "key": "form_1", 12 | "data-buildertype": "form", 13 | "children": [ 14 | { 15 | "key": "title", 16 | "data-buildertype": "input", 17 | "label": "Title", 18 | "fluid": true, 19 | "other-required": false 20 | }, 21 | { 22 | "key": "formgroup_1", 23 | "data-buildertype": "formgroup", 24 | "widths": "equal", 25 | "children": [ 26 | { 27 | "key": "firstname", 28 | "data-buildertype": "input", 29 | "label": "First name", 30 | "fluid": true 31 | }, 32 | { 33 | "key": "lastname", 34 | "data-buildertype": "input", 35 | "label": "Last name", 36 | "fluid": true 37 | } 38 | ] 39 | }, 40 | { 41 | "key": "type", 42 | "data-buildertype": "dropdown", 43 | "label": "Type", 44 | "fluid": true, 45 | "selection": true, 46 | "data-elements": "[{key: 0, value: '', text: ''},\n{key: 1, value: 1, text: 'Internal'},\n{key: 2, value: 2, text: 'External'},\n{key: 3, value: 2, text: 'Direct'}]", 47 | "placeholder": "" 48 | }, 49 | { 50 | "key": "comment", 51 | "data-buildertype": "textarea", 52 | "label": "Comment", 53 | "fluid": true, 54 | "rows": 5 55 | } 56 | ], 57 | "events": {}, 58 | "style-marginBottom": "10px" 59 | }, 60 | { 61 | "key": "btnSave", 62 | "data-buildertype": "button", 63 | "content": "Save", 64 | "primary": true, 65 | "fluid": false, 66 | "events-onclick-actions": [ 67 | "validate", 68 | "saveandexit" 69 | ], 70 | "events": { 71 | "onClick": { 72 | "active": true, 73 | "actions": [ 74 | "save" 75 | ], 76 | "targets": [], 77 | "parameters": [] 78 | } 79 | } 80 | }, 81 | { 82 | "key": "btnCancel", 83 | "data-buildertype": "button", 84 | "content": "Cancel", 85 | "primary": false, 86 | "fluid": false, 87 | "events-onclick-actions": [ 88 | "validate", 89 | "saveandexit" 90 | ], 91 | "events": { 92 | "onClick": { 93 | "active": true, 94 | "actions": [ 95 | "cancel" 96 | ], 97 | "targets": [], 98 | "parameters": [] 99 | } 100 | } 101 | } 102 | ] -------------------------------------------------------------------------------- /demo/builder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OptimaJet Form Builder 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo/contactform.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "demo-contactform", 4 | "data-buildertype": "container", 5 | "children": [ 6 | { 7 | "key": "contactform", 8 | "data-buildertype": "form", 9 | "children": [ 10 | { 11 | "key": "name", 12 | "data-buildertype": "input", 13 | "label": "Name", 14 | "fluid": true, 15 | "onChangeTimeout": 200 16 | }, 17 | { 18 | "key": "email", 19 | "data-buildertype": "input", 20 | "label": "Email", 21 | "fluid": true, 22 | "onChangeTimeout": 200 23 | }, 24 | { 25 | "key": "message", 26 | "data-buildertype": "textarea", 27 | "label": "Message", 28 | "fluid": true, 29 | "rows": "6" 30 | }, 31 | { 32 | "key": "sendbutton", 33 | "data-buildertype": "button", 34 | "content": "Send", 35 | "basic": true, 36 | "events": { 37 | "onClick": { 38 | "active": true, 39 | "actions": [ 40 | "send" 41 | ], 42 | "targets": [], 43 | "parameters": [] 44 | } 45 | } 46 | } 47 | ], 48 | "style-marginBottom": "", 49 | "style-marginTop": "" 50 | } 51 | ] 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /demo/css/fonts/lato-bold-700-latin-ext.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-bold-700-latin-ext.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-bold-700-latin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-bold-700-latin.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-bolditalic-700-latin-ext.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-bolditalic-700-latin-ext.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-bolditalic-700-latin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-bolditalic-700-latin.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-italic-400-latin-ext.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-italic-400-latin-ext.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-italic-400-latin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-italic-400-latin.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-regular-400-latin-ext.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-regular-400-latin-ext.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/lato-regular-400-latin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/fonts/lato-regular-400-latin.woff2 -------------------------------------------------------------------------------- /demo/css/fonts/semantic-font.css: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Lato'; 4 | font-style: italic; 5 | font-weight: 400; 6 | src: local('Lato Italic'), local('Lato-Italic'), url(lato-italic-400-latin-ext.woff2) format('woff2'); 7 | unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; 8 | } 9 | /* latin */ 10 | @font-face { 11 | font-family: 'Lato'; 12 | font-style: italic; 13 | font-weight: 400; 14 | src: local('Lato Italic'), local('Lato-Italic'), url(lato-italic-400-latin.woff2) format('woff2'); 15 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 16 | } 17 | /* latin-ext */ 18 | @font-face { 19 | font-family: 'Lato'; 20 | font-style: italic; 21 | font-weight: 700; 22 | src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(lato-bolditalic-700-latin-ext.woff2) format('woff2'); 23 | unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; 24 | } 25 | /* latin */ 26 | @font-face { 27 | font-family: 'Lato'; 28 | font-style: italic; 29 | font-weight: 700; 30 | src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(lato-bolditalic-700-latin.woff2) format('woff2'); 31 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 32 | } 33 | /* latin-ext */ 34 | @font-face { 35 | font-family: 'Lato'; 36 | font-style: normal; 37 | font-weight: 400; 38 | src: local('Lato Regular'), local('Lato-Regular'), url(lato-regular-400-latin-ext.woff2) format('woff2'); 39 | unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; 40 | } 41 | /* latin */ 42 | @font-face { 43 | font-family: 'Lato'; 44 | font-style: normal; 45 | font-weight: 400; 46 | src: local('Lato Regular'), local('Lato-Regular'), url(lato-regular-400-latin.woff2) format('woff2'); 47 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 48 | } 49 | /* latin-ext */ 50 | @font-face { 51 | font-family: 'Lato'; 52 | font-style: normal; 53 | font-weight: 700; 54 | src: local('Lato Bold'), local('Lato-Bold'), url(lato-bold-700-latin-ext.woff2) format('woff2'); 55 | unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; 56 | } 57 | /* latin */ 58 | @font-face { 59 | font-family: 'Lato'; 60 | font-style: normal; 61 | font-weight: 700; 62 | src: local('Lato Bold'), local('Lato-Bold'), url(lato-bold-700-latin.woff2) format('woff2'); 63 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; 64 | } 65 | -------------------------------------------------------------------------------- /demo/css/themes/default/assets/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/themes/default/assets/fonts/icons.eot -------------------------------------------------------------------------------- /demo/css/themes/default/assets/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/themes/default/assets/fonts/icons.ttf -------------------------------------------------------------------------------- /demo/css/themes/default/assets/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/themes/default/assets/fonts/icons.woff -------------------------------------------------------------------------------- /demo/css/themes/default/assets/fonts/icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/css/themes/default/assets/fonts/icons.woff2 -------------------------------------------------------------------------------- /demo/download.html: -------------------------------------------------------------------------------- 1 | This method is not implemented on this demo-stand. -------------------------------------------------------------------------------- /demo/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/favicon.ico -------------------------------------------------------------------------------- /demo/formbuilderdev-builder.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {DWKitFormBuilder} from "./build/optimajet-builder"; 4 | 5 | function getform(formname) 6 | { 7 | var formurl = formname + ".json"; 8 | var source = $.ajax({ 9 | url: formurl, 10 | async: false, 11 | }).responseJSON; 12 | return source; 13 | } 14 | 15 | function getAdditionalDataForControl(control, 16 | {startIndex, pageSize, filters, sort, model}, 17 | callback) 18 | { 19 | var me = this; 20 | if(control.props["data-buildertype"] == "dictionary"){ 21 | if(model == undefined){ 22 | model = "item"; 23 | } 24 | var items = []; 25 | for(var i = 0 ; i < 3; i++){ 26 | var obj = {}; 27 | obj.key = model + "_" + i; 28 | obj.text = model + "_" + i; 29 | obj.value = i; 30 | items.push(obj); 31 | } 32 | callback({items}); 33 | } 34 | else{ 35 | var rowsCount = 5; 36 | var items = []; 37 | for(var i = 0 ; i < pageSize; i++){ 38 | var obj = {}; 39 | if(control.props.columns == undefined){ 40 | obj["col1"] = "col1_" + (Number(startIndex) + Number(i)); 41 | obj["col2"] = "col2_" + (Number(startIndex) + Number(i)); 42 | obj["col3"] = "col3_" + (Number(startIndex) + Number(i)); 43 | } 44 | else{ 45 | control.props.columns.forEach(function(c){ 46 | obj[c.key] = c.key + "_" + (Number(startIndex) + Number(i)); 47 | }); 48 | } 49 | items.push(obj); 50 | } 51 | callback({startIndex, pageSize, rowsCount, items}); 52 | } 53 | } 54 | 55 | function eventProcess(obj, p) 56 | { 57 | console.log("Event from form:", obj, p); 58 | } 59 | 60 | function eventErrProcess(obj, message){ 61 | alert("Error from the form: " + message); 62 | } 63 | 64 | var actions= [ 65 | {text: "validate", icon: "browser"}, 66 | {text:'refresh', icon: "browser"}, 67 | {text:'save', icon: "browser"}, 68 | {text:'saveandexit', icon: "browser"}, 69 | {text:'cancel', icon: "browser"}, 70 | {text:'recalc', icon: "browser"}, 71 | {text:'add', icon: "browser"}, 72 | {text:'edit', icon: "browser"}, 73 | {text:'delete', icon: "browser"}, 74 | {text:'gridEdit', icon: "browser"}, 75 | {text:'gridDelete', icon: "browser"}, 76 | {text:'gridCopy', icon: "browser"}, 77 | {text:'gridAdd', icon: "browser"} 78 | ]; 79 | 80 | var openViewer = function(){ 81 | var model = formbuilder.getData(); 82 | 83 | var url = window.DWKitFormViewerUrl == undefined ? "viewer.html?model=" : window.DWKitFormViewerUrl; 84 | window.open(url + encodeURIComponent(JSON.stringify(model))); 85 | } 86 | 87 | var templates = ["contactform", "toolbarbuttons"]; 88 | var buttons = [ 89 | { name: "viever", className: "primary", onClick: openViewer, text: "Open in Viewer"} 90 | ] 91 | var formbuilder; 92 | ReactDOM.render( 93 | { formbuilder = builder; }} 99 | downloadUrl="download.html?file=" 100 | uploadUrl="upload.html?file=" 101 | templates={templates} 102 | extraHeaderButtons={buttons} 103 | />, 104 | document.getElementById('container') 105 | ); 106 | 107 | 108 | formbuilder.load('./application-form'); 109 | 110 | formbuilder.getStore().listen(function (form) { 111 | // log form data on change 112 | console.log(JSON.stringify(form)); 113 | }); 114 | -------------------------------------------------------------------------------- /demo/formbuilderdev-viewer.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {DWKitFormViewer} from "./build/optimajet-builder"; 4 | 5 | function getQueryString() { 6 | // This function is anonymous, is executed immediately and 7 | // the return value is assigned to QueryString! 8 | var query_string = {}; 9 | var query = window.location.search.substring(1); 10 | var vars = query.split("&"); 11 | for (var i = 0; i < vars.length; i++) { 12 | var pair = vars[i].split("="); 13 | // If first entry with this name 14 | if (typeof query_string[pair[0]] === "undefined") { 15 | query_string[pair[0]] = pair[1]; 16 | // If second entry with this name 17 | } else if (typeof query_string[pair[0]] === "string") { 18 | var arr = [query_string[pair[0]], pair[1]]; 19 | query_string[pair[0]] = arr; 20 | // If third or later entry with this name 21 | } else { 22 | query_string[pair[0]].push(pair[1]); 23 | } 24 | } 25 | return query_string; 26 | } 27 | 28 | function getform(formname) 29 | { 30 | var formurl = formname + ".json"; 31 | var source = $.ajax({ 32 | url: formurl, 33 | async: false, 34 | }).responseJSON; 35 | return source; 36 | } 37 | 38 | function eventProcess(obj, p) 39 | { 40 | console.log("Event from form:", obj, p); 41 | } 42 | 43 | function eventErrProcess(obj, message){ 44 | alert("Error from the form: " + message); 45 | } 46 | 47 | var formurl = "./application-form.json"; 48 | var dataurl = "./application-form-data.json"; 49 | 50 | var props = { 51 | eventFunc: eventProcess, 52 | eventErrFunc: eventErrProcess, 53 | getFormFunc: getform, 54 | dataurl: dataurl, 55 | downloadUrl: "download.html?file=", 56 | uploadUrl: "upload.html?file=", 57 | ref: (viewer) => { window.DWKitFormViewer = viewer; } 58 | } 59 | 60 | var query = getQueryString(); 61 | if(query != undefined && query.model != undefined){ 62 | try{ 63 | props.model = JSON.parse(decodeURIComponent(query.model)); 64 | } 65 | catch(ex){ 66 | props.modelurl = formurl; 67 | } 68 | } 69 | else{ 70 | props.modelurl = formurl; 71 | } 72 | 73 | ReactDOM.render( , document.getElementById('container')); 74 | -------------------------------------------------------------------------------- /demo/formsample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OptimaJet Form Sample 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo/formsample.js: -------------------------------------------------------------------------------- 1 | import {DWKitForm} from './build/optimajet-form'; 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | import {validate} from './build/optimajet-form'; 5 | import ajaxInterceptor from './ajaxinterceptor' 6 | 7 | // ajaxInterceptor.configureHeaders("accessToken"); 8 | 9 | const formName = 'Demo'; 10 | const data = { 11 | title: 'Test application', 12 | firstname: 'John', 13 | lastname: 'Doe', 14 | type: 2, 15 | comment: 'This is a test application for John Doe' 16 | }; 17 | 18 | const errors = {}; 19 | 20 | const model = [ 21 | { 22 | key: 'header_1', 23 | 'data-buildertype': 'header', 24 | content: 'Application Form', 25 | size: 'medium', 26 | subheader: 'Make it easier', 27 | textAlign: 'center' 28 | }, 29 | { 30 | key: 'form_1', 31 | 'data-buildertype': 'form', 32 | children: [ 33 | { 34 | key: 'title', 35 | 'data-buildertype': 'input', 36 | label: 'Title', 37 | fluid: true, 38 | 'other-required': false 39 | }, 40 | { 41 | key: 'formgroup_1', 42 | 'data-buildertype': 'formgroup', 43 | widths: 'equal', 44 | children: [ 45 | { 46 | key: 'firstname', 47 | 'data-buildertype': 'input', 48 | label: 'First name', 49 | fluid: true 50 | }, 51 | { 52 | key: 'lastname', 53 | 'data-buildertype': 'input', 54 | label: 'Last name', 55 | fluid: true 56 | } 57 | ] 58 | }, 59 | { 60 | key: 'type', 61 | 'data-buildertype': 'dropdown', 62 | label: 'Type', 63 | fluid: true, 64 | selection: true, 65 | 'data-elements': '[{key: 0, value: \'\', text: \'\'},\n{key: 1, value: 1, text: \'Internal\'},\n{key: 2, value: 2, text: \'External\'},\n{key: 3, value: 2, text: \'Direct\'}]', 66 | placeholder: '' 67 | }, 68 | { 69 | key: 'comment', 70 | 'data-buildertype': 'textarea', 71 | label: 'Comment', 72 | fluid: true, 73 | rows: 5 74 | } 75 | ], 76 | events: {}, 77 | 'style-marginBottom': '10px' 78 | }, 79 | { 80 | key: 'btnSave', 81 | 'data-buildertype': 'button', 82 | content: 'Save', 83 | primary: true, 84 | fluid: false, 85 | 'events-onclick-actions': [ 86 | 'validate', 87 | 'saveandexit' 88 | ], 89 | events: { 90 | onClick: { 91 | active: true, 92 | actions: [ 93 | 'save' 94 | ], 95 | targets: [], 96 | parameters: [] 97 | } 98 | } 99 | }, 100 | { 101 | key: 'btnCancel', 102 | 'data-buildertype': 'button', 103 | content: 'Cancel', 104 | primary: false, 105 | fluid: false, 106 | 'events-onclick-actions': [ 107 | 'validate', 108 | 'saveandexit' 109 | ], 110 | events: { 111 | onClick: { 112 | active: true, 113 | actions: [ 114 | 'cancel' 115 | ], 116 | targets: [], 117 | parameters: [] 118 | } 119 | } 120 | } 121 | ]; 122 | 123 | const form = { 129 | console.log('dataChanged', 'form:', form, 'key:', key, 'value:', value); 130 | }} 131 | eventFunc={(args) => { 132 | console.log('eventFunc', args); 133 | 134 | if(Array.isArray(args.actions) && args.actions.includes("initSystem") && 135 | args.parameters && args.parameters["initialData"]) 136 | { 137 | var initialData = args.parameters["initialData"]; 138 | for(var field in initialData){ 139 | if(!data[field]){ 140 | data[field] = initialData[field]; 141 | } 142 | } 143 | //let {valid, errors} = validate(args.component.props); 144 | //args.component.setState({errors}); 145 | args.component.checkConditions(args.component.props.model); 146 | } 147 | 148 | if(Array.isArray(args.actions) && args.actions.includes("validate")) { 149 | let {valid, errors} = validate(args.component.props); 150 | args.component.setState({errors}); 151 | 152 | if (!valid) throw new Error("Invalid data"); 153 | } 154 | 155 | console.log("Execute next action..."); 156 | }} 157 | getAdditionalDataForControl={(control, { startIndex, pageSize, filters, sort, model }, callback) => { 158 | console.log('getAdditionalDataForControl'); 159 | }} 160 | hideControls={[]} 161 | readOnlyControls={[]} 162 | readOnly={false} 163 | uploadUrl={''} 164 | downloadUrl={''} 165 | autoCheckConditions={true} 166 | autoValidate={true} 167 | />; 168 | 169 | ReactDOM.render(form, document.getElementById('container')); 170 | 171 | -------------------------------------------------------------------------------- /demo/images/builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/builder.png -------------------------------------------------------------------------------- /demo/images/collapse.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Created with Sketch. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-copy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-delete.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-edit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/dwkitbuilder-info.png -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-move.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-sarr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/dwkitbuilder-sarr.png -------------------------------------------------------------------------------- /demo/images/dwkitbuilder-toolbar-move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/dwkitbuilder-toolbar-move.png -------------------------------------------------------------------------------- /demo/images/expand.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Created with Sketch. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/images/formsample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/formsample.png -------------------------------------------------------------------------------- /demo/images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/images/logoviewer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo/images/mobile-frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/mobile-frame.png -------------------------------------------------------------------------------- /demo/images/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/unknown.png -------------------------------------------------------------------------------- /demo/images/viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/optimajet/formbuilder/bceb088bf441abff3810f63d30e2ab547c5f63d4/demo/images/viewer.png -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OptimaJet FormBuilder 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 42 | 43 |
44 | 49 | 69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "optimajet-formbuilder", 3 | "version": "1.22.0", 4 | "description": "OptimaJet FormBuilder", 5 | "main": "lib/app.js", 6 | "scripts": { 7 | "test": "mocha --compilers js:babel-core/register --recursive", 8 | "start": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --hot --inline --env.NODE_ENV=development", 9 | "dist": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --env.prod", 10 | "dist-dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --env.NODE_ENV=development" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/optimateam/dwkit.git" 15 | }, 16 | "keywords": [ 17 | "https://formbuilder.dev" 18 | ], 19 | "author": "OptimaJet", 20 | "license": "SEE LICENSE IN eula.txt", 21 | "dependencies": { 22 | "clone": "2.1.2", 23 | "draft-convert": "2.1.8", 24 | "draft-js": "0.11.3", 25 | "jquery": "^3.5.0", 26 | "json5": "2.1.3", 27 | "moment": "2.25.3", 28 | "numeral": "2.0.6", 29 | 30 | "react": "16.13.1", 31 | "react-data-grid": "4.0.9", 32 | "react-datepicker": "1.6.0", 33 | "react-dom": "16.8.3", 34 | "react-dropzone-component": "3.2.0", 35 | "react-fast-compare": "3.0.2", 36 | "react-grid-layout": "0.16.6", 37 | "react-html5-camera-photo": "^1.5.4", 38 | "react-number-format": "4.3.1", 39 | "react-signature-canvas": "^1.0.3", 40 | "react-slick": "0.25.2", 41 | "react-split": "2.0.7", 42 | "reflux": "6.4.1", 43 | "semantic-ui-react": "0.87.3", 44 | "uuid": "3.3.2" 45 | }, 46 | "devDependencies": { 47 | "@babel/core": "7.9.6", 48 | "@babel/plugin-proposal-class-properties": "^7.8.3", 49 | "@babel/preset-env": "^7.9.6", 50 | "@babel/preset-react": "^7.9.4", 51 | "babel-loader": "^8.1.0", 52 | "babel-polyfill": "^6.26.0", 53 | "cross-env": "^7.0.3", 54 | "uglifyjs-webpack-plugin": "2.1.3", 55 | "webpack": "^4.43.0", 56 | "webpack-cli": "^3.3.11", 57 | "webpack-dev-server": "^3.11.0" 58 | }, 59 | "bugs": { 60 | "url": "https://formbuilder.dev" 61 | }, 62 | "homepage": "https://formbuilder.dev" 63 | } 64 | -------------------------------------------------------------------------------- /demo/scripts/json5.js: -------------------------------------------------------------------------------- 1 | // json5.js 2 | // Modern JSON. See README.md for details. 3 | // 4 | // This file is based directly off of Douglas Crockford's json_parse.js: 5 | // https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js 6 | 7 | var JSON5 = (typeof exports === 'object' ? exports : {}); 8 | 9 | JSON5.parse = (function () { 10 | "use strict"; 11 | 12 | // This is a function that can parse a JSON5 text, producing a JavaScript 13 | // data structure. It is a simple, recursive descent parser. It does not use 14 | // eval or regular expressions, so it can be used as a model for implementing 15 | // a JSON5 parser in other languages. 16 | 17 | // We are defining the function inside of another function to avoid creating 18 | // global variables. 19 | 20 | var at, // The index of the current character 21 | lineNumber, // The current line number 22 | columnNumber, // The current column number 23 | ch, // The current character 24 | escapee = { 25 | "'": "'", 26 | '"': '"', 27 | '\\': '\\', 28 | '/': '/', 29 | '\n': '', // Replace escaped newlines in strings w/ empty string 30 | b: '\b', 31 | f: '\f', 32 | n: '\n', 33 | r: '\r', 34 | t: '\t' 35 | }, 36 | ws = [ 37 | ' ', 38 | '\t', 39 | '\r', 40 | '\n', 41 | '\v', 42 | '\f', 43 | '\xA0', 44 | '\uFEFF' 45 | ], 46 | text, 47 | 48 | renderChar = function (chr) { 49 | return chr === '' ? 'EOF' : "'" + chr + "'"; 50 | }, 51 | 52 | error = function (m) { 53 | 54 | // Call error when something is wrong. 55 | 56 | var error = new SyntaxError(); 57 | // beginning of message suffix to agree with that provided by Gecko - see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse 58 | error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19)); 59 | error.at = at; 60 | // These two property names have been chosen to agree with the ones in Gecko, the only popular 61 | // environment which seems to supply this info on JSON.parse 62 | error.lineNumber = lineNumber; 63 | error.columnNumber = columnNumber; 64 | throw error; 65 | }, 66 | 67 | next = function (c) { 68 | 69 | // If a c parameter is provided, verify that it matches the current character. 70 | 71 | if (c && c !== ch) { 72 | error("Expected " + renderChar(c) + " instead of " + renderChar(ch)); 73 | } 74 | 75 | // Get the next character. When there are no more characters, 76 | // return the empty string. 77 | 78 | ch = text.charAt(at); 79 | at++; 80 | columnNumber++; 81 | if (ch === '\n' || ch === '\r' && peek() !== '\n') { 82 | lineNumber++; 83 | columnNumber = 0; 84 | } 85 | return ch; 86 | }, 87 | 88 | peek = function () { 89 | 90 | // Get the next character without consuming it or 91 | // assigning it to the ch varaible. 92 | 93 | return text.charAt(at); 94 | }, 95 | 96 | identifier = function () { 97 | 98 | // Parse an identifier. Normally, reserved words are disallowed here, but we 99 | // only use this for unquoted object keys, where reserved words are allowed, 100 | // so we don't check for those here. References: 101 | // - http://es5.github.com/#x7.6 102 | // - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables 103 | // - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm 104 | // TODO Identifiers can have Unicode "letters" in them; add support for those. 105 | 106 | var key = ch; 107 | 108 | // Identifiers must start with a letter, _ or $. 109 | if ((ch !== '_' && ch !== '$') && 110 | (ch < 'a' || ch > 'z') && 111 | (ch < 'A' || ch > 'Z')) { 112 | error("Bad identifier as unquoted key"); 113 | } 114 | 115 | // Subsequent characters can contain digits. 116 | while (next() && ( 117 | ch === '_' || ch === '$' || 118 | (ch >= 'a' && ch <= 'z') || 119 | (ch >= 'A' && ch <= 'Z') || 120 | (ch >= '0' && ch <= '9'))) { 121 | key += ch; 122 | } 123 | 124 | return key; 125 | }, 126 | 127 | number = function () { 128 | 129 | // Parse a number value. 130 | 131 | var number, 132 | sign = '', 133 | string = '', 134 | base = 10; 135 | 136 | if (ch === '-' || ch === '+') { 137 | sign = ch; 138 | next(ch); 139 | } 140 | 141 | // support for Infinity (could tweak to allow other words): 142 | if (ch === 'I') { 143 | number = word(); 144 | if (typeof number !== 'number' || isNaN(number)) { 145 | error('Unexpected word for number'); 146 | } 147 | return (sign === '-') ? -number : number; 148 | } 149 | 150 | // support for NaN 151 | if (ch === 'N' ) { 152 | number = word(); 153 | if (!isNaN(number)) { 154 | error('expected word to be NaN'); 155 | } 156 | // ignore sign as -NaN also is NaN 157 | return number; 158 | } 159 | 160 | if (ch === '0') { 161 | string += ch; 162 | next(); 163 | if (ch === 'x' || ch === 'X') { 164 | string += ch; 165 | next(); 166 | base = 16; 167 | } else if (ch >= '0' && ch <= '9') { 168 | error('Octal literal'); 169 | } 170 | } 171 | 172 | switch (base) { 173 | case 10: 174 | while (ch >= '0' && ch <= '9' ) { 175 | string += ch; 176 | next(); 177 | } 178 | if (ch === '.') { 179 | string += '.'; 180 | while (next() && ch >= '0' && ch <= '9') { 181 | string += ch; 182 | } 183 | } 184 | if (ch === 'e' || ch === 'E') { 185 | string += ch; 186 | next(); 187 | if (ch === '-' || ch === '+') { 188 | string += ch; 189 | next(); 190 | } 191 | while (ch >= '0' && ch <= '9') { 192 | string += ch; 193 | next(); 194 | } 195 | } 196 | break; 197 | case 16: 198 | while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') { 199 | string += ch; 200 | next(); 201 | } 202 | break; 203 | } 204 | 205 | if(sign === '-') { 206 | number = -string; 207 | } else { 208 | number = +string; 209 | } 210 | 211 | if (!isFinite(number)) { 212 | error("Bad number"); 213 | } else { 214 | return number; 215 | } 216 | }, 217 | 218 | string = function () { 219 | 220 | // Parse a string value. 221 | 222 | var hex, 223 | i, 224 | string = '', 225 | delim, // double quote or single quote 226 | uffff; 227 | 228 | // When parsing for string values, we must look for ' or " and \ characters. 229 | 230 | if (ch === '"' || ch === "'") { 231 | delim = ch; 232 | while (next()) { 233 | if (ch === delim) { 234 | next(); 235 | return string; 236 | } else if (ch === '\\') { 237 | next(); 238 | if (ch === 'u') { 239 | uffff = 0; 240 | for (i = 0; i < 4; i += 1) { 241 | hex = parseInt(next(), 16); 242 | if (!isFinite(hex)) { 243 | break; 244 | } 245 | uffff = uffff * 16 + hex; 246 | } 247 | string += String.fromCharCode(uffff); 248 | } else if (ch === '\r') { 249 | if (peek() === '\n') { 250 | next(); 251 | } 252 | } else if (typeof escapee[ch] === 'string') { 253 | string += escapee[ch]; 254 | } else { 255 | break; 256 | } 257 | } else if (ch === '\n') { 258 | // unescaped newlines are invalid; see: 259 | // https://github.com/aseemk/json5/issues/24 260 | // TODO this feels special-cased; are there other 261 | // invalid unescaped chars? 262 | break; 263 | } else { 264 | string += ch; 265 | } 266 | } 267 | } 268 | error("Bad string"); 269 | }, 270 | 271 | inlineComment = function () { 272 | 273 | // Skip an inline comment, assuming this is one. The current character should 274 | // be the second / character in the // pair that begins this inline comment. 275 | // To finish the inline comment, we look for a newline or the end of the text. 276 | 277 | if (ch !== '/') { 278 | error("Not an inline comment"); 279 | } 280 | 281 | do { 282 | next(); 283 | if (ch === '\n' || ch === '\r') { 284 | next(); 285 | return; 286 | } 287 | } while (ch); 288 | }, 289 | 290 | blockComment = function () { 291 | 292 | // Skip a block comment, assuming this is one. The current character should be 293 | // the * character in the /* pair that begins this block comment. 294 | // To finish the block comment, we look for an ending */ pair of characters, 295 | // but we also watch for the end of text before the comment is terminated. 296 | 297 | if (ch !== '*') { 298 | error("Not a block comment"); 299 | } 300 | 301 | do { 302 | next(); 303 | while (ch === '*') { 304 | next('*'); 305 | if (ch === '/') { 306 | next('/'); 307 | return; 308 | } 309 | } 310 | } while (ch); 311 | 312 | error("Unterminated block comment"); 313 | }, 314 | 315 | comment = function () { 316 | 317 | // Skip a comment, whether inline or block-level, assuming this is one. 318 | // Comments always begin with a / character. 319 | 320 | if (ch !== '/') { 321 | error("Not a comment"); 322 | } 323 | 324 | next('/'); 325 | 326 | if (ch === '/') { 327 | inlineComment(); 328 | } else if (ch === '*') { 329 | blockComment(); 330 | } else { 331 | error("Unrecognized comment"); 332 | } 333 | }, 334 | 335 | white = function () { 336 | 337 | // Skip whitespace and comments. 338 | // Note that we're detecting comments by only a single / character. 339 | // This works since regular expressions are not valid JSON(5), but this will 340 | // break if there are other valid values that begin with a / character! 341 | 342 | while (ch) { 343 | if (ch === '/') { 344 | comment(); 345 | } else if (ws.indexOf(ch) >= 0) { 346 | next(); 347 | } else { 348 | return; 349 | } 350 | } 351 | }, 352 | 353 | word = function () { 354 | 355 | // true, false, or null. 356 | 357 | switch (ch) { 358 | case 't': 359 | next('t'); 360 | next('r'); 361 | next('u'); 362 | next('e'); 363 | return true; 364 | case 'f': 365 | next('f'); 366 | next('a'); 367 | next('l'); 368 | next('s'); 369 | next('e'); 370 | return false; 371 | case 'n': 372 | next('n'); 373 | next('u'); 374 | next('l'); 375 | next('l'); 376 | return null; 377 | case 'I': 378 | next('I'); 379 | next('n'); 380 | next('f'); 381 | next('i'); 382 | next('n'); 383 | next('i'); 384 | next('t'); 385 | next('y'); 386 | return Infinity; 387 | case 'N': 388 | next( 'N' ); 389 | next( 'a' ); 390 | next( 'N' ); 391 | return NaN; 392 | } 393 | error("Unexpected " + renderChar(ch)); 394 | }, 395 | 396 | value, // Place holder for the value function. 397 | 398 | array = function () { 399 | 400 | // Parse an array value. 401 | 402 | var array = []; 403 | 404 | if (ch === '[') { 405 | next('['); 406 | white(); 407 | while (ch) { 408 | if (ch === ']') { 409 | next(']'); 410 | return array; // Potentially empty array 411 | } 412 | // ES5 allows omitting elements in arrays, e.g. [,] and 413 | // [,null]. We don't allow this in JSON5. 414 | if (ch === ',') { 415 | error("Missing array element"); 416 | } else { 417 | array.push(value()); 418 | } 419 | white(); 420 | // If there's no comma after this value, this needs to 421 | // be the end of the array. 422 | if (ch !== ',') { 423 | next(']'); 424 | return array; 425 | } 426 | next(','); 427 | white(); 428 | } 429 | } 430 | error("Bad array"); 431 | }, 432 | 433 | object = function () { 434 | 435 | // Parse an object value. 436 | 437 | var key, 438 | object = {}; 439 | 440 | if (ch === '{') { 441 | next('{'); 442 | white(); 443 | while (ch) { 444 | if (ch === '}') { 445 | next('}'); 446 | return object; // Potentially empty object 447 | } 448 | 449 | // Keys can be unquoted. If they are, they need to be 450 | // valid JS identifiers. 451 | if (ch === '"' || ch === "'") { 452 | key = string(); 453 | } else { 454 | key = identifier(); 455 | } 456 | 457 | white(); 458 | next(':'); 459 | object[key] = value(); 460 | white(); 461 | // If there's no comma after this pair, this needs to be 462 | // the end of the object. 463 | if (ch !== ',') { 464 | next('}'); 465 | return object; 466 | } 467 | next(','); 468 | white(); 469 | } 470 | } 471 | error("Bad object"); 472 | }; 473 | 474 | value = function () { 475 | 476 | // Parse a JSON value. It could be an object, an array, a string, a number, 477 | // or a word. 478 | 479 | white(); 480 | switch (ch) { 481 | case '{': 482 | return object(); 483 | case '[': 484 | return array(); 485 | case '"': 486 | case "'": 487 | return string(); 488 | case '-': 489 | case '+': 490 | case '.': 491 | return number(); 492 | default: 493 | return ch >= '0' && ch <= '9' ? number() : word(); 494 | } 495 | }; 496 | 497 | // Return the json_parse function. It will have access to all of the above 498 | // functions and variables. 499 | 500 | return function (source, reviver) { 501 | var result; 502 | 503 | text = String(source); 504 | at = 0; 505 | lineNumber = 1; 506 | columnNumber = 1; 507 | ch = ' '; 508 | result = value(); 509 | white(); 510 | if (ch) { 511 | error("Syntax error"); 512 | } 513 | 514 | // If there is a reviver function, we recursively walk the new structure, 515 | // passing each name/value pair to the reviver function for possible 516 | // transformation, starting with a temporary root object that holds the result 517 | // in an empty key. If there is not a reviver function, we simply return the 518 | // result. 519 | 520 | return typeof reviver === 'function' ? (function walk(holder, key) { 521 | var k, v, value = holder[key]; 522 | if (value && typeof value === 'object') { 523 | for (k in value) { 524 | if (Object.prototype.hasOwnProperty.call(value, k)) { 525 | v = walk(value, k); 526 | if (v !== undefined) { 527 | value[k] = v; 528 | } else { 529 | delete value[k]; 530 | } 531 | } 532 | } 533 | } 534 | return reviver.call(holder, key, value); 535 | }({'': result}, '')) : result; 536 | }; 537 | }()); 538 | 539 | // JSON5 stringify will not quote keys where appropriate 540 | JSON5.stringify = function (obj, replacer, space) { 541 | if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) { 542 | throw new Error('Replacer must be a function or an array'); 543 | } 544 | var getReplacedValueOrUndefined = function(holder, key, isTopLevel) { 545 | var value = holder[key]; 546 | 547 | // Replace the value with its toJSON value first, if possible 548 | if (value && value.toJSON && typeof value.toJSON === "function") { 549 | value = value.toJSON(); 550 | } 551 | 552 | // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for 553 | // presence in the array (removing the key/value pair from the resulting JSON if the key is missing). 554 | if (typeof(replacer) === "function") { 555 | return replacer.call(holder, key, value); 556 | } else if(replacer) { 557 | if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) { 558 | return value; 559 | } else { 560 | return undefined; 561 | } 562 | } else { 563 | return value; 564 | } 565 | }; 566 | 567 | function isWordChar(c) { 568 | return (c >= 'a' && c <= 'z') || 569 | (c >= 'A' && c <= 'Z') || 570 | (c >= '0' && c <= '9') || 571 | c === '_' || c === '$'; 572 | } 573 | 574 | function isWordStart(c) { 575 | return (c >= 'a' && c <= 'z') || 576 | (c >= 'A' && c <= 'Z') || 577 | c === '_' || c === '$'; 578 | } 579 | 580 | function isWord(key) { 581 | if (typeof key !== 'string') { 582 | return false; 583 | } 584 | if (!isWordStart(key[0])) { 585 | return false; 586 | } 587 | var i = 1, length = key.length; 588 | while (i < length) { 589 | if (!isWordChar(key[i])) { 590 | return false; 591 | } 592 | i++; 593 | } 594 | return true; 595 | } 596 | 597 | // export for use in tests 598 | JSON5.isWord = isWord; 599 | 600 | // polyfills 601 | function isArray(obj) { 602 | if (Array.isArray) { 603 | return Array.isArray(obj); 604 | } else { 605 | return Object.prototype.toString.call(obj) === '[object Array]'; 606 | } 607 | } 608 | 609 | function isDate(obj) { 610 | return Object.prototype.toString.call(obj) === '[object Date]'; 611 | } 612 | 613 | var objStack = []; 614 | function checkForCircular(obj) { 615 | for (var i = 0; i < objStack.length; i++) { 616 | if (objStack[i] === obj) { 617 | throw new TypeError("Converting circular structure to JSON"); 618 | } 619 | } 620 | } 621 | 622 | function makeIndent(str, num, noNewLine) { 623 | if (!str) { 624 | return ""; 625 | } 626 | // indentation no more than 10 chars 627 | if (str.length > 10) { 628 | str = str.substring(0, 10); 629 | } 630 | 631 | var indent = noNewLine ? "" : "\n"; 632 | for (var i = 0; i < num; i++) { 633 | indent += str; 634 | } 635 | 636 | return indent; 637 | } 638 | 639 | var indentStr; 640 | if (space) { 641 | if (typeof space === "string") { 642 | indentStr = space; 643 | } else if (typeof space === "number" && space >= 0) { 644 | indentStr = makeIndent(" ", space, true); 645 | } else { 646 | // ignore space parameter 647 | } 648 | } 649 | 650 | // Copied from Crokford's implementation of JSON 651 | // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195 652 | // Begin 653 | var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 654 | escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 655 | meta = { // table of character substitutions 656 | '\b': '\\b', 657 | '\t': '\\t', 658 | '\n': '\\n', 659 | '\f': '\\f', 660 | '\r': '\\r', 661 | '"' : '\\"', 662 | '\\': '\\\\' 663 | }; 664 | function escapeString(string) { 665 | 666 | // If the string contains no control characters, no quote characters, and no 667 | // backslash characters, then we can safely slap some quotes around it. 668 | // Otherwise we must also replace the offending characters with safe escape 669 | // sequences. 670 | escapable.lastIndex = 0; 671 | return escapable.test(string) ? '"' + string.replace(escapable, function (a) { 672 | var c = meta[a]; 673 | return typeof c === 'string' ? 674 | c : 675 | '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 676 | }) + '"' : '"' + string + '"'; 677 | } 678 | // End 679 | 680 | function internalStringify(holder, key, isTopLevel) { 681 | var buffer, res; 682 | 683 | // Replace the value, if necessary 684 | var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel); 685 | 686 | if (obj_part && !isDate(obj_part)) { 687 | // unbox objects 688 | // don't unbox dates, since will turn it into number 689 | obj_part = obj_part.valueOf(); 690 | } 691 | switch(typeof obj_part) { 692 | case "boolean": 693 | return obj_part.toString(); 694 | 695 | case "number": 696 | if (isNaN(obj_part) || !isFinite(obj_part)) { 697 | return "null"; 698 | } 699 | return obj_part.toString(); 700 | 701 | case "string": 702 | return escapeString(obj_part.toString()); 703 | 704 | case "object": 705 | if (obj_part === null) { 706 | return "null"; 707 | } else if (isArray(obj_part)) { 708 | checkForCircular(obj_part); 709 | buffer = "["; 710 | objStack.push(obj_part); 711 | 712 | for (var i = 0; i < obj_part.length; i++) { 713 | res = internalStringify(obj_part, i, false); 714 | buffer += makeIndent(indentStr, objStack.length); 715 | if (res === null || typeof res === "undefined") { 716 | buffer += "null"; 717 | } else { 718 | buffer += res; 719 | } 720 | if (i < obj_part.length-1) { 721 | buffer += ","; 722 | } else if (indentStr) { 723 | buffer += "\n"; 724 | } 725 | } 726 | objStack.pop(); 727 | buffer += makeIndent(indentStr, objStack.length, true) + "]"; 728 | } else { 729 | checkForCircular(obj_part); 730 | buffer = "{"; 731 | var nonEmpty = false; 732 | objStack.push(obj_part); 733 | for (var prop in obj_part) { 734 | if (obj_part.hasOwnProperty(prop)) { 735 | var value = internalStringify(obj_part, prop, false); 736 | isTopLevel = false; 737 | if (typeof value !== "undefined" && value !== null) { 738 | buffer += makeIndent(indentStr, objStack.length); 739 | nonEmpty = true; 740 | key = isWord(prop) ? prop : escapeString(prop); 741 | buffer += key + ":" + (indentStr ? ' ' : '') + value + ","; 742 | } 743 | } 744 | } 745 | objStack.pop(); 746 | if (nonEmpty) { 747 | buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}"; 748 | } else { 749 | buffer = '{}'; 750 | } 751 | } 752 | return buffer; 753 | default: 754 | // functions and undefined should be ignored 755 | return undefined; 756 | } 757 | } 758 | 759 | // special case...when undefined is used inside of 760 | // a compound object/array, return null. 761 | // but when top-level, return undefined 762 | var topLevelHolder = {"":obj}; 763 | if (obj === undefined) { 764 | return getReplacedValueOrUndefined(topLevelHolder, '', true); 765 | } 766 | return internalStringify(topLevelHolder, '', true); 767 | }; 768 | -------------------------------------------------------------------------------- /demo/scripts/mode-csharp.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),ace.define("ace/mode/csharp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o=function(){var e=this.createKeywordMapper({"variable.language":"this",keyword:"abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic","constant.language":"null|true|false"},"identifier");this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},i.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string",regex:/'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/},{token:"string",start:'"',end:'"|$',next:[{token:"constant.language.escape",regex:/\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},{token:"invalid",regex:/\\./}]},{token:"string",start:'@"',end:'"',next:[{token:"constant.language.escape",regex:'""'}]},{token:"string",start:/\$"/,end:'"|$',next:[{token:"constant.language.escape",regex:/\\(:?$)|{{/},{token:"constant.language.escape",regex:/\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},{token:"invalid",regex:/\\./}]},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:e,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"keyword",regex:"^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"},{token:"punctuation.operator",regex:"\\?|\\:|\\,|\\;|\\."},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}]},this.embedRules(i,"doc-",[i.getEndRule("start")]),this.normalizeRules()};r.inherits(o,s),t.CSharpHighlightRules=o}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/folding/csharp",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./cstyle").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.usingRe=/^\s*using \S/,this.getFoldWidgetRangeBase=this.getFoldWidgetRange,this.getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=this.getFoldWidgetBase(e,t,n);if(!r){var i=e.getLine(n);if(/^\s*#region\b/.test(i))return"start";var s=this.usingRe;if(s.test(i)){var o=e.getLine(n-1),u=e.getLine(n+1);if(!s.test(o)&&s.test(u))return"start"}}return r},this.getFoldWidgetRange=function(e,t,n){var r=this.getFoldWidgetRangeBase(e,t,n);if(r)return r;var i=e.getLine(n);if(this.usingRe.test(i))return this.getUsingStatementBlock(e,i,n);if(/^\s*#region\b/.test(i))return this.getRegionBlock(e,i,n)},this.getUsingStatementBlock=function(e,t,n){var r=t.match(this.usingRe)[0].length-1,s=e.getLength(),o=n,u=n;while(++no){var a=e.getLine(u).length;return new i(o,r,u,a)}},this.getRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*#(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/csharp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/csharp_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/csharp"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./csharp_highlight_rules").CSharpHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/csharp").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"){var o=t.match(/^.*[\{\(\[]\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){return null},this.$id="ace/mode/csharp"}.call(f.prototype),t.Mode=f}) -------------------------------------------------------------------------------- /demo/scripts/mode-javascript.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function a(){var e=o.replace("\\d","\\d\\-"),t={onMatch:function(e,t,n){var r=e.charAt(1)=="/"?2:1;if(r==1)t!=this.nextState?n.unshift(this.next,this.nextState,0):n.unshift(this.next),n[2]++;else if(r==2&&t==this.nextState){n[1]--;if(!n[1]||n[1]<0)n.shift(),n.shift()}return[{type:"meta.tag.punctuation."+(r==1?"":"end-")+"tag-open.xml",value:e.slice(0,r)},{type:"meta.tag.tag-name.xml",value:e.substr(r)}]},regex:"",onMatch:function(e,t,n){return t==n[0]&&n.shift(),e.length==2&&(n[0]==this.nextState&&n[1]--,(!n[1]||n[1]<0)&&n.splice(0,2)),this.next=n[0]||"start",[{type:this.token,value:e}]},nextState:"jsx"},n,f("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:e},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},t],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function f(e){return[{token:"comment",regex:/\/\*/,next:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[i.getTagRule(),{token:"comment",regex:"$|^",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*",u=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[i.getStartRule("doc-start"),f("no_regex"),{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+o+")(\\.)(prototype)(\\.)("+o+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+o+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:"(?:"+n+")\\b",next:"start"},{token:["support.constant"],regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/},{token:t,regex:o},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:o},{regex:"",token:"empty",next:"no_regex"}],start:[i.getStartRule("doc-start"),f("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],function_arguments:[{token:"variable.parameter",regex:o},{token:"punctuation.operator",regex:"[, ]+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]};if(!e||!e.noES6)this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(e,t,n){this.next=e=="{"?this.nextState:"";if(e=="{"&&n.length)n.unshift("start",t);else if(e=="}"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1)return"paren.quasi.end"}return e=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:r},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]}),(!e||e.jsx!=0)&&a.call(this);this.embedRules(i,"doc-",[i.getEndRule("no_regex")]),this.normalizeRules()};r.inherits(u,s),t.JavaScriptHighlightRules=u}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./javascript_highlight_rules").JavaScriptHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../worker/worker_client").WorkerClient,a=e("./behaviour/cstyle").CstyleBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"||e=="no_regex"){var u=t.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc-start"){if(o=="start"||o=="no_regex")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/javascript"}.call(l.prototype),t.Mode=l}) -------------------------------------------------------------------------------- /demo/scripts/mode-json.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"invalid.illegal",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"invalid.illegal",regex:"\\/\\/.*$"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'[^"\\\\]+'},{token:"string",regex:'"',next:"start"},{token:"string",regex:"",next:"start"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/cstyle").FoldMode,f=e("../worker/worker_client").WorkerClient,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f(["ace"],"ace/mode/json_worker","JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(l.prototype),t.Mode=l}) -------------------------------------------------------------------------------- /demo/scripts/theme-monokai.js: -------------------------------------------------------------------------------- 1 | ace.define("ace/theme/monokai",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-monokai",t.cssText=".ace-monokai .ace_gutter {background: #2F3129;color: #8F908A}.ace-monokai .ace_print-margin {width: 1px;background: #555651}.ace-monokai {background-color: #272822;color: #F8F8F2}.ace-monokai .ace_cursor {color: #F8F8F0}.ace-monokai .ace_marker-layer .ace_selection {background: #49483E}.ace-monokai.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #272822;}.ace-monokai .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-monokai .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #49483E}.ace-monokai .ace_marker-layer .ace_active-line {background: #202020}.ace-monokai .ace_gutter-active-line {background-color: #272727}.ace-monokai .ace_marker-layer .ace_selected-word {border: 1px solid #49483E}.ace-monokai .ace_invisible {color: #52524d}.ace-monokai .ace_entity.ace_name.ace_tag,.ace-monokai .ace_keyword,.ace-monokai .ace_meta.ace_tag,.ace-monokai .ace_storage {color: #F92672}.ace-monokai .ace_punctuation,.ace-monokai .ace_punctuation.ace_tag {color: #fff}.ace-monokai .ace_constant.ace_character,.ace-monokai .ace_constant.ace_language,.ace-monokai .ace_constant.ace_numeric,.ace-monokai .ace_constant.ace_other {color: #AE81FF}.ace-monokai .ace_invalid {color: #F8F8F0;background-color: #F92672}.ace-monokai .ace_invalid.ace_deprecated {color: #F8F8F0;background-color: #AE81FF}.ace-monokai .ace_support.ace_constant,.ace-monokai .ace_support.ace_function {color: #66D9EF}.ace-monokai .ace_fold {background-color: #A6E22E;border-color: #F8F8F2}.ace-monokai .ace_storage.ace_type,.ace-monokai .ace_support.ace_class,.ace-monokai .ace_support.ace_type {font-style: italic;color: #66D9EF}.ace-monokai .ace_entity.ace_name.ace_function,.ace-monokai .ace_entity.ace_other,.ace-monokai .ace_entity.ace_other.ace_attribute-name,.ace-monokai .ace_variable {color: #A6E22E}.ace-monokai .ace_variable.ace_parameter {font-style: italic;color: #FD971F}.ace-monokai .ace_string {color: #E6DB74}.ace-monokai .ace_comment {color: #75715E}.ace-monokai .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}) -------------------------------------------------------------------------------- /demo/scripts/worker-json.js: -------------------------------------------------------------------------------- 1 | "no use strict";(function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}})(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;othis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4&&this.$splitAndapplyLargeDelta(e,2e4),i(this.$lines,e,t),this._signal("change",e)},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length,i=e.start.row,s=e.start.column,o=0,u=0;do{o=u,u+=t-1;var a=n.slice(o,u);if(u>r){e.lines=a,e.start.row=i+o,e.start.column=s;break}a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}while(!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n="0"&&i<="9")t+=i,a();if(i==="."){t+=".";while(a()&&i>="0"&&i<="9")t+=i}if(i==="e"||i==="E"){t+=i,a();if(i==="-"||i==="+")t+=i,a();while(i>="0"&&i<="9")t+=i,a()}e=+t;if(!isNaN(e))return e;u("Bad number")},l=function(){var e,t,n="",r;if(i==='"')while(a()){if(i==='"')return a(),n;if(i==="\\"){a();if(i==="u"){r=0;for(t=0;t<4;t+=1){e=parseInt(a(),16);if(!isFinite(e))break;r=r*16+e}n+=String.fromCharCode(r)}else{if(typeof s[i]!="string")break;n+=s[i]}}else n+=i}u("Bad string")},c=function(){while(i&&i<=" ")a()},h=function(){switch(i){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}u("Unexpected '"+i+"'")},p,d=function(){var e=[];if(i==="["){a("["),c();if(i==="]")return a("]"),e;while(i){e.push(p()),c();if(i==="]")return a("]"),e;a(","),c()}}u("Bad array")},v=function(){var e,t={};if(i==="{"){a("{"),c();if(i==="}")return a("}"),t;while(i){e=l(),c(),a(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=p(),c();if(i==="}")return a("}"),t;a(","),c()}}u("Bad object")};return p=function(){c();switch(i){case"{":return v();case"[":return d();case'"':return l();case"-":return f();default:return i>="0"&&i<="9"?f():h()}},function(e,t){var n;return o=e,r=0,i=" ",n=p(),c(),i&&u("Syntax error"),typeof t=="function"?function s(e,n){var r,i,o=e[n];if(o&&typeof o=="object")for(r in o)Object.hasOwnProperty.call(o,r)&&(i=s(o,r),i!==undefined?o[r]=i:delete o[r]);return t.call(e,n,o)}({"":n},""):n}}),define("ace/mode/json_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/json/json_parse"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../worker/mirror").Mirror,s=e("./json/json_parse"),o=t.JsonWorker=function(e){i.call(this,e),this.setTimeout(200)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue(),t=[];try{e&&s(e)}catch(n){var r=this.doc.indexToPosition(n.at-1);t.push({row:r.row,column:r.column,text:n.message,type:"error"})}this.sender.emit("annotate",t)}}.call(o.prototype)}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+ta)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n 2 | 3 | 4 | OptimaJet Form Builder 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |
17 |
18 | 19 | 20 | 24 | 25 |
26 |
27 |
28 | 29 | 30 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); 3 | 4 | var config = { 5 | // TODO: Add common Configuration 6 | module: {}, 7 | plugins: [] 8 | }; 9 | 10 | module.exports = (env) => { 11 | const isDevBuild = !(env ? env.prod : process.env && process.env.NODE_ENV === "production"); 12 | 13 | var viewerConfig = Object.assign({}, config, { 14 | name: "app", 15 | entry: ["babel-polyfill", "./formbuilderdev-viewer.js"], 16 | mode: isDevBuild ? "development" : "production", 17 | output: { 18 | filename: "formbuilderdev-viewer.js", 19 | path: __dirname + "/build" 20 | }, 21 | 22 | module: { 23 | rules: [ 24 | { 25 | test: /.jsx?$/, exclude: /node_modules/, use: { 26 | loader: 'babel-loader', 27 | options: { 28 | presets: ['@babel/preset-env', '@babel/preset-react'], 29 | plugins: ['@babel/plugin-proposal-class-properties'], 30 | } 31 | } 32 | }, 33 | { test: /\.scss$/, use: 'style-loader!css-loader!sass-loader' } 34 | ] 35 | }, 36 | resolve: { 37 | extensions: ['*', '.js', '.json', '.jsx', '.css', '.scss'] 38 | } 39 | }); 40 | 41 | var builderConfig = Object.assign({}, config, { 42 | name: "app", 43 | entry: ["babel-polyfill", "./formbuilderdev-builder.js"], 44 | mode: isDevBuild ? "development" : "production", 45 | output: { 46 | filename: "formbuilderdev-builder.js", 47 | path: __dirname + "/build" 48 | }, 49 | 50 | module: { 51 | rules: [ 52 | { 53 | test: /.jsx?$/, exclude: /node_modules/, use: { 54 | loader: 'babel-loader', 55 | options: { 56 | presets: ['@babel/preset-env', '@babel/preset-react'], 57 | plugins: ['@babel/plugin-proposal-class-properties'], 58 | } 59 | } 60 | }, 61 | { test: /\.scss$/, use: 'style-loader!css-loader!sass-loader' } 62 | ] 63 | }, 64 | resolve: { 65 | extensions: ['*', '.js', '.json', '.jsx', '.css', '.scss'] 66 | } 67 | }); 68 | 69 | var formConfig = Object.assign({}, config, { 70 | name: "app", 71 | entry: ["babel-polyfill", "./formsample.js"], 72 | mode: isDevBuild ? "development" : "production", 73 | output: { 74 | filename: "formsample.js", 75 | path: __dirname + "/build" 76 | }, 77 | 78 | module: { 79 | rules: [ 80 | { 81 | test: /.jsx?$/, exclude: /node_modules/, use: { 82 | loader: 'babel-loader', 83 | options: { 84 | presets: ['@babel/preset-env', '@babel/preset-react'], 85 | plugins: ['@babel/plugin-proposal-class-properties'], 86 | } 87 | } 88 | }, 89 | { test: /\.scss$/, use: 'style-loader!css-loader!sass-loader' } 90 | ] 91 | }, 92 | resolve: { 93 | extensions: ['*', '.js', '.json', '.jsx', '.css', '.scss'] 94 | } 95 | }); 96 | 97 | return [ 98 | viewerConfig, 99 | builderConfig, 100 | formConfig 101 | ]; 102 | }; -------------------------------------------------------------------------------- /eula.txt: -------------------------------------------------------------------------------- 1 | End user license agreement 2 | OptimaJet FormBuilder 3 | 4 | © 2023 Optimajet Limited 5 | 6 | IMPORTANT — READ CAREFULLY: This Optimajet Limited (“OPTIMAJET”) End-User License Agreement (“EULA”) is a legal agreement between you, a developer of software applications, (“Developer End User”) and OPTIMAJET for all OPTIMAJET products, frameworks, components, source code, demos, intermediate files, media, printed materials, and online or electronic documentation (“SOFTWARE DEVELOPMENT PRODUCT(S)”) contained in this distribution. 7 | 8 | By installing, copying, or otherwise using the SOFTWARE DEVELOPMENT PRODUCT(S), you agree to be bound by the terms of this EULA. If you do not agree to any part of the terms of this EULA, DO NOT INSTALL, COPY, USE, EVALUATE, OR REPLICATE IN ANY MANNER, ANY PART, FILE OR PORTION OF THE SOFTWARE DEVELOPMENT PRODUCT(S). 9 | 10 | All SOFTWARE DEVELOPMENT PRODUCT(S) is licensed, not sold. 11 | 12 | RIGOROUS ENFORCEMENT OF INTELLECTUAL PROPERTY RIGHTS. If the licensed right of use for this SOFTWARE DEVELOPMENT PRODUCT(S) is purchased by you with any intent to reverse engineer, decompile, create derivative works, and the exploitation or unauthorized transfer of, any OPTIMAJET intellectual property and trade secrets, to include any exposed methods or source code where provided, no licensed right of use shall exist, and any PRODUCT(s) created as a result shall be judged illegal by definition of all applicable law. Any sale or resale of intellectual property or created derivatives so obtained will be prosecuted to the fullest extent of all local, federal and international law. 13 | 14 | 1. Grant of license 15 | Subject to all the terms and conditions of this EULA, OPTIMAJET grants Developer End User a non-exclusive, non-transferable license to install and use the SOFTWARE DEVELOPMENT PRODUCT(S) included in this distribution. 16 | 17 | 2. Limitations on reverse engineering, decompilation and disassembly 18 | You may not reverse engineer, decompile, create derivative works or disassemble the SOFTWARE DEVELOPMENT PRODUCT(S). If the SOFTWARE DEVELOPMENT PRODUCT(S) is purchased by you with the intent to reverse engineer, decompile, create derivative works, or the exploitation and unauthorized transfer of any OPTIMAJET intellectual property and trade secrets, to include any exposed methods or source code where provided, no licensed right of use shall exist and any PRODUCT(s) created as a result shall be judged illegal by definition. Any sale or resale of intellectual property or created derivatives so obtained will be prosecuted to the fullest extent of all local, federal and international law. 19 | 20 | 3. Separation of components 21 | The SOFTWARE DEVELOPMENT PRODUCT(S) is licensed as a single PRODUCT(s). The SOFTWARE DEVELOPMENT PRODUCT(S) and its constituent parts and any provided redistributables may not be reverse engineered, decompiled, disassembled or separated for use on more than one computer, nor placed for distribution, sale, or resale as individual creations by Developer End User. The provision of source code, if included with the SOFTWARE DEVELOPMENT PRODUCT(S), does not constitute transfer of any legal rights to such code, and resale or distribution of all or any portion of all source code and intellectual property will be prosecuted to the fullest extent of all applicable local, federal and international laws. All OPTIMAJET libraries, source code, redistributables and other files remain OPTIMAJET’s exclusive property. You may not distribute any files, except those that OPTIMAJET has expressly designated as Redistributable. 22 | 23 | 4. Rental 24 | You may not rent, lease, or lend the SOFTWARE DEVELOPMENT PRODUCT(S). 25 | 26 | 5. Transfer 27 | You may NOT permanently or temporarily transfer ANY of your rights under this EULA to any individual or business or government entity without prior written approval from OPTIMAJET. Regardless of any modifications which you make and regardless of how you might compile, link, and/or package your programs, under no circumstances may the libraries, Redistributables, and/or files included in the SOFTWARE DEVELOPMENT PRODUCT(S) (including any portions thereof) be used for developing programs by anyone other than you. Only you as the licensed Developer End User have the right to use the libraries, redistributables, or other files of the SOFTWARE DEVELOPMENT PRODUCT(S) (or any portions thereof) for developing programs created with the SOFTWARE DEVELOPMENT PRODUCT(S). You may not share copies of the Redistributables with other co-developers. You may not reproduce or distribute any OPTIMAJET documentation without the permission of OPTIMAJET. 28 | 29 | 6. Redistribution 30 | The SOFTWARE DEVELOPMENT PRODUCT(s) may include certain files (“REDISTRIBUTABLE(s)”) intended for distribution by you to the users of software applications which you create. Redistributables include, for example, those files identified in printed or on-line documentation as redistributable files or those files preselected for deployment by an install utility provided with the SOFTWARE DEVELOPMENT PRODUCT(S) (if any). In all circumstances, the REDISTRIBUTABLES for the SOFTWARE DEVELOPMENT PRODUCT(S) are only those files specifically designated as such by OPTIMAJET. 31 | 32 | AT NO TIME MAY DEVELOPER END USER CREATE ANY TOOL, REDISTRIBUTABLE, OR PRODUCT THAT DIRECTLY OR INDIRECTLY COMPETES WITH THE SOFTWARE DEVELOPMENT PRODUCT(S) BY UTILIZING ALL OR ANY PORTION OF THE OPTIMAJET SOFTWARE DEVELOPMENT PRODUCT(S). 33 | 34 | Distribution by the Developer End User of any design-time tools (EXE’s or DLL’s), executables, and source code distributed to Developer End User by OPTIMAJET as part of this SOFTWARE DEVELOPMENT PRODUCT(S) and not explicitly identified as a redistributable file is strictly prohibited. The Developer End User shall not develop software applications that provide an application programming interface to the SOFTWARE DEVELOPMENT PRODUCT(S) or the SOFTWARE DEVELOPMENT PRODUCT(S) as modified. 35 | 36 | The Developer End User may NOT distribute the SOFTWARE DEVELOPMENT PRODUCT(S), in any format, to others for development or application compilation purposes. 37 | 38 | REDISTRIBUTABLES. The following installed file(s) or installed folder(s) are considered redistributables under this EULA. Refer to Section 8 of this EULA for licensing and subscription terms: no redistribution allowed for trial versions of this distribution. 39 | 40 | Developer End User MAY NOT REDISTRIBUTE any files in the SOFTWARE DEVELOPMENT PRODUCT(S) distribution if using an evaluation, trial, Not for Resale, or demo version of the SOFTWARE DEVELOPMENT PRODUCT(S). 41 | 42 | 7. Copyright 43 | All title and copyrights in and to the SOFTWARE DEVELOPMENT PRODUCT(S) (including but not limited to any OPTIMAJET trademarks, copywritten images, demos, source code, intermediate files, packages, photographs, redistributables, animations, video, audio, music, text, and “applets” incorporated into the SOFTWARE DEVELOPMENT PRODUCT(S) the accompanying printed materials, and any copies of the SOFTWARE DEVELOPMENT PRODUCT(S)) are owned by OPTIMAJET or its subsidiaries. 44 | 45 | The SOFTWARE DEVELOPMENT PRODUCT(S) is protected by copyright laws and international treaty provisions and therefore, you must treat the SOFTWARE DEVELOPMENT PRODUCT(S) like any other copyrighted material except that you may install and use the SOFTWARE DEVELOPMENT PRODUCT(S) as described in this EULA. 46 | 47 | 8. Download of software development product(s) 48 | The SOFTWARE DEVELOPMENT PRODUCT(S) will be made available for download from formbuilder.dev exclusively. 49 | 50 | 9. Export restrictions 51 | You, as Developer End User, must agree not to export or re-export the SOFTWARE DEVELOPMENT PRODUCT(S) within any created application to any country, person, entity or end user subject to Russian Federation. 52 | 53 | 10. Disclaimer of warranty 54 | OPTIMAJET expressly disclaims any warranty for the SOFTWARE DEVELOPMENT PRODUCT(S). THE SOFTWARE DEVELOPMENT PRODUCT(S) AND ANY RELATED DOCUMENTATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. OPTIMAJET DOES NOT WARRANT, GUARANTEE, OR MAKE ANY REPRESENTATIONS REGARDING THE USE, OR THE RESULTS OF THE USE, OF THE SOFTWARE DEVELOPMENT PRODUCT(S) IN TERMS OF CORRECTNESS, ACCURACY, RELIABILITY, OR OTHERWISE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE DEVELOPMENT PRODUCT(S) REMAINS WITH YOU. No oral or written information or advice given by OPTIMAJET or its employees shall create a warranty or in any way increase the scope of this warranty. 55 | 56 | 11. Limitations on liability 57 | To the maximum extent permitted by applicable law, in no event shall OPTIMAJET be liable for any special, incidental, indirect, or consequential damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use the SOFTWARE DEVELOPMENT PRODUCT(S) or the provision of or failure to provide Support Services, even if OPTIMAJET has been advised of the possibility of such damages. 58 | 59 | Developer End User understands that the SOFTWARE DEVELOPMENT PRODUCT(S) may produce inaccurate results because of a failure or fault within the SOFTWARE DEVELOPMENT PRODUCT(S) or failure by Developer End User to properly use and or deploy the SOFTWARE DEVELOPMENT PRODUCT(S). Developer End User assumes full and sole responsibility for any use of the SOFTWARE DEVELOPMENT PRODUCT(S), and bears the entire risk for failures or faults within the SOFTWARE DEVELOPMENT PRODUCT(S). You agree that regardless of the cause of failure or fault or the form of any claim, YOUR SOLE REMEDY AND OPTIMAJET’S SOLE OBLIGATION SHALL BE GOVERNED BY THIS AGREEMENT AND IN NO EVENT SHALL OPTIMAJET’S LIABILITY EXCEED THE PRICE PAID TO OPTIMAJET FOR THE SOFTWARE DEVELOPMENT PRODUCT(S). This Limited Warranty is void if failure of the SOFTWARE DEVELOPMENT PRODUCT(S) has resulted from accident, abuse, alteration, unauthorized use or misapplication of the SOFTWARE DEVELOPMENT PRODUCT(S). 60 | 61 | 12. Indemnification 62 | You hereby agree to indemnify OPTIMAJET and its officers, directors, employees, agents, and representatives from each and every demand, claim, loss, liability, or damage of any kind, including actual attorney’s fees, whether in tort or contract, that it or any of them may incur by reason of, or arising out of, any claim which is made by any third party with respect to any breach or violation of this Agreement by you or any claims based on the Applications and the SOFTWARE DEVELOPMENT PRODUCT(S) included herein. 63 | 64 | 13. Termination 65 | Without prejudice to any other rights or remedies, OPTIMAJET will terminate this EULA upon your failure to comply with all the terms and conditions of this EULA. In such events, Developer End User must destroy all copies of the SOFTWARE DEVELOPMENT PRODUCT(S) and all of its component parts including any related documentation, and must remove ANY and ALL use of OPTIMAJET intellectual property from any applications distributed by Developer End User, whether in native, altered or compiled states. 66 | 67 | 14. Miscellaneous 68 | This EULA may only be modified in writing signed by you and an authorized officer of Optimajet Limited. If any provision of this EULA is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in the Limited Warranty shall remain in effect. 69 | 70 | OPTIMAJET reserves all rights not specifically granted in this EULA. 71 | 72 | YOU ACKNOWLEDGE THAT YOU HAVE READ AND UNDERSTAND THIS AGREEMENT AND YOU AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT UPON INSTALLATION AND/OR USE of ALL SOFTWARE DEVELOPMENT PRODUCT(S) INCLUDED IN THIS DISTRIBUTION. 73 | 74 | © 2023 Optimajet Limited 75 | 76 | All trademarks and registered trademarks are property of their respective owners. 77 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # OptimaJet FormBuilder 2 | 3 | FormBuilder - is a lightweight, user-friendly, effective and essential form tool used to create and manage forms. It is based on React and 4 | can be integrated into any web app. 5 | 6 | For deployment and further development, you will need the following toolkit: 7 | 8 | - npm; 9 | - webpack 3 (!); 10 | 11 | 1. Run the commands in the project's root folder: 12 | ```bash 13 | cd demo 14 | npm install --legacy-peer-deps 15 | npm run start 16 | ``` 17 | 18 | 2. Open the sample in a browser (by default at http://localhost:8080/) 19 | 20 | ## Features 21 | 22 | - Drag-&-drop form builder 23 | - Templates 24 | - Inline parameters 25 | - Event-based 26 | - JSON file format 27 | - Clean HTML layout 28 | 29 | ## Screenshots 30 | 31 | [![Form Builder](https://raw.githubusercontent.com/optimajet/formbuilder/master/Resources/builder.png "Form Builder")](https://formbuilder.dev/demo/) 32 | 33 | [![Form Viewer](https://raw.githubusercontent.com/optimajet/formbuilder/master/Resources/viewer.png "Form Viewer")](https://formbuilder.dev/viewer/) 34 | 35 | ## Information 36 | 37 | - **Official website** - [https://formbuilder.dev](https://formbuilder.dev) 38 | - **Documentation** - [https://formbuilder.dev/documentation/](https://formbuilder.dev/documentation/) 39 | - **Demo** - [https://formbuilder.dev/demo/](https://formbuilder.dev/demo/) 40 | 41 | For commercial use, please contact [support@optimajet.com](mailto:support@optimajet.com). 42 | -------------------------------------------------------------------------------- /release-notes.md: -------------------------------------------------------------------------------- 1 | # Release Notes 2 | 3 | ## 1.22.0 4 | 5 | _April 15, 2025_ 6 | 7 | - Now the toolbar of the component is shown only when the mouse hovers over the component itself, so that different 8 | toolbars do not overlap each other. 9 | 10 | ## 1.21.0 11 | 12 | _January 21, 2025_ 13 | 14 | - Fixed a bug that caused custom controls to not be supported in CollectionEditor. 15 | - 16 | ## 1.20.0 17 | 18 | _November 14, 2024_ 19 | 20 | - Fixed a bug that caused the entered value and an empty string in the DateTimePicker to be processed incorrectly. 21 | 22 | ## 1.19.0 23 | 24 | _November 8, 2024_ 25 | 26 | - Fixed a bug that caused an empty string in the DatePicker to be processed incorrectly. 27 | 28 | ## 1.18.0 29 | 30 | _October 18, 2024_ 31 | 32 | - Fixed a bug that caused values of hidden fields to be added to form data 33 | 34 | ## 1.17.0 35 | 36 | _October 7, 2024_ 37 | 38 | - Fixed a bug where error classes were not applied to the `Radio group` component 39 | 40 | ## 1.16.0 41 | 42 | _September 3, 2024_ 43 | 44 | - Fixed a bug where the `required` validation did not work after clearing the value in the `Dropdown` component with the `multiple` option 45 | 46 | ## 1.15.0 47 | 48 | _August 8, 2024_ 49 | 50 | - Added support for Node.js 20.10 51 | - Fixed a bug where the error tooltip was not displayed on the `Radio group` component 52 | 53 | ## 1.14.0 54 | 55 | _August 9, 2023_ 56 | 57 | - Added ability to sort Dropdown items in alphabetical order 58 | 59 | ## 1.13.0 60 | 61 | _June 8, 2023_ 62 | 63 | - Fix a corrupted file download 64 | 65 | ## 1.12.0 66 | 67 | _June 2, 2023_ 68 | 69 | - Add onDownloadFail event to Files control 70 | 71 | ## 1.11.0 72 | 73 | _May 12, 2023_ 74 | 75 | - Fix bug with Dropdown options 76 | 77 | ## 1.10.0 78 | 79 | _April 17, 2023_ 80 | 81 | - Provision to show custom columns in Files control 82 | - Improved compatibility with React 18 83 | - Bug fix and minor improvements 84 | 85 | ## 1.9.0 86 | 87 | _February 7, 2023_ 88 | 89 | - Bug fix and minor improvements 90 | 91 | ## 1.8.9 92 | 93 | _February 6, 2023_ 94 | 95 | - Fix nested controls validation conditions checking 96 | - Bug fix and minor improvements 97 | 98 | ## 1.8.8 99 | 100 | _January 17, 2023_ 101 | 102 | - Bug fix and minor improvements 103 | 104 | ## 1.8.7 105 | 106 | _January 12, 2023_ 107 | 108 | - The SemanticUI control for the input with the "time" type has been replaced with a standard one 109 | 110 | ## 1.8.6 111 | 112 | _September 28, 2022_ 113 | 114 | - Added download timeout to configuration settings 115 | 116 | ## 1.8.5 117 | 118 | _June 21, 2022_ 119 | 120 | - Added a property for editing HTML attributes of elements 121 | 122 | ## 1.8.4 123 | 124 | _April 21, 2022_ 125 | 126 | - Bug fix and minor improvements 127 | 128 | ## 1.8.3 129 | 130 | _April 1, 2022_ 131 | 132 | - Improve adaptation for large screen sizes 133 | - Prevent validation for hidden (by visibility-condition) controls 134 | 135 | ## 1.8.2 136 | 137 | _December 3, 2021_ 138 | 139 | - Bug fix and minor improvements 140 | 141 | ## 1.8.1 142 | 143 | _November 30, 2021_ 144 | 145 | - Bug fix and minor improvements 146 | 147 | ## 1.8 148 | 149 | - Added possibility to change tabs in Tab control 150 | - The Files control now supports validation and can be disabled 151 | - Bug fix and minor improvements 152 | 153 | ## 1.7 154 | 155 | - Camera and Signature controls have been added. 156 | - Minor improvements. 157 | 158 | ## 1.6 159 | 160 | - Separation of basic functionality and library of controls (SemanticUI). 161 | - Minor improvements. 162 | 163 | ## 1.5 164 | 165 | - Printing forms feature. 166 | - New features for creating forms by repeater and container controls 167 | 168 | ## 1.4 169 | 170 | - New FormBuilder design. 171 | 172 | ## 1.3 173 | 174 | - Some minor bugs have been fixed. 175 | 176 | ## 1.2 177 | 178 | - New collection component Repeater added. It draws a specified set of components for each collection entity and supports server paging. 179 | - Settings for adaptive layout added for components. For example there can be 2 components in the form which display the same list - grid and repeater. You can set the grid to be displayed in the desktop mode, and repeater to be displayed in the mobile mode. If component is not displayed, it is not rendered, that is why even if there are 2 heavy components on the page, it does not affect performance. 180 | - Component can be bound to any Property Name from form data. 181 | - Substitutions now work in component collections. Use {row.propertyName} expression to access current item data. 182 | - Dates and numbers formatting added in substitutions. For example, {row.TransitionTime:DD.MM.YYYY HH:mm:ss} or {Amount:0,000.00}. moment.js is used to format dates. numeral.js is used to format numbers. If you need to use the formatting string set in localization, write {row.TransitionTime:local}. 183 | - Interface performance optimized. 184 | 185 | ## 1.1 186 | 187 | - Some minor bugs have been fixed. 188 | 189 | ## 1.0 190 | 191 | - The first release of OptimaJet FormBuilder. 192 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | OptimaJet FormBuilder - 16/04/2025 2 | --------------------------------------------------------------------------------