treeselectjs 0.9.1 → 0.9.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Treeselect JS component
1
+ # Treeselect JS component
2
2
 
3
3
  A multi-select js component with nested options.
4
4
 
@@ -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 50.05 kB │ gzip: 11.33 kB
13
- - treeselectjs.umd.js 40.62 kB │ gzip: 10.35 kB
12
+ - treeselectjs.mjs 50.48 kB │ gzip: 11.43 kB
13
+ - treeselectjs.umd.js 40.99 kB │ gzip: 10.43 kB
14
14
  - treeselectjs.css 6.41 kB │ gzip: 1.27 kB
15
15
 
16
16
  **Live Demo:** https://dipson88.github.io/treeselectjs/
@@ -30,8 +30,8 @@ import Treeselect from 'treeselectjs'
30
30
 
31
31
  Import treeselectjs (UMD)
32
32
  ```
33
- <script src="https://cdn.jsdelivr.net/npm/treeselectjs@0.9.1/dist/treeselectjs.umd.js"></script>
34
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/treeselectjs@0.9.1/dist/treeselectjs.css" />
33
+ <script src="https://cdn.jsdelivr.net/npm/treeselectjs@0.9.3/dist/treeselectjs.umd.js"></script>
34
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/treeselectjs@0.9.3/dist/treeselectjs.css" />
35
35
  ...
36
36
  <script>
37
37
  ...
@@ -123,6 +123,7 @@ Name | Type (default) | Description
123
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).
124
124
  **disabled** | Boolean (false) | List will be disabled.
125
125
  **id** | String ('') | id attribute for the accessibility.
126
+ **ariaLabel** | String ('') | ariaLabel attribute for the accessibility.
126
127
  **isSingleSelect** | Boolean (false) | Converts multi-select to the single value select. Checkboxes will be removed. You should pass only one id instead of array of values. Also you can set **showTags** to false. It helps to show treeselect as a dropdown.
127
128
  **isGroupedValue** | Boolean (false) | Return groups if they selected instead of separate ids. Treeselect returns only leaves ids by default.
128
129
  **isIndependentNodes** | Boolean (false) | All nodes in treeselect work as an independent entity. Check/uncheck action ignore children/parent updates workflow. Disabled nodes ignore children/parent workflow as well.
@@ -151,9 +152,10 @@ Name | Type (default) | Description
151
152
  **searchable** | Boolean (true) | Search is available.
152
153
  **placeholder** | String ('Search...') | Placeholder text.
153
154
  **grouped** | Boolean (true) | Show groups in the input and group leafs if all group selected.
154
- **ariaLabel** | String (**placeholder**) | ariaLabel attribute for the accessibility. Prop uses **placeholder** as a default value.
155
155
 
156
156
  #### Callback props
157
+ Check [Emits](#Emits) section for more info.
158
+
157
159
  Name | Type (default) | Description
158
160
  ------------- | ------------- | -------------
159
161
  **inputCallback** | (value) => void (undefined) | Callback method for `input` if you don't want to to eventListener.
@@ -161,6 +163,7 @@ Name | Type (default) | Description
161
163
  **closeCallback** | (value) => void (undefined) | Callback method for `close` if you don't want to use eventListener.
162
164
  **nameChangeCallback** | (name) => void (undefined) | Callback method for `name-change` if you don't want to use eventListener.
163
165
  **searchCallback** | (value) => void (undefined) | Callback method for `search` if you don't want to use eventListener.
166
+ **openCloseGroupCallback** | (groupId: ValueOptionType, isClosed: boolean) => void (undefined) | Callback method for `open-close-group` if you don't want to use eventListener.
164
167
 
165
168
  #### Additional props
166
169
  Name | Type (default) | Description
@@ -189,6 +192,7 @@ Name | Return Type | Description
189
192
  **close** | Array[String \| Number] | Returns selected values, action is triggered on closing the list. Add `eventListener` or use `closeCallback` prop to get value.
190
193
  **name-change** | String | Returns selected name inside the input, action is triggered on on change the list. Add `eventListener` or use `nameChangeCallback` prop to get name.
191
194
  **search** | String | Returns entered search value, action is triggered on change search value during the typing. Add `eventListener` or use `searchCallback` prop to get value. You can try create something like autocomplete with help of this event.
195
+ **open-close-group** | { groupId: [String \| Number], isClosed: Boolean } | Returns groupId and closed/open status of this group, action is triggered on open/close group in the list. Add `eventListener` or use `openCloseGroupCallback` prop to get value.
192
196
 
193
197
  ---
194
198
 
@@ -212,3 +216,8 @@ Name | Params | Description
212
216
  6) **Value** prop inside the **options** prop should be a **String** or **Number**.
213
217
  7) If you use **isSingleSelect** prop, you should pass only a single **value** without an array.
214
218
  8) If you use **isSingleSelect** prop, you can set **showTags** to false. It helps to show treeselect as a dropdown. Also you can disable selecting of group's nodes with help of **disabledBranchNode**.
219
+
220
+ ### Support
221
+ You can buy me a coffee if you want to support my work. Thank you!
222
+
223
+ <a href="https://www.buymeacoffee.com/dipson88" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
@@ -49,6 +49,7 @@ declare interface ITreeselect {
49
49
  closeCallback: ((value: ValueType) => void) | undefined;
50
50
  nameChangeCallback: ((name: string) => void) | undefined;
51
51
  searchCallback: ((value: string) => void) | undefined;
52
+ openCloseGroupCallback: ((groupId: ValueOptionType, isClosed: boolean) => void) | undefined;
52
53
  mount: () => void;
53
54
  updateValue: (newValue: ValueInputType) => void;
54
55
  destroy: () => void;
@@ -89,6 +90,7 @@ export declare interface ITreeselectParams {
89
90
  closeCallback?: (value: ValueType) => void;
90
91
  nameChangeCallback?: (name: string) => void;
91
92
  searchCallback?: (value: string) => void;
93
+ openCloseGroupCallback?: (groupId: ValueOptionType, isClosed: boolean) => void;
92
94
  }
93
95
 
94
96
  export declare type OptionType = {
@@ -133,13 +135,14 @@ declare class Treeselect implements ITreeselect {
133
135
  closeCallback: ((value: ValueType) => void) | undefined;
134
136
  nameChangeCallback: ((name: string) => void) | undefined;
135
137
  searchCallback: ((value: string) => void) | undefined;
138
+ openCloseGroupCallback: ((groupId: ValueOptionType, isClosed: boolean) => void) | undefined;
136
139
  ungroupedValue: ValueOptionType[];
137
140
  groupedValue: ValueOptionType[];
138
141
  allValue: ValueOptionType[];
139
142
  isListOpened: boolean;
140
143
  selectedName: string;
141
144
  srcElement: HTMLElement | null;
142
- 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, iconElements, inputCallback, openCallback, closeCallback, nameChangeCallback, searchCallback }: ITreeselectParams);
145
+ 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, iconElements, inputCallback, openCallback, closeCallback, nameChangeCallback, searchCallback, openCloseGroupCallback }: ITreeselectParams);
143
146
  mount(): void;
144
147
  updateValue(newValue: ValueInputType): void;
145
148
  destroy(): void;