@revolist/revo-dropdown
Advanced tools
Comparing version 1.1.4 to 2.0.0
@@ -101,3 +101,3 @@ 'use strict'; | ||
index.registerInstance(this, hostRef); | ||
this.changeValue = index.createEvent(this, "changeValue", 7); | ||
this.changeValue = index.createEvent(this, "changed", 7); | ||
this.close = index.createEvent(this, "close", 7); | ||
@@ -232,3 +232,3 @@ this.open = index.createEvent(this, "open", 7); | ||
(_a = this.revoList) === null || _a === void 0 ? void 0 : _a.refresh(this.currentSource); | ||
} })) : undefined, index.h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onDoChange: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
} })) : undefined, index.h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onChanged: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
} | ||
@@ -375,3 +375,3 @@ renderSelect() { | ||
index.registerInstance(this, hostRef); | ||
this.doChange = index.createEvent(this, "doChange", 3); | ||
this.changed = index.createEvent(this, "changed", 3); | ||
this.currentItem = 0; | ||
@@ -408,3 +408,3 @@ /** | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -416,3 +416,3 @@ break; | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -445,3 +445,3 @@ break; | ||
}, | ||
onClick: e => this.doChange.emit({ item, e }) | ||
onClick: e => this.changed.emit({ item, e }) | ||
}; | ||
@@ -448,0 +448,0 @@ const li = index.h("li", Object.assign({}, props), getItemLabel(item, this.dataLabel)); |
@@ -139,3 +139,3 @@ import { Component, Prop, h, State, Listen, Event, Method, Watch, Host } from '@stencil/core'; | ||
} })) : undefined, | ||
h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onDoChange: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onChanged: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
} | ||
@@ -521,3 +521,3 @@ renderSelect() { | ||
"method": "changeValue", | ||
"name": "changeValue", | ||
"name": "changed", | ||
"bubbles": true, | ||
@@ -524,0 +524,0 @@ "cancelable": true, |
@@ -36,3 +36,3 @@ import { Component, h, Prop, Event, Method, Listen, State } from '@stencil/core'; | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -44,3 +44,3 @@ break; | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -73,3 +73,3 @@ break; | ||
}, | ||
onClick: e => this.doChange.emit({ item, e }) | ||
onClick: e => this.changed.emit({ item, e }) | ||
}; | ||
@@ -145,4 +145,4 @@ const li = h("li", Object.assign({}, props), getItemLabel(item, this.dataLabel)); | ||
static get events() { return [{ | ||
"method": "doChange", | ||
"name": "doChange", | ||
"method": "changed", | ||
"name": "changed", | ||
"bubbles": false, | ||
@@ -149,0 +149,0 @@ "cancelable": true, |
@@ -97,3 +97,3 @@ import { h, r as registerInstance, c as createEvent, H as Host } from './index-d90c08e5.js'; | ||
registerInstance(this, hostRef); | ||
this.changeValue = createEvent(this, "changeValue", 7); | ||
this.changeValue = createEvent(this, "changed", 7); | ||
this.close = createEvent(this, "close", 7); | ||
@@ -228,3 +228,3 @@ this.open = createEvent(this, "open", 7); | ||
(_a = this.revoList) === null || _a === void 0 ? void 0 : _a.refresh(this.currentSource); | ||
} })) : undefined, h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onDoChange: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
} })) : undefined, h("revo-list", { ref: e => (this.revoList = e), isFocused: true, sourceItems: this.currentSource, dataLabel: this.dataLabel, onChanged: e => this.doChange(e.detail.item, e.detail.e) })))); | ||
} | ||
@@ -371,3 +371,3 @@ renderSelect() { | ||
registerInstance(this, hostRef); | ||
this.doChange = createEvent(this, "doChange", 3); | ||
this.changed = createEvent(this, "changed", 3); | ||
this.currentItem = 0; | ||
@@ -404,3 +404,3 @@ /** | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -412,3 +412,3 @@ break; | ||
if (item) { | ||
this.doChange.emit({ item, e }); | ||
this.changed.emit({ item, e }); | ||
} | ||
@@ -441,3 +441,3 @@ break; | ||
}, | ||
onClick: e => this.doChange.emit({ item, e }) | ||
onClick: e => this.changed.emit({ item, e }) | ||
}; | ||
@@ -444,0 +444,0 @@ const li = h("li", Object.assign({}, props), getItemLabel(item, this.dataLabel)); |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as o}from"./p-be42af9e.js";(()=>{const o=import.meta.url,a={};return""!==o&&(a.resourcesUrl=new URL(".",o).href),e(a)})().then((e=>o([["p-3edb673d",[[0,"revo-dropdown",{dataLabel:[1,"data-label"],value:[1032],currentFilter:[1032,"current-filter"],dataId:[1,"data-id"],autoClose:[4,"auto-close"],source:[16],placeholder:[1],appendTo:[1,"append-to"],filter:[1],maxHeight:[2,"max-height"],hasFilter:[4,"has-filter"],autocomplete:[4],autoFocus:[4,"auto-focus"],currentItem:[32],isVisible:[32],doClose:[64],doOpen:[64],doChange:[64]},[[5,"mousedown","onMouseUp"],[4,"keydown","onKey"]]],[0,"revo-list",{sourceItems:[16],isFocused:[4,"is-focused"],dataLabel:[1,"data-label"],currentItem:[32],refresh:[64]},[[4,"keydown","onKey"]]]]]],e))); | ||
import{p as e,b as o}from"./p-be42af9e.js";(()=>{const o=import.meta.url,a={};return""!==o&&(a.resourcesUrl=new URL(".",o).href),e(a)})().then((e=>o([["p-6feba98f",[[0,"revo-dropdown",{dataLabel:[1,"data-label"],value:[1032],currentFilter:[1032,"current-filter"],dataId:[1,"data-id"],autoClose:[4,"auto-close"],source:[16],placeholder:[1],appendTo:[1,"append-to"],filter:[1],maxHeight:[2,"max-height"],hasFilter:[4,"has-filter"],autocomplete:[4],autoFocus:[4,"auto-focus"],currentItem:[32],isVisible:[32],doClose:[64],doOpen:[64],doChange:[64]},[[5,"mousedown","onMouseUp"],[4,"keydown","onKey"]]],[0,"revo-list",{sourceItems:[16],isFocused:[4,"is-focused"],dataLabel:[1,"data-label"],currentItem:[32],refresh:[64]},[[4,"keydown","onKey"]]]]]],e))); |
@@ -127,3 +127,3 @@ /* eslint-disable */ | ||
*/ | ||
"onChangeValue"?: (event: CustomEvent<{ val: any; originalEvent?: MouseEvent }>) => void; | ||
"onChanged"?: (event: CustomEvent<{ val: any; originalEvent?: MouseEvent }>) => void; | ||
/** | ||
@@ -156,3 +156,3 @@ * Before element close, can be prevented | ||
"isFocused"?: boolean; | ||
"onDoChange"?: (event: CustomEvent<{ item: any; e: any }>) => void; | ||
"onChanged"?: (event: CustomEvent<{ item: any; e: any }>) => void; | ||
/** | ||
@@ -159,0 +159,0 @@ * Define object mapping for id/value |
@@ -14,3 +14,3 @@ import { EventEmitter } from '../../stencil-public-runtime'; | ||
dataLabel: string; | ||
doChange: EventEmitter<{ | ||
changed: EventEmitter<{ | ||
item: any; | ||
@@ -17,0 +17,0 @@ e: any; |
@@ -16,3 +16,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.el = r.nativeElement; | ||
proxyOutputs(this, this.el, ['changeValue', 'close', 'open']); | ||
proxyOutputs(this, this.el, ['changed', 'close', 'open']); | ||
} | ||
@@ -30,3 +30,3 @@ }; | ||
inputs: ['appendTo', 'autoClose', 'autoFocus', 'autocomplete', 'currentFilter', 'dataId', 'dataLabel', 'filter', 'hasFilter', 'maxHeight', 'placeholder', 'source', 'value'], | ||
outputs: ['changeValue', 'close', 'open'] | ||
outputs: ['changed', 'close', 'open'] | ||
}) | ||
@@ -40,3 +40,3 @@ ], RevoDropdown); | ||
this.el = r.nativeElement; | ||
proxyOutputs(this, this.el, ['doChange']); | ||
proxyOutputs(this, this.el, ['changed']); | ||
} | ||
@@ -54,5 +54,5 @@ }; | ||
inputs: ['dataLabel', 'isFocused', 'sourceItems'], | ||
outputs: ['doChange'] | ||
outputs: ['changed'] | ||
}) | ||
], RevoList); | ||
export { RevoList }; |
@@ -19,7 +19,7 @@ /* tslint:disable */ | ||
inputs: ['appendTo', 'autoClose', 'autoFocus', 'autocomplete', 'currentFilter', 'dataId', 'dataLabel', 'filter', 'hasFilter', 'maxHeight', 'placeholder', 'source', 'value'], | ||
outputs: ['changeValue', 'close', 'open'] | ||
outputs: ['changed', 'close', 'open'] | ||
}) | ||
export class RevoDropdown { | ||
/** When value changed */ | ||
changeValue!: IRevoDropdown['changeValue']; | ||
changed!: IRevoDropdown['changeValue']; | ||
/** Before element close, can be prevented */ | ||
@@ -33,3 +33,3 @@ close!: IRevoDropdown['close']; | ||
this.el = r.nativeElement; | ||
proxyOutputs(this, this.el, ['changeValue', 'close', 'open']); | ||
proxyOutputs(this, this.el, ['changed', 'close', 'open']); | ||
} | ||
@@ -49,7 +49,7 @@ } | ||
inputs: ['dataLabel', 'isFocused', 'sourceItems'], | ||
outputs: ['doChange'] | ||
outputs: ['changed'] | ||
}) | ||
export class RevoList { | ||
/** */ | ||
doChange!: IRevoDropdownList['doChange']; | ||
changed!: IRevoDropdownList['changed']; | ||
protected el: HTMLElement; | ||
@@ -59,4 +59,4 @@ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { | ||
this.el = r.nativeElement; | ||
proxyOutputs(this, this.el, ['doChange']); | ||
proxyOutputs(this, this.el, ['changed']); | ||
} | ||
} |
@@ -38,3 +38,3 @@ /* generated by Svelte v3.31.2 */ | ||
dispose = [ | ||
listen(revo_dropdown, "changeValue", /*onEvent*/ ctx[13]), | ||
listen(revo_dropdown, "changed", /*onEvent*/ ctx[13]), | ||
listen(revo_dropdown, "close", /*onEvent*/ ctx[13]), | ||
@@ -41,0 +41,0 @@ listen(revo_dropdown, "open", /*onEvent*/ ctx[13]) |
@@ -52,3 +52,3 @@ /* eslint-disable */ | ||
/** When value changed */ | ||
changeValue: Parameters<JSX.RevoDropdown["onChangeValue"]>[0] | ||
changed: Parameters<JSX.RevoDropdown["onChanged"]>[0] | ||
@@ -123,3 +123,3 @@ /** Before element close, can be prevented */ | ||
dispose = [ | ||
listen(revo_dropdown, "changeValue", /*onEvent*/ ctx[13]), | ||
listen(revo_dropdown, "changed", /*onEvent*/ ctx[13]), | ||
listen(revo_dropdown, "close", /*onEvent*/ ctx[13]), | ||
@@ -126,0 +126,0 @@ listen(revo_dropdown, "open", /*onEvent*/ ctx[13]) |
@@ -27,3 +27,3 @@ /* generated by Svelte v3.31.2 */ | ||
if (!mounted) { | ||
dispose = listen(revo_list, "doChange", /*onEvent*/ ctx[3]); | ||
dispose = listen(revo_list, "changed", /*onEvent*/ ctx[3]); | ||
mounted = true; | ||
@@ -30,0 +30,0 @@ } |
@@ -22,3 +22,3 @@ /* eslint-disable */ | ||
/** */ | ||
doChange: Parameters<JSX.RevoList["onDoChange"]>[0] | ||
changed: Parameters<JSX.RevoList["onChanged"]>[0] | ||
} | ||
@@ -75,3 +75,3 @@ | ||
if (!mounted) { | ||
dispose = listen(revo_list, "doChange", /*onEvent*/ ctx[3]); | ||
dispose = listen(revo_list, "changed", /*onEvent*/ ctx[3]); | ||
mounted = true; | ||
@@ -78,0 +78,0 @@ } |
@@ -19,3 +19,3 @@ /* eslint-disable */ | ||
'autoFocus', | ||
'changeValue', | ||
'changed', | ||
'close', | ||
@@ -31,3 +31,3 @@ 'open' | ||
'dataLabel', | ||
'doChange' | ||
'changed' | ||
]); |
@@ -25,3 +25,3 @@ /* eslint-disable */ | ||
'autoFocus', | ||
'changeValue', | ||
'changed', | ||
'close', | ||
@@ -40,4 +40,4 @@ 'open' | ||
'dataLabel', | ||
'doChange' | ||
'changed' | ||
]); | ||
{ | ||
"name": "@revolist/revo-dropdown", | ||
"version": "1.1.4", | ||
"version": "2.0.0", | ||
"description": "Minimalistic dropdown with keyboard support and search", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -69,22 +69,28 @@ # `revo-dropdown` | ||
| Property | Attribute | Description | Type | Default | | ||
| ------------- | ------------- | ---------------------------------------- | ----------------------- | ------------ | | ||
| `appendTo` | `append-to` | Where to append element | `"body" \| "current"` | `'body'` | | ||
| `autoClose` | `auto-close` | Should dropdown autoclose on changeValue | `boolean` | `true` | | ||
| `dataId` | `data-id` | Define object mapping for id/value | `string` | `undefined` | | ||
| `dataLabel` | `data-label` | Define object mapping for labels | `string` | `undefined` | | ||
| `filter` | `filter` | Filter criteria | `"contains" \| "start"` | `'contains'` | | ||
| `hasFilter` | `has-filter` | | `boolean` | `true` | | ||
| `placeholder` | `placeholder` | Placeholder text | `string` | `'Select'` | | ||
| `source` | -- | Define object mapping for id/value | `any[]` | `undefined` | | ||
| `value` | `value` | Selected value | `any` | `undefined` | | ||
| Property | Attribute | Description | Type | Default | | ||
| --------------- | ---------------- | ---------------------------------------- | ----------------------- | ----------- | | ||
| `appendTo` | `append-to` | Where to append element | `"body" \| "current"` | `'body'` | | ||
| `autoClose` | `auto-close` | Should dropdown autoclose on changeValue | `boolean` | `true` | | ||
| `autoFocus` | `auto-focus` | | `boolean` | `false` | | ||
| `autocomplete` | `autocomplete` | | `boolean` | `false` | | ||
| `currentFilter` | `current-filter` | Filter value | `any` | `undefined` | | ||
| `dataId` | `data-id` | Define object mapping for id/value | `string` | `undefined` | | ||
| `dataLabel` | `data-label` | Define object mapping for labels | `string` | `undefined` | | ||
| `filter` | `filter` | Filter criteria | `"contains" \| "start"` | `undefined` | | ||
| `hasFilter` | `has-filter` | | `boolean` | `true` | | ||
| `maxHeight` | `max-height` | | `number` | `undefined` | | ||
| `placeholder` | `placeholder` | Placeholder text | `string` | `'Select'` | | ||
| `source` | -- | Define object mapping for id/value | `any[]` | `[]` | | ||
| `value` | `value` | Selected value | `any` | `undefined` | | ||
## Events | ||
| Event | Description | Type | | ||
| ------------- | -------------------------------------- | -------------------------------------------------------- | | ||
| `changeValue` | When value changed | `CustomEvent<{ val: any; originalEvent?: MouseEvent; }>` | | ||
| `close` | Before element close, can be prevented | `CustomEvent<any>` | | ||
| `open` | Before element open, can be prevented | `CustomEvent<any>` | | ||
| Event | Description | Type | | ||
| --------- | -------------------------------------- | -------------------------------------------------------- | | ||
| `changed` | When value changed | `CustomEvent<{ val: any; originalEvent?: MouseEvent; }>` | | ||
| `close` | Before element close, can be prevented | `CustomEvent<any>` | | ||
| `open` | Before element open, can be prevented | `CustomEvent<any>` | | ||
## Methods | ||
@@ -100,4 +106,6 @@ | ||
### `doClose() => Promise<void>` | ||
### `doClose(isDisconnected?: boolean) => Promise<void>` | ||
Close dropdown | ||
@@ -109,2 +117,4 @@ | ||
### `doOpen() => Promise<void>` | ||
@@ -118,18 +128,4 @@ | ||
## Dependencies | ||
### Depends on | ||
- [revo-list](../list) | ||
### Graph | ||
```mermaid | ||
graph TD; | ||
revo-dropdown --> revo-list | ||
style revo-dropdown fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
--- | ||
_Built with [StencilJS](https://stenciljs.com/)_ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564897
128