|
1 | | -# TypeScript Sample Browser |
2 | 1 |
|
3 | | -Repository for typescript sample browser. |
4 | 2 |
|
5 | | -## Adding New Sample |
| 3 | +## Installing |
6 | 4 |
|
7 | | -Create your new folder in 'src' location and name the folder as control name for example “button” it is control name. |
8 | | - |
9 | | -Add your sample order in the `src/common/sampleOrder.json` with corresponding category. |
10 | | - |
11 | | -Note: Do not use whitespace at any cause in folder’s name. Use “-” instead of space. |
12 | | - |
13 | | -[Refer here](https://bitbucket.org/syncfusion/ej2-sample-browser/src/7740ab838973c7ebb3e970acb5246ff4c89ccd67/src/?at=master) |
14 | | - |
15 | | -### Configure the folder and sample |
16 | | - |
17 | | -Create the “sample.json” file inside of your control folder. Create your sample html and ts file in same folder also name the html and ts files with same name. |
18 | | - |
19 | | -Note: Do not use whitespace at any cause in file’s name. Use “-” instead of space. |
20 | | - |
21 | | -[Refer here](https://bitbucket.org/syncfusion/ej2-sample-browser/src/7740ab838973c7ebb3e970acb5246ff4c89ccd67/src/button/?at=master) |
22 | | - |
23 | | -### Configure Sample JSON |
24 | | - |
25 | | -Configure your sample json file as like below code snippet. |
| 5 | +To install all dependent packages, use the below command |
26 | 6 |
|
27 | 7 | ``` |
28 | | -{ |
29 | | - "name": "Button", |
30 | | - "directory": "button", |
31 | | - "category":"Editors", |
32 | | - "samples" : [ |
33 | | - {"url":"default", "name": "Default Functionalities", "category":"Button"}, |
34 | | - {"url":"api", "name": "API", "category":"Button"}, |
35 | | - {"url":"repeatbutton", "name": "Repeat Button", "category":"Button", hideOnDevice:true }, |
36 | | - {"url":"events", "name": "Events", "category":"Button"}, |
37 | | - {"url":"rtl", "name": "RTL", "category":"Button"} |
38 | | - ] |
39 | | -} |
40 | | -
|
| 8 | +npm install |
41 | 9 | ``` |
42 | | -*Note: To exculde a sample in the device you need to set **hideOnDevice** as true for the sample json file.* |
43 | | - |
44 | | -**Fields Description:** |
45 | | - |
46 | | -_name :_ Its can be any string that you want show as a control name. |
47 | | - |
48 | | -_directory :_ Specifies that your sample directory name. |
49 | | - |
50 | | -_category :_ Specify that your sample comes under which category. |
51 | | - |
52 | | -_samples :_ Specify array of samples are in your control. |
53 | | - |
54 | | -_samples.url :_ specifies the file name without extension. |
55 | | - |
56 | | -_samples.name :_ Its can be any string that you want show as a sample name. |
57 | | - |
58 | | -_samples.category :_ Specify that your sample comes under which category. |
59 | | - |
60 | | -## Configure your dependency |
61 | 10 |
|
62 | | -Add your dependency in “package.json” file inside the dependencies. |
| 11 | +## Building |
63 | 12 |
|
64 | | -Note: Here, `'*'` Specifies that install the latest published package form the online. `'*'` is recommended for Syncfusion packages. |
| 13 | +To compile the source files, use the below command |
65 | 14 |
|
66 | 15 | ``` |
67 | | - "dependencies": { |
68 | | - "@syncfusion/ej2-base": "*", |
69 | | - "@syncfusion/ej2-buttons": "*", |
70 | | - "@syncfusion/ej2-lists": "*", |
71 | | - "@syncfusion/ej2-grids": "*", |
72 | | - "bootstrap": "^3.3.6", |
73 | | - "crossroads": "^0.12.2", |
74 | | - "hasher": "^1.2.0" |
75 | | - }, |
76 | | - |
| 16 | +npm run build |
77 | 17 | ``` |
78 | 18 |
|
79 | | -## Run the sample browser |
| 19 | +## Testing |
80 | 20 |
|
81 | | -We can run the sample browser with two commands |
82 | | - |
83 | | -1. **gulp _serve_** – run the sample browser alone. |
84 | | -2. **gulp _watch_** – run the sample browser and monitor typescript as well. This will help at development time. If any changes detect means it will automatically compile and browser will reloaded. |
| 21 | +To test the source files, use the below command |
85 | 22 |
|
86 | 23 | ``` |
87 | | -D:\dev\typescript\source\ej2-sample-browser>gulp serve |
| 24 | +npm run test |
88 | 25 | ``` |
89 | 26 |
|
| 27 | +## Running |
90 | 28 |
|
91 | | -**Access URLs:** |
92 | | - |
93 | | -Local URL is works only in your machine. |
94 | | - |
95 | | -``` |
96 | | -http://localhost:3000 |
97 | | -``` |
98 | | - |
99 | | -External URL is works in all locally connected LAN. (You can use to see sample browser in mobile). |
| 29 | +To run the samples, use the below command |
100 | 30 |
|
101 | 31 | ``` |
102 | | -http://your-ip-address:3000 |
103 | | -``` |
104 | | - |
105 | | -Note: Here, The mentioned IP is your local machine IP Address. |
106 | | - |
107 | | -# Plunker Guidelines |
108 | | - |
109 | | -1. In import statements in html file for a sample the package subdirectory shouldn’t be mentioned. Please refer the link given below. |
110 | | - |
111 | | - https://gitlab.syncfusion.com/essential-studio/ej2-samples/blob/development/src/grid/events.ts#L3 |
112 | | - |
113 | | -2. In Base component dom and util are not available in the customer end. So, please don’t use the same. Please refer the link below. |
114 | | - |
115 | | - https://gitlab.syncfusion.com/essential-studio/ej2-samples/blob/development/src/grid/events.ts#L3 |
116 | | - |
117 | | -3. To add any icon in the samples use base64 font and don’t use any font files like ttf, woff, or svg externally. Please refer the link given below. |
118 | | - |
119 | | - https://gitlab.syncfusion.com/essential-studio/ej2-samples/blob/development/src/toolbar/default.html#L5 |
120 | | - |
121 | | - For example: |
122 | | - ``` |
123 | | - <style> |
124 | | - @font-face { |
125 | | - font-family: 'temp1'; |
126 | | - src:url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0gSIMAAAEoAAAAVmNtYXDnEOdVAAABiAAAADZnbHlmazsA9wAAAcgAAAAcaGVhZA3qwqgAAADQAAAANmhoZWEHmQNrAAAArAAAACRobXR4B+gAAAAAAYAAAAAIbG9jYQAOAAAAAAHAAAAABm1heHABDQAPAAABCAAAACBuYW1lv7gVOQAAAeQAAAINcG9zdD4ZCQ8AAAP0AAAANgABAAADUv9qAFoEAAAA//4D6gABAAAAAAAAAAAAAAAAAAAAAgABAAAAAQAAThBvMl8PPPUACwPoAAAAANVxP0wAAAAA1XE/TAAAAAAD6gMrAAAACAACAAAAAAAAAAEAAAACAAMAAQAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQP0AZAABQAAAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wDnAANS/2oAWgNSAJYAAAABAAAAAAAABAAAAAPoAAAAAAACAAAAAwAAABQAAwABAAAAFAAEACIAAAAEAAQAAQAA5wD//wAA5wD//wAAAAEABAAAAAEAAAAAAAAADgAAAAEAAAAAA+oDKwACAAA3IQECA+j+DMICaQAAAAAAABIA3gABAAAAAAAAAAEAAAABAAAAAAABAAUAAQABAAAAAAACAAcABgABAAAAAAADAAUADQABAAAAAAAEAAUAEgABAAAAAAAFAAsAFwABAAAAAAAGAAUAIgABAAAAAAAKACwAJwABAAAAAAALABIAUwADAAEECQAAAAIAZQADAAEECQABAAoAZwADAAEECQACAA4AcQADAAEECQADAAoAfwADAAEECQAEAAoAiQADAAEECQAFABYAkwADAAEECQAGAAoAqQADAAEECQAKAFgAswADAAEECQALACQBCyB0ZW1wMVJlZ3VsYXJ0ZW1wMXRlbXAxVmVyc2lvbiAxLjB0ZW1wMUZvbnQgZ2VuZXJhdGVkIHVzaW5nIFN5bmNmdXNpb24gTWV0cm8gU3R1ZGlvd3d3LnN5bmNmdXNpb24uY29tACAAdABlAG0AcAAxAFIAZQBnAHUAbABhAHIAdABlAG0AcAAxAHQAZQBtAHAAMQBWAGUAcgBzAGkAbwBuACAAMQAuADAAdABlAG0AcAAxAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAHUAcwBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBAgEDAAxhcnJvd2hlYWQtMDEAAAAA) format('truetype'); |
127 | | - font-weight: normal; |
128 | | - font-style: normal; |
129 | | - } |
130 | | - #font::after { |
131 | | - content: "\e700"; |
132 | | - font-size: large |
133 | | - } |
134 | | - .icon { |
135 | | - font-family: temp1; |
136 | | - } |
137 | | - </style> |
138 | | - <div id="font" class="icon"></div> |
139 | | - ``` |
140 | | - |
141 | | -4. For loading json files in the sample use import statements instead of require. Please refer the link given below. |
142 | | - |
143 | | - https://gitlab.syncfusion.com/essential-studio/ej2-samples/blob/development/src/calendar/internationalization.ts#L9 |
144 | | - |
145 | | - ( For example: import * as testJson from '../common/cldr-data/supplemental/numberingSystems.json'; ) |
146 | | - |
147 | | -5. If a New Component is added to TypeScript Sample Browser it’s package dependency should be added to the config in src/sys.js file. |
148 | | - |
149 | | - ( For example: https://gitlab.syncfusion.com/essential-studio/ej2-samples/blob/development/src/sys.js#L19 ) |
| 32 | +npm run serve |
| 33 | +``` |
0 commit comments