treeselectjs 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/treeselectjs.d.ts +3 -1
- package/dist/treeselectjs.mjs +164 -159
- package/dist/treeselectjs.umd.js +1 -1
- package/package.json +74 -58
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ A multi-select js component with nested options.
|
|
|
9
9
|
- Typescript support
|
|
10
10
|
|
|
11
11
|
Build data:
|
|
12
|
-
- treeselectjs.mjs
|
|
13
|
-
- treeselectjs.umd.js 41.
|
|
12
|
+
- treeselectjs.mjs 51.09 kB │ gzip: 11.58 kB
|
|
13
|
+
- treeselectjs.umd.js 41.45 kB │ gzip: 10.54 kB
|
|
14
14
|
- treeselectjs.css 6.93 kB │ gzip: 1.38 kB
|
|
15
15
|
|
|
16
16
|
**Live Demo:** https://dipson88.github.io/treeselectjs/
|
|
@@ -25,13 +25,13 @@ Import treeselectjs (ES)
|
|
|
25
25
|
```
|
|
26
26
|
import Treeselect from 'treeselectjs'
|
|
27
27
|
|
|
28
|
-
@import 'treeselectjs/dist/treeselectjs.css // Styles
|
|
28
|
+
@import 'treeselectjs/dist/treeselectjs.css' // Styles
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Import treeselectjs (UMD)
|
|
32
32
|
```
|
|
33
|
-
<script src="https://cdn.jsdelivr.net/npm/treeselectjs@0.
|
|
34
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/treeselectjs@0.
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/npm/treeselectjs@0.12.0/dist/treeselectjs.umd.js"></script>
|
|
34
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/treeselectjs@0.12.0/dist/treeselectjs.css" />
|
|
35
35
|
...
|
|
36
36
|
<script>
|
|
37
37
|
...
|
|
@@ -120,7 +120,7 @@ Name | Type (default) | Description
|
|
|
120
120
|
------------- | ------------- | -------------
|
|
121
121
|
**parentHtmlContainer** | HTMLElement (required!) | It should be a HTML element (div), it will be changed to the list container.
|
|
122
122
|
**value** | Array[String \| Number] ([]) | An array of `value` from `options` prop. This value will be selected on load of the treeselect. You can call `updateValue` to update prop or set value `treeselect.value` and call `mount`. The `value` changes if you check/uncheck checkboxes or remove tags from the input.
|
|
123
|
-
**options** | Array[Object] ([]) | It is an array of objects ```{name: String, value: String, disabled?: Boolean, htmlAttr?: object, children: [] }```, where children are the same array of objects. Do not use duplicated `value` field. But you can use duplicated names. [Read more](#option-description).
|
|
123
|
+
**options** | Array[Object] ([]) | It is an array of objects ```{name: String, value: String \| Number, disabled?: Boolean, htmlAttr?: object, children: [] }```, where children are the same array of objects. Do not use duplicated `value` field. But you can use duplicated names. [Read more](#option-description).
|
|
124
124
|
**disabled** | Boolean (false) | List will be disabled.
|
|
125
125
|
**id** | String ('') | id attribute for the accessibility.
|
|
126
126
|
**ariaLabel** | String ('') | ariaLabel attribute for the accessibility.
|
|
@@ -136,19 +136,20 @@ Name | Type (default) | Description
|
|
|
136
136
|
**openLevel** | Number (0) | All groups will be opened to this level.
|
|
137
137
|
**appendToBody** | Boolean (false) | List will be appended to the body instead of the input container.
|
|
138
138
|
**alwaysOpen** | Boolean (false) | List will be always opened. You can use it for comfortable style changing. If you what to use it as an opened list, turn `staticList` to `true`.
|
|
139
|
+
**showCount** | Boolean (false) | Shows count of children near the group's name.
|
|
139
140
|
**staticList** | Boolean (false) | Add the list as a static DOM element. List doesn't overlap content. This prop will be ignored if you use `appendToBody`.
|
|
140
141
|
**emptyText** | String ('No results found...') | A empty list text.
|
|
141
142
|
**listSlotHtmlComponent** | HTMLElement (null) | It should be a HTML element, it will be append to the end of the list.
|
|
142
143
|
**direction** | String (auto) | A force direction for the list. Supported values: `auto`, `top`, `bottom`.
|
|
143
144
|
**expandSelected** | Boolean (false) | All groups which have checked values will be expanded on the init.
|
|
144
145
|
**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.
|
|
146
|
+
**listClassName** | String ('') | A class name for list. Useful to change styles for `appendToBody` mode.
|
|
145
147
|
|
|
146
148
|
#### Input settings props
|
|
147
149
|
Name | Type (default) | Description
|
|
148
150
|
------------- | ------------- | -------------
|
|
149
151
|
**showTags** | Boolean (true) | Selected values look like tags. The false value shows results as '{count} elements selected'. You can change text if you use `tagsCountText` prop. For one selected element, you will see a name of this element.
|
|
150
152
|
**tagsCountText** | String ('elements selected') | This text will be shown if you use 'showTags'. This text will be inserted after the count of the selected elements - ```'{count} {tagsCountText}'```.
|
|
151
|
-
**showCount** | Boolean (false) | Shows count of children near the group's name.
|
|
152
153
|
**clearable** | Boolean (true) | Clear icon is available.
|
|
153
154
|
**searchable** | Boolean (true) | Search is available.
|
|
154
155
|
**placeholder** | String ('Search...') | Placeholder text.
|
package/dist/treeselectjs.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export declare interface ITreeselectParams {
|
|
|
86
86
|
saveScrollPosition?: boolean;
|
|
87
87
|
isIndependentNodes?: boolean;
|
|
88
88
|
rtl?: boolean;
|
|
89
|
+
listClassName?: string;
|
|
89
90
|
iconElements?: Partial<IconsType>;
|
|
90
91
|
inputCallback?: (value: ValueType) => void;
|
|
91
92
|
openCallback?: (value: ValueType) => void;
|
|
@@ -132,6 +133,7 @@ declare class Treeselect implements ITreeselect {
|
|
|
132
133
|
saveScrollPosition: boolean;
|
|
133
134
|
isIndependentNodes: boolean;
|
|
134
135
|
rtl: boolean;
|
|
136
|
+
listClassName: string;
|
|
135
137
|
iconElements: IconsType;
|
|
136
138
|
inputCallback: ((value: ValueType) => void) | undefined;
|
|
137
139
|
openCallback: ((value: ValueType) => void) | undefined;
|
|
@@ -145,7 +147,7 @@ declare class Treeselect implements ITreeselect {
|
|
|
145
147
|
isListOpened: boolean;
|
|
146
148
|
selectedName: string;
|
|
147
149
|
srcElement: HTMLElement | null;
|
|
148
|
-
constructor({ parentHtmlContainer, value, options, openLevel, appendToBody, alwaysOpen, showTags, tagsCountText, clearable, searchable, placeholder, grouped, isGroupedValue, listSlotHtmlComponent, disabled, emptyText, staticList, id, ariaLabel, isSingleSelect, showCount, disabledBranchNode, direction, expandSelected, saveScrollPosition, isIndependentNodes, rtl, iconElements, inputCallback, openCallback, closeCallback, nameChangeCallback, searchCallback, openCloseGroupCallback }: ITreeselectParams);
|
|
150
|
+
constructor({ parentHtmlContainer, value, options, openLevel, appendToBody, alwaysOpen, showTags, tagsCountText, clearable, searchable, placeholder, grouped, isGroupedValue, listSlotHtmlComponent, disabled, emptyText, staticList, id, ariaLabel, isSingleSelect, showCount, disabledBranchNode, direction, expandSelected, saveScrollPosition, isIndependentNodes, rtl, listClassName, iconElements, inputCallback, openCallback, closeCallback, nameChangeCallback, searchCallback, openCloseGroupCallback }: ITreeselectParams);
|
|
149
151
|
mount(): void;
|
|
150
152
|
updateValue(newValue: ValueInputType): void;
|
|
151
153
|
destroy(): void;
|