-
Notifications
You must be signed in to change notification settings - Fork 3
Input Control Development Guide
Prerequisite: Use node js version 16 and above.
Note: Download the fully compiled project sample: ng_duc_project_sample_compiled.zip
To develop a custom input control (also known as DUC) follow these steps:
-
Download the ng_duc_project_sample.zip
-
Extract the downloaded ZIP file into a new directory.
-
In the new directory, run
npm install -
In the new directory, rename Sample.duc.js (the name should start with a capital letter and end with the suffix .duc.js)
-
Inside the file, do the following:
- Change the class name (for example NewNameOfDuc)
- Locate these lines
if (typeof window !== 'undefined') { window.uStoreDucs = window.uStoreDucs || [] window.uStoreDucs.push({ name: 'Sample', component: Sample, displayName: 'Sample duc name' , configSample: {}}) } export default Sample- Change
name: 'Sample'toname: 'NewNameOfDuc'(the name should have no spaces) - Change
component: Sampletocomponent: NewClassName - Change
displayName: 'Sample duc name'todisplayName: 'New DUC display name'. The display name will be displayed in property edit beside the default DUCs. - Change
export default Sampletoexport default NewNameOfDuc - Change
configSample: {}to the JSON configuration you need for your custom DUC. - Change the
thumbnail.pngfile to a new image with the sanme name that will be used as a thumbnail for the DUC in the uStore admin.
-
In the terminal, run
npm run build. When the script is done, you will find a ZIP file in thedistdirectory. The file should be named NewClassName.zip. -
Upload the new DUC in uStore admin (Presets > Input Control Management).
-
Create a new property in your product and select the new custom DUC.
-
In the theme directory, start development by running
npm start -- ducbuild=/path/to/duc/directory -
You can now modify the files inside the DUC's directory. Note that when you update, the DUC's files will be compiled but the application will not be reloaded in the browser; you will need to do it manually.
- A DUC should be treated as an independent component and should not expect libraries to be present. Install the packages you need to use.
- DUC parameters provide only the data that is related to the DUC and not a global model from uStore.
- For changes to take effect, you need to call
this.props.onChange(newValue)orthis.props.onBlur(this.props.id, newValue)in case of focus lost. - The DUC should take into account the
readonly,required,disabledproperties to behave correctly and be influenced by the form. - The DUC accepts the
uiSchemaandjsonschemaparameters, that describe the configuration and validation of the DUC by the form. See json-schema.org to understand the format.
uStore NG Themes
uStore NG Extensibility
Theme customization overview
Editing CSS variables
Editing the CSS
Migration from Legacy to NG
Theme development overview
Getting started
Theme file structure
Publishing the theme
Upgrading a Custom Theme
Editing HTML content
Adding a new page
Adding assets
Adding a component
Customizing a skin
Modifying CSS variables
Editing fonts
Adding JavaScript
uStore library
Working with REST API
Accessing uStore data
Managing custom state
Working with localizations
General services
Adding an external package
Customizing the Theme Editor
Theme tips and tricks
uStoreProvider Reference
Tax Webhook
Order Approval Webhook
Manufacturer Webhook
Widgets
Cart Export Webhook
Input Control Development Guide
Using uStore as a web component