diff --git a/README.md b/README.md
index 83877dc..016d6a1 100644
--- a/README.md
+++ b/README.md
@@ -142,6 +142,8 @@ Name | Type (default) | Description
**direction** | String (auto) | A force direction for the list. Supported values: `auto`, `top`, `bottom`.
**expandSelected** | Boolean (false) | All groups which have checked values will be expanded on the init.
**saveScrollPosition** | Boolean (true) | The list saves the last scroll position before close. If you open the list your scroll will be on the previous position. If you set the value to `false` - the scroll will have position 0 and the first item will be focused every time.
+**defaultPadding** | Number (20) | Default padding-left for items in groups (each level add this value as padding-left)
+**zeroLevelItemPadding** | Number (5) | Default padding-left for main item in group or single items
#### Input settings props
Name | Type (default) | Description
diff --git a/app/examples/index.js b/app/examples/index.js
index 593a0f1..e13d05f 100644
--- a/app/examples/index.js
+++ b/app/examples/index.js
@@ -4,6 +4,7 @@ import { runDisabledExample } from './disabled'
import { runSingleSelectExample } from './singleSelect'
import { runIndependentNodesExample } from './independentNodes'
import { runIconsExample } from './icons'
+import { runNoGroupsExample } from './noGroups'
export const runApp = (Treeselect) => {
runDefaultExample(Treeselect)
@@ -12,4 +13,5 @@ export const runApp = (Treeselect) => {
runSingleSelectExample(Treeselect)
runIndependentNodesExample(Treeselect)
runIconsExample(Treeselect)
+ runNoGroupsExample(Treeselect)
}
diff --git a/app/examples/noGroups.js b/app/examples/noGroups.js
new file mode 100644
index 0000000..ceaaa8a
--- /dev/null
+++ b/app/examples/noGroups.js
@@ -0,0 +1,52 @@
+const options = [
+ {
+ name: 'England',
+ value: 1,
+ },
+ {
+ name: 'London',
+ value: 2,
+ },
+ {
+ name: 'Chelsea',
+ value: 3
+ },
+ {
+ name: 'West End',
+ value: 4
+ },
+ {
+ name: 'Brighton',
+ value: 5
+ },
+ {
+ name: 'France',
+ value: 6
+ },
+ {
+ name: 'Paris',
+ value: 7
+ },
+ {
+ name: 'Lyon',
+ value: 8
+ },
+]
+
+const className = '.treeselect-demo-no-groups'
+
+export const runNoGroupsExample = (Treeselect) => {
+ const domElement = document.querySelector(className)
+ const treeselect = new Treeselect({
+ parentHtmlContainer: domElement,
+ value: 4,
+ options: options,
+ isSingleSelect: true,
+ showTags: false,
+ zeroLevelItemPadding: 20
+ })
+
+ treeselect.srcElement.addEventListener('input', (e) => {
+ console.log('singleSelect: Selected value ', e.detail)
+ })
+}
diff --git a/app/index.html b/app/index.html
index 974945b..e8e10d5 100644
--- a/app/index.html
+++ b/app/index.html
@@ -1,25 +1,27 @@
-
-
-
-
-
-
-
-
- Treeselect JS App
-
-
-
-
- Treeselect JS Demo
-
-
- Treeselect with default props
-
-
-
+
+
+
+
+
+
+
+
+
+ Treeselect JS App
+
+
+
+
+
+ Treeselect JS Demo
+
+
+ Treeselect with default props
+
+
+
parentHtmlContainer: document.querySelector(className),
value: [4, 7, 8],
@@ -70,16 +72,16 @@ Treeselect JS Demo
]
-
-
+
+
-
-
-
- Treeselect with slot
-
-
-
+
+
+
+ Treeselect with slot
+
+
+
const slot = document.createElement('div')
slot.innerHTML = '<a href="">Click!</a>'
@@ -118,16 +120,16 @@ Treeselect JS Demo
]
-
-
+
+
-
-
-
- Treeselect with disabled
-
-
-
+
+
+
+ Treeselect with disabled
+
+
+
parentHtmlContainer: document.querySelector(className),
value: [],
@@ -180,16 +182,16 @@ Treeselect JS Demo
]
-
-
+
+
-
-
-
- Treeselect with single select prop
-
-
-
+
+
+
+ Treeselect with single select prop
+
+
+
parentHtmlContainer: document.querySelector(className),
value: 4,
@@ -242,16 +244,67 @@ Treeselect JS Demo
]
-
-
+
+
-
-
-
- Treeselect with independent nodes prop
-
-
-
+
+
+
+ Treeselect with no groups
+
+
+
+
+ parentHtmlContainer: document.querySelector(className),
+ value: 4,
+ isSingleSelect: true,
+ showTags: false,
+ options: [
+ {
+ name: 'England',
+ value: 1,
+ },
+ {
+ name: 'London',
+ value: 2,
+ },
+ {
+ name: 'Chelsea',
+ value: 3
+ },
+ {
+ name: 'West End',
+ value: 4
+ },
+ {
+ name: 'Brighton',
+ value: 5
+ },
+ {
+ name: 'France',
+ value: 6
+ },
+ {
+ name: 'Paris',
+ value: 7
+ },
+ {
+ name: 'Lyon',
+ value: 8
+ },
+ ]
+
+
+
+
+
+
+
+
+ Treeselect with independent nodes prop
+
+
+
parentHtmlContainer: document.querySelector(className),
value: [1, 4, 7, 8],
@@ -303,16 +356,16 @@ Treeselect JS Demo
]
-
-
+
+
-
-
-
- Treeselect example with icons for appendToBody: false (workaround approach)
-
-
-
+
+
+
+ Treeselect example with icons for appendToBody: false (workaround approach)
+
+
+
const icons = {
check: 'ico-check',
@@ -424,8 +477,9 @@ Treeselect JS Demo
}
-
-
-
-
-
+
+
+
+
+
+