@paperless/core 2.22.0-alpha.45 → 2.22.0-alpha.46
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/dist/build/p-34b384b9.entry.js +1 -0
- package/dist/build/{p-9b6d89fe.js → p-3821e704.js} +1 -1
- package/dist/{paperless/p-96599994.entry.js → build/p-4ccf0ea2.entry.js} +1 -1
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/p-checkbox_3.cjs.entry.js +11 -5
- package/dist/cjs/p-select.cjs.entry.js +2 -2
- package/dist/cjs/paperless.cjs.js +1 -1
- package/dist/collection/components/molecules/dropdown/dropdown.component.js +31 -5
- package/dist/collection/components/molecules/select/select.component.js +2 -2
- package/dist/components/{p-LPQSLn5-.js → p-BfdNz0_n.js} +1 -1
- package/dist/components/{p-S2ExrdpO.js → p-COEYnacB.js} +1 -1
- package/dist/components/{p-Di2sUFEC.js → p-CzcyDhea.js} +1 -1
- package/dist/components/p-D9NAGtqV.js +1 -0
- package/dist/components/{p-Bqa-pBl-.js → p-DA6lXn-F.js} +1 -1
- package/dist/components/p-datepicker.js +1 -1
- package/dist/components/p-dropdown.js +1 -1
- package/dist/components/p-pagination-pages.js +1 -1
- package/dist/components/p-pagination-size.js +1 -1
- package/dist/components/p-pagination.js +1 -1
- package/dist/components/p-profile.js +1 -1
- package/dist/components/p-select.js +1 -1
- package/dist/components/p-table-footer.js +1 -1
- package/dist/components/p-table.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/p-checkbox_3.entry.js +11 -5
- package/dist/esm/p-select.entry.js +2 -2
- package/dist/esm/paperless.js +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-34b384b9.entry.js +1 -0
- package/dist/{build/p-96599994.entry.js → paperless/p-4ccf0ea2.entry.js} +1 -1
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/dropdown/dropdown.component.d.ts +4 -0
- package/dist/types/components.d.ts +10 -0
- package/hydrate/index.js +14 -7
- package/hydrate/index.mjs +14 -7
- package/package.json +1 -1
- package/dist/build/p-7d48f5bb.entry.js +0 -1
- package/dist/components/p-CLSdb2d9.js +0 -1
- package/dist/paperless/p-7d48f5bb.entry.js +0 -1
package/hydrate/index.js
CHANGED
|
@@ -94180,6 +94180,10 @@ class Dropdown {
|
|
|
94180
94180
|
* Wether to apply chevron automatically
|
|
94181
94181
|
*/
|
|
94182
94182
|
applyChevron = true;
|
|
94183
|
+
/**
|
|
94184
|
+
* Wether to the chevron is manually applied
|
|
94185
|
+
*/
|
|
94186
|
+
manualChevron = false;
|
|
94183
94187
|
/**
|
|
94184
94188
|
* Chevron position
|
|
94185
94189
|
*/
|
|
@@ -94222,24 +94226,26 @@ class Dropdown {
|
|
|
94222
94226
|
this._checkItems();
|
|
94223
94227
|
}
|
|
94224
94228
|
render() {
|
|
94225
|
-
return (hAsync(Host, { key: '
|
|
94229
|
+
return (hAsync(Host, { key: 'f0b2ce04023c667bf22d051c29beaa53549ed637', class: 'relative' }, hAsync("div", { key: 'c73fb7356e6948923b340983b22ceed3ec35b303', class: 'trigger', onClick: () => this._triggerClickHandler() }, hAsync("slot", { key: '2204a45e84b794f6c57e3eb2731b28af6b9b9b95', name: 'trigger' })), hAsync("div", { key: '6485ef65336ae895e9b6943880aed380ea409ea2', class: 'relative w-full' }, hAsync("p-dropdown-menu-container", { key: '4aa30289b1b7522542db38fb1e29a6f203a64e16', allowOverflow: this.allowOverflow, class: cn(dropdownContainerClass({
|
|
94226
94230
|
strategy: this.strategy,
|
|
94227
94231
|
maxWidth: this.applyMaxWidth,
|
|
94228
94232
|
fullWidth: this.applyFullWidth && !this.applyMaxWidth,
|
|
94229
94233
|
isDatepicker: this.isDatepicker,
|
|
94230
|
-
}), this.containerClass), "data-placement": this.placement, "data-strategy": this.strategy, fullWidth: this.applyFullWidth && !this.applyMaxWidth, maxWidth: this.applyMaxWidth, ref: el => this._load(el), role: 'popover', scrollable: this.scrollable, variant: this.variant, onClick: () => this._containerClickHandler() }, hAsync("slot", { key: '
|
|
94234
|
+
}), this.containerClass), "data-placement": this.placement, "data-strategy": this.strategy, fullWidth: this.applyFullWidth && !this.applyMaxWidth, maxWidth: this.applyMaxWidth, ref: el => this._load(el), role: 'popover', scrollable: this.scrollable, variant: this.variant, onClick: () => this._containerClickHandler() }, hAsync("slot", { key: '60036ad51052c0ea0133f414857b3a329908fb98', name: 'items' })))));
|
|
94231
94235
|
}
|
|
94232
94236
|
_checkButtons(active = false) {
|
|
94233
94237
|
const buttons = this._el.querySelectorAll('p-button[slot="trigger"]');
|
|
94234
|
-
const isOpen = this._menu.dataset.show
|
|
94238
|
+
const isOpen = this._menu.dataset.show === '';
|
|
94235
94239
|
for (let button of buttons) {
|
|
94236
94240
|
button.disabled = this.disableTriggerClick;
|
|
94237
94241
|
button.active = active;
|
|
94238
94242
|
if (button.iconOnly) {
|
|
94239
94243
|
continue;
|
|
94240
94244
|
}
|
|
94241
|
-
if (this.applyChevron === false) {
|
|
94242
|
-
|
|
94245
|
+
if (this.applyChevron === false || this.manualChevron === true) {
|
|
94246
|
+
if (this.manualChevron === false) {
|
|
94247
|
+
button.chevron = false;
|
|
94248
|
+
}
|
|
94243
94249
|
continue;
|
|
94244
94250
|
}
|
|
94245
94251
|
button.chevronPosition = this.chevronPosition;
|
|
@@ -94376,6 +94382,7 @@ class Dropdown {
|
|
|
94376
94382
|
"disableTriggerClick": [4, "disable-trigger-click"],
|
|
94377
94383
|
"manual": [4],
|
|
94378
94384
|
"applyChevron": [4, "apply-chevron"],
|
|
94385
|
+
"manualChevron": [4, "manual-chevron"],
|
|
94379
94386
|
"chevronPosition": [1, "chevron-position"],
|
|
94380
94387
|
"chevronDirection": [1, "chevron-direction"],
|
|
94381
94388
|
"containerClass": [1, "container-class"],
|
|
@@ -98468,8 +98475,8 @@ class Select {
|
|
|
98468
98475
|
if (this.error?.length) {
|
|
98469
98476
|
buttonIcon = 'warning';
|
|
98470
98477
|
}
|
|
98471
|
-
return (hAsync(ThemedHost, { key: '617063ca6cf31255928f6f6856cb1902b1d225a2' }, hAsync("p-field-container", { key: '4a6d95f7bfbc79b886044f2fe31695990b4e210d', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '
|
|
98472
|
-
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '
|
|
98478
|
+
return (hAsync(ThemedHost, { key: '617063ca6cf31255928f6f6856cb1902b1d225a2' }, hAsync("p-field-container", { key: '4a6d95f7bfbc79b886044f2fe31695990b4e210d', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '86dd982fca64c61a7c54a6ce104a358a8bfc4c04', applyChevron: false, applyFullWidth: true, applyMaxWidth: false, "disable-trigger-click": this.disabled, insideClick: true, manual: true, manualChevron: true, scrollable: this.enableAutocomplete ? 'large' : true, show: this._showDropdown, slot: 'content', strategy: this.strategy, onIsOpen: ev => this._onDropdownOpen(ev) }, hAsync("p-button", { key: '21fe3c6214c05e6a8f90fd817ecb793bed8b7c3b', active: this._showDropdown, chevron: this.showChevron ? (this._showDropdown ? 'up' : 'down') : false, class: 'w-full', error: !!this.error?.length, icon: buttonIcon, iconClass: this.applyClassOnSelectedItem &&
|
|
98479
|
+
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '7e5b6ceacca4ca732caa7385b96c22d0c8436ac5', class: 'relative min-w-0 flex-1', ref: ref => (this._inputRef = ref) }, this._displayValue)), this.loading ? this._getLoadingItems() : this._getItems(), this.showAddItem && this._getAddItem()))));
|
|
98473
98480
|
}
|
|
98474
98481
|
documentClickHandler(event) {
|
|
98475
98482
|
if (!this._showDropdown || childOfComposed(event, this._el)) {
|
package/hydrate/index.mjs
CHANGED
|
@@ -94178,6 +94178,10 @@ class Dropdown {
|
|
|
94178
94178
|
* Wether to apply chevron automatically
|
|
94179
94179
|
*/
|
|
94180
94180
|
applyChevron = true;
|
|
94181
|
+
/**
|
|
94182
|
+
* Wether to the chevron is manually applied
|
|
94183
|
+
*/
|
|
94184
|
+
manualChevron = false;
|
|
94181
94185
|
/**
|
|
94182
94186
|
* Chevron position
|
|
94183
94187
|
*/
|
|
@@ -94220,24 +94224,26 @@ class Dropdown {
|
|
|
94220
94224
|
this._checkItems();
|
|
94221
94225
|
}
|
|
94222
94226
|
render() {
|
|
94223
|
-
return (hAsync(Host, { key: '
|
|
94227
|
+
return (hAsync(Host, { key: 'f0b2ce04023c667bf22d051c29beaa53549ed637', class: 'relative' }, hAsync("div", { key: 'c73fb7356e6948923b340983b22ceed3ec35b303', class: 'trigger', onClick: () => this._triggerClickHandler() }, hAsync("slot", { key: '2204a45e84b794f6c57e3eb2731b28af6b9b9b95', name: 'trigger' })), hAsync("div", { key: '6485ef65336ae895e9b6943880aed380ea409ea2', class: 'relative w-full' }, hAsync("p-dropdown-menu-container", { key: '4aa30289b1b7522542db38fb1e29a6f203a64e16', allowOverflow: this.allowOverflow, class: cn(dropdownContainerClass({
|
|
94224
94228
|
strategy: this.strategy,
|
|
94225
94229
|
maxWidth: this.applyMaxWidth,
|
|
94226
94230
|
fullWidth: this.applyFullWidth && !this.applyMaxWidth,
|
|
94227
94231
|
isDatepicker: this.isDatepicker,
|
|
94228
|
-
}), this.containerClass), "data-placement": this.placement, "data-strategy": this.strategy, fullWidth: this.applyFullWidth && !this.applyMaxWidth, maxWidth: this.applyMaxWidth, ref: el => this._load(el), role: 'popover', scrollable: this.scrollable, variant: this.variant, onClick: () => this._containerClickHandler() }, hAsync("slot", { key: '
|
|
94232
|
+
}), this.containerClass), "data-placement": this.placement, "data-strategy": this.strategy, fullWidth: this.applyFullWidth && !this.applyMaxWidth, maxWidth: this.applyMaxWidth, ref: el => this._load(el), role: 'popover', scrollable: this.scrollable, variant: this.variant, onClick: () => this._containerClickHandler() }, hAsync("slot", { key: '60036ad51052c0ea0133f414857b3a329908fb98', name: 'items' })))));
|
|
94229
94233
|
}
|
|
94230
94234
|
_checkButtons(active = false) {
|
|
94231
94235
|
const buttons = this._el.querySelectorAll('p-button[slot="trigger"]');
|
|
94232
|
-
const isOpen = this._menu.dataset.show
|
|
94236
|
+
const isOpen = this._menu.dataset.show === '';
|
|
94233
94237
|
for (let button of buttons) {
|
|
94234
94238
|
button.disabled = this.disableTriggerClick;
|
|
94235
94239
|
button.active = active;
|
|
94236
94240
|
if (button.iconOnly) {
|
|
94237
94241
|
continue;
|
|
94238
94242
|
}
|
|
94239
|
-
if (this.applyChevron === false) {
|
|
94240
|
-
|
|
94243
|
+
if (this.applyChevron === false || this.manualChevron === true) {
|
|
94244
|
+
if (this.manualChevron === false) {
|
|
94245
|
+
button.chevron = false;
|
|
94246
|
+
}
|
|
94241
94247
|
continue;
|
|
94242
94248
|
}
|
|
94243
94249
|
button.chevronPosition = this.chevronPosition;
|
|
@@ -94374,6 +94380,7 @@ class Dropdown {
|
|
|
94374
94380
|
"disableTriggerClick": [4, "disable-trigger-click"],
|
|
94375
94381
|
"manual": [4],
|
|
94376
94382
|
"applyChevron": [4, "apply-chevron"],
|
|
94383
|
+
"manualChevron": [4, "manual-chevron"],
|
|
94377
94384
|
"chevronPosition": [1, "chevron-position"],
|
|
94378
94385
|
"chevronDirection": [1, "chevron-direction"],
|
|
94379
94386
|
"containerClass": [1, "container-class"],
|
|
@@ -98466,8 +98473,8 @@ class Select {
|
|
|
98466
98473
|
if (this.error?.length) {
|
|
98467
98474
|
buttonIcon = 'warning';
|
|
98468
98475
|
}
|
|
98469
|
-
return (hAsync(ThemedHost, { key: '617063ca6cf31255928f6f6856cb1902b1d225a2' }, hAsync("p-field-container", { key: '4a6d95f7bfbc79b886044f2fe31695990b4e210d', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '
|
|
98470
|
-
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '
|
|
98476
|
+
return (hAsync(ThemedHost, { key: '617063ca6cf31255928f6f6856cb1902b1d225a2' }, hAsync("p-field-container", { key: '4a6d95f7bfbc79b886044f2fe31695990b4e210d', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '86dd982fca64c61a7c54a6ce104a358a8bfc4c04', applyChevron: false, applyFullWidth: true, applyMaxWidth: false, "disable-trigger-click": this.disabled, insideClick: true, manual: true, manualChevron: true, scrollable: this.enableAutocomplete ? 'large' : true, show: this._showDropdown, slot: 'content', strategy: this.strategy, onIsOpen: ev => this._onDropdownOpen(ev) }, hAsync("p-button", { key: '21fe3c6214c05e6a8f90fd817ecb793bed8b7c3b', active: this._showDropdown, chevron: this.showChevron ? (this._showDropdown ? 'up' : 'down') : false, class: 'w-full', error: !!this.error?.length, icon: buttonIcon, iconClass: this.applyClassOnSelectedItem &&
|
|
98477
|
+
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '7e5b6ceacca4ca732caa7385b96c22d0c8436ac5', class: 'relative min-w-0 flex-1', ref: ref => (this._inputRef = ref) }, this._displayValue)), this.loading ? this._getLoadingItems() : this._getItems(), this.showAddItem && this._getAddItem()))));
|
|
98471
98478
|
}
|
|
98472
98479
|
documentClickHandler(event) {
|
|
98473
98480
|
if (!this._showDropdown || childOfComposed(event, this._el)) {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s}from"./p-yFtRjnrU.js";import{c as r}from"./p-CBWjHURv.js";import{T as a}from"./p-CSySY6aC.js";import{a as h}from"./p-TyZ7uPES.js";import{c as o}from"./p-xs4N_Y-0.js";import{S as n}from"./p-CEaB2BT0.js";import"./p-ChV9xqsO.js";import"./p-6XOzWrsN.js";const l=r(["flex items-center gap-2","flex-1 min-w-0 h-full","pointer-events-none overflow-hidden"]),d=r(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","text-sm font-semibold whitespace-nowrap","rounded-lg","bg-indigo-100","dark:bg-white/15"]),c=r("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"text-storm-400 dark:text-white",default:null},enableTextWrap:{true:!1,false:"text-ellipsis whitespace-nowrap"},error:{true:"text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800",false:null}}}),p=class{constructor(i){t(this,i),this.queryChange=e(this,"queryChange",3),this.valueChange=e(this,"valueChange",3),this.selectAllChange=e(this,"selectAllChange",3),this.dropdownShown=e(this,"dropdownShown",3),this.add=e(this,"add",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=!0;showChevron=!0;maxDisplayedItems=n;enableAutocomplete=!0;enableTextWrap=!1;asyncFilter=!1;loading=!1;enableSelectAll=!1;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=!0;showOptional=!0;error;disabled=!1;showAddItem=!1;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=!1;_selectedItem=null;_allSelected=!1;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:c({variant:"placeholder"})},this.placeholder);return this._selectedItem?this.multi?0===this._selectedItem?.length?t:s("div",{class:l(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:d(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden)):this._getDisplay(this._selectedItem,!0):t}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey)throw new Error("You must provide a valueKey or identifierKey");this.multi&&(this._setMultiContainerMaxWidth(),this._resizeObserver=new ResizeObserver((()=>{this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth(),this._setCheckSelectedItemsTimeout()}),200)})),this._resizeObserver.observe(this._el)),this.value?this._valueChange():this.itemChanges()}componentDidRender(){this.multi&&this._setMultiContainerMaxWidth()}disconnectedCallback(){this.multi&&this._resizeObserver.disconnect()}render(){let t=this.icon;return this._selectedItem&&!this.avatarKey&&this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem&&(t=this._selectedItem[this.iconKey]),(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey])&&(t=null),this.error?.length&&(t="warning"),s(a,{key:"617063ca6cf31255928f6f6856cb1902b1d225a2"},s("p-field-container",{key:"4a6d95f7bfbc79b886044f2fe31695990b4e210d",error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,label:this.label,prefix:this.prefix,required:this.required,showOptional:this.showOptional,variant:"write"},s("p-dropdown",{key:"85f6409928f327efcfc78cef1dddb9c30178e6ed",applyChevron:!1,applyFullWidth:!0,applyMaxWidth:!1,"disable-trigger-click":this.disabled,insideClick:!0,manual:!0,scrollable:!this.enableAutocomplete||"large",show:this._showDropdown,slot:"content",strategy:this.strategy,onIsOpen:t=>this._onDropdownOpen(t)},s("p-button",{key:"9c892e4edc472af73e0c2cbba419012d08302adc",active:this._showDropdown,chevron:!!this.showChevron&&(this._showDropdown?"up":"down"),class:"w-full",error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],size:this.size,slot:"trigger",variant:"secondary",onClick:t=>this._onClick(t)},s("div",{key:"6fa19bac84f26dbc0c3aa97985c6deb40c4eb641",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){this._showDropdown&&!h(t,this._el)&&(this._showDropdown=!1)}_valueChange(){setTimeout((()=>{this._preselectItem(),this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){this._selectedItem&&!Array.isArray(this._selectedItem)&&(this._selectedItem=[])}_preselectItem(){let t="string"==typeof this.value&&this.multi?JSON.parse(this.value):this.value;if(this.multi)return Array.isArray(t)?(this.value=t,0===t.length?void(this._selectedItem=[]):void(this._selectedItem=this.valueKey&&"false"!==this.valueKey?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t])):(this.value=[],void this.valueChange.emit(this.value));this._selectedItem||t||!this.autoSelectFirst||(t=this._items[0]);const e="object"==typeof t&&null!==t?t[this._identifierKey]:t,i="string"==typeof e||"number"==typeof e?e:JSON.stringify(e),s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null,r="string"==typeof s||"number"==typeof s?s:JSON.stringify(s);if(this._selectedItem&&r===i)return;if(!this._items?.length&&t)return void this._selectValue(t,!1);const a=this._getParsedItems(!1).find((t=>{const e=t?.[this._identifierKey];return("string"==typeof e||"number"==typeof e?e:JSON.stringify(e))===i}));this._selectValue(a??t,!1)}_selectValue(t,e=!0){let i=this.valueKey&&"false"!==this.valueKey&&null!==t&&!this.loading?t?.[this.valueKey]:t;if(this.multi){this._selectedItem&&Array.isArray(this._selectedItem)||(this._selectedItem=[]),this.value&&Array.isArray(this.value)||(this.value=[]);const e=[...this._selectedItem],s=[...this.value],r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));return-1===r?(e.push(t),s.push(i)):(e.splice(r,1),s.splice(r,1)),this._selectedItem=e,this.value=s,void this.valueChange.emit(s)}this._selectedItem=t,this._onBlur(e),i!==this.value&&(this.value=i,this.valueChange.emit(i))}_onClick(t){const e=t?.composedPath();for(const t of e){if("p-button"===t.nodeName.toLowerCase())break;if(t.classList?.contains("item"))return}this._showDropdown=!this._showDropdown}_onBlur(t=!1){this.enableAutocomplete&&!t||(this._showDropdown=!1)}_onAutoComplete(t){this.enableAutocomplete&&(this._showDropdown=!0,this.query=t.detail,this.queryChange.emit(t.detail))}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.some((e=>e[this._identifierKey]===t[this._identifierKey])):t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{active:e,checkbox:!!this.multi,enableTextWrap:this.enableTextWrap,slot:"items",useContainer:!1,onClick:()=>this._selectValue(t)},this._getDisplay(t,!1,e))}));return 0===this._items.length&&(t=[s("p",{class:"w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200",slot:"items"},this.emptyStateText)]),this.enableSelectAll&&this._items.length>0&&t.unshift(s("p-dropdown-menu-item",{active:this._allSelected,slot:"items",useContainer:!1,checkbox:!0,onClick:()=>this._selectAllChange()},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText)),this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAddItem(){return s("p-dropdown-menu-item",{slot:"items",useContainer:!1,onClick:()=>this.add.emit()},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"})))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:!1,slot:"items"},s("p-loader",{class:"h-6 w-full rounded",variant:"ghost"}))));return this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,value:this.query,onInputRefChange:t=>this.autocompleteInputRef=t.detail,onValueChange:t=>this._onAutoComplete(t)}))}_setMultiContainerMaxWidth(){this._inputRef&&this._multiContainerRef&&(this._multiContainerRef.style.maxWidth=`${Math.max(this._inputRef.clientWidth-16,16)}px`)}_setCheckSelectedItemsTimeout(){this._checkSelectedItemsTimeout&&clearTimeout(this._checkSelectedItemsTimeout),this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef)return;const t=this._multiContainerRef.getBoundingClientRect(),e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e)s.classList.remove("hidden"),s.classList.add("flex"),s.getBoundingClientRect().right>t.right&&(s.classList.remove("flex"),s.classList.add("hidden"),i++);this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");s&&(s.classList.contains("hidden")||s.classList.add("hidden"),i>0&&s.classList.remove("hidden"))}_onDropdownOpen(t){t.detail&&this.autocompleteInputRef&&setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected,this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=!1,i=!1){let r=s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);return this.avatarKey&&(r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{letters:t[this.avatarLettersKey],size:"sm",src:t[this.avatarKey]}),s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),!this.iconKey||e&&!this.showIconOnSelectedItem||(r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:o("text-storm-300 dark:text-hurricane-200",e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu?"":t?.[this.iconClassKey]??""),variant:t[this.iconKey]}),s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu||!t?.[this.classKey]?.length?r:s("div",{class:t[this.classKey]},r)}_getParsedItems(t=!0){if(!this.items||this.loading)return[];let e="string"==typeof this.items?JSON.parse(this.items):this.items;return"string"==typeof e?.[0]&&(this.displayKey="text",this.valueKey="value",e=e.map((t=>({value:t,text:t})))),this.query?.length&&!this.asyncFilter&&(e=e.filter((t=>this.queryKey?this._checkvalue(this.queryKey,t):this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)))),t?e?.slice(0,this.maxDisplayedItems):e}static get formAssociated(){return!0}static get watchers(){return{value:[{_valueChange:0}],items:[{itemChanges:0}],_showDropdown:[{_showDropdownChanges:0}],multi:[{multiChanges:0}]}}};p.style="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.mb-3{margin-bottom:.75rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-8{height:2rem}.h-\\[1\\.625rem\\]{height:1.625rem}.h-full{height:100%}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1 1 0%}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.bg-indigo-100{--tw-bg-opacity:1;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-indigo-500{--tw-text-opacity:1;color:rgb(142 179 251/var(--tw-text-opacity,1))}.text-indigo-600{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity,1))}.text-negative-red-700{--tw-text-opacity:1;color:rgb(147 16 16/var(--tw-text-opacity,1))}.text-storm-100{--tw-text-opacity:1;color:rgb(209 210 212/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-400{--tw-text-opacity:1;color:rgb(70 75 84/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1;color:rgb(141 16 16/var(--tw-text-opacity,1))}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1;color:rgb(27 88 210/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{p as p_select}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as i,H as e,c as s,h as a,d as n}from"./p-CySg37XO.js";import{a as o,c as h,o as d,f as r,s as l}from"./p-CeBIrPPx.js";import{c}from"./p-CBWjHURv.js";import{a as m}from"./p-TyZ7uPES.js";import{c as p}from"./p-xs4N_Y-0.js";import{d as w}from"./p-Bl7NThUo.js";const f=c(["hidden"],{variants:{strategy:{absolute:"absolute",fixed:"fixed"},fullWidth:{false:null,true:"w-full"},maxWidth:{false:null,true:"max-w-[13.875rem]"},isDatepicker:{false:"z-dropdown",true:"z-datepicker"}},compoundVariants:[{fullWidth:!1,maxWidth:!0,class:"w-auto"}]}),u=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.isOpen=s(this,"isOpen",3)}variant="default";placement="bottom-start";offset=8;strategy="absolute";show=!1;applyMaxWidth=!0;applyFullWidth=!0;allowOverflow=!1;scrollable=!1;insideClick=!1;disableTriggerClick=!1;manual=!1;applyChevron=!0;chevronPosition="end";chevronDirection;containerClass;isDatepicker=!1;get _el(){return this}isOpen;_loaded=!1;_menu;_cleanup;componentShouldUpdate(){this._update()}componentDidLoad(){this._checkButtons()}disconnectedCallback(){this._cleanup&&(this._cleanup(),this._cleanup=null)}componentDidRender(){this._checkButtons(),this._checkItems()}render(){return a(n,{key:"a17b79f6f52d1f05599c69325336023fc2f3e7aa",class:"relative"},a("div",{key:"7a817d9ed9b99feaa7d6fb7da4a298f1f89699ad",class:"trigger",onClick:()=>this._triggerClickHandler()},a("slot",{key:"b1b8a2b4f4d874f34272b102799201963a6d0e8a",name:"trigger"})),a("div",{key:"5a4de9be5e8e7238c0b478013187fa8b6f86cdf6",class:"relative w-full"},a("p-dropdown-menu-container",{key:"b52f2e1f25e555ac036e903605bd5c4dcafced22",allowOverflow:this.allowOverflow,class:p(f({strategy:this.strategy,maxWidth:this.applyMaxWidth,fullWidth:this.applyFullWidth&&!this.applyMaxWidth,isDatepicker:this.isDatepicker}),this.containerClass),"data-placement":this.placement,"data-strategy":this.strategy,fullWidth:this.applyFullWidth&&!this.applyMaxWidth,maxWidth:this.applyMaxWidth,ref:t=>this._load(t),role:"popover",scrollable:this.scrollable,variant:this.variant,onClick:()=>this._containerClickHandler()},a("slot",{key:"45415dddb502b2bf3debfc096e88f12fef1a5829",name:"items"}))))}_checkButtons(t=!1){const i=this._el.querySelectorAll('p-button[slot="trigger"]'),e=null!==this._menu.dataset.show;for(let s of i)s.disabled=this.disableTriggerClick,s.active=t,s.iconOnly||(!1!==this.applyChevron?(s.chevronPosition=this.chevronPosition,s.chevron=this.chevronDirection??(this.placement.includes("top")?e?"down":"up":e?"up":"down")):s.chevron=!1)}_checkItems(){const t=this._el.querySelectorAll("p-dropdown-menu-item");for(let i of t)"pagination"!==i.variant&&"negative"!==i.variant&&(i.variant=this.variant)}onShowChange(t){this._loaded&&(t?this._show():this._hide())}documentClickHandler(t){Object.hasOwn(this._menu.dataset,"show")&&!m(t,this._menu)&&this._hide()}_containerClickHandler(){this.insideClick||Object.hasOwn(this._menu.dataset,"show")&&this._hide()}_triggerClickHandler(){this.disableTriggerClick||this.manual||(Object.hasOwn(this._menu.dataset,"show")?this._hide():this._show())}_load(t){this._menu=t,t&&(this._update(),this._loaded=!0,this.show&&setTimeout((()=>this._show()),100))}_show(){this._loaded&&(this._cleanup=o(this._el,this._menu,(()=>this._update())),this._menu.dataset.show="",this._menu.classList.remove("hidden"),this._menu.classList.add("block"),this.isOpen.emit(!0),this._checkButtons(!0))}_hide(){this._loaded&&!this.show&&(this._cleanup&&(this._cleanup(),this._cleanup=null),delete this._menu.dataset.show,this._menu.classList.remove("block"),this._menu.classList.add("hidden"),this.isOpen.emit(!1),this._checkButtons(!1))}_update(){this._menu&&h(this._el,this._menu,{placement:this.placement,strategy:this.strategy,middleware:[d(this.offset),r(),l()]}).then((({x:t,y:i,placement:e})=>{this._menu.dataset.placement=e,Object.assign(this._menu.style,{top:`${i}px`,left:`${t}px`})}))}static get watchers(){return{show:[{onShowChange:0}]}}static get style(){return"*{box-sizing:border-box}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.z-datepicker{z-index:401}.z-dropdown{z-index:200}.block{display:block}.hidden{display:none}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[13\\.875rem\\]{max-width:13.875rem}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:85.375rem){.container{max-width:85.375rem}}@media (min-width:90rem){.container{max-width:90rem}}@media (min-width:96rem){.container{max-width:96rem}}@media (min-width:105rem){.container{max-width:105rem}}@media (min-width:120rem){.container{max-width:120rem}}@media (min-width:160rem){.container{max-width:160rem}}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}"}},[769,"p-dropdown",{variant:[1],placement:[513],offset:[2],strategy:[1],show:[4],applyMaxWidth:[4,"apply-max-width"],applyFullWidth:[4,"apply-full-width"],allowOverflow:[4,"allow-overflow"],scrollable:[8],insideClick:[4,"inside-click"],disableTriggerClick:[4,"disable-trigger-click"],manual:[4],applyChevron:[4,"apply-chevron"],chevronPosition:[1,"chevron-position"],chevronDirection:[1,"chevron-direction"],containerClass:[1,"container-class"],isDatepicker:[4,"is-datepicker"]},[[6,"click","documentClickHandler"]],{show:[{onShowChange:0}]}]);function x(){"undefined"!=typeof customElements&&["p-dropdown","p-dropdown-menu-container"].forEach((i=>{switch(i){case"p-dropdown":customElements.get(t(i))||customElements.define(t(i),u);break;case"p-dropdown-menu-container":customElements.get(t(i))||w()}}))}x();export{u as D,x as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s}from"./p-yFtRjnrU.js";import{c as r}from"./p-CBWjHURv.js";import{T as a}from"./p-CSySY6aC.js";import{a as h}from"./p-TyZ7uPES.js";import{c as o}from"./p-xs4N_Y-0.js";import{S as n}from"./p-CEaB2BT0.js";import"./p-ChV9xqsO.js";import"./p-6XOzWrsN.js";const l=r(["flex items-center gap-2","flex-1 min-w-0 h-full","pointer-events-none overflow-hidden"]),d=r(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","text-sm font-semibold whitespace-nowrap","rounded-lg","bg-indigo-100","dark:bg-white/15"]),c=r("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"text-storm-400 dark:text-white",default:null},enableTextWrap:{true:!1,false:"text-ellipsis whitespace-nowrap"},error:{true:"text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800",false:null}}}),p=class{constructor(i){t(this,i),this.queryChange=e(this,"queryChange",3),this.valueChange=e(this,"valueChange",3),this.selectAllChange=e(this,"selectAllChange",3),this.dropdownShown=e(this,"dropdownShown",3),this.add=e(this,"add",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=!0;showChevron=!0;maxDisplayedItems=n;enableAutocomplete=!0;enableTextWrap=!1;asyncFilter=!1;loading=!1;enableSelectAll=!1;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=!0;showOptional=!0;error;disabled=!1;showAddItem=!1;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=!1;_selectedItem=null;_allSelected=!1;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:c({variant:"placeholder"})},this.placeholder);return this._selectedItem?this.multi?0===this._selectedItem?.length?t:s("div",{class:l(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:d(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden)):this._getDisplay(this._selectedItem,!0):t}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey)throw new Error("You must provide a valueKey or identifierKey");this.multi&&(this._setMultiContainerMaxWidth(),this._resizeObserver=new ResizeObserver((()=>{this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth(),this._setCheckSelectedItemsTimeout()}),200)})),this._resizeObserver.observe(this._el)),this.value?this._valueChange():this.itemChanges()}componentDidRender(){this.multi&&this._setMultiContainerMaxWidth()}disconnectedCallback(){this.multi&&this._resizeObserver.disconnect()}render(){let t=this.icon;return this._selectedItem&&!this.avatarKey&&this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem&&(t=this._selectedItem[this.iconKey]),(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey])&&(t=null),this.error?.length&&(t="warning"),s(a,{key:"617063ca6cf31255928f6f6856cb1902b1d225a2"},s("p-field-container",{key:"4a6d95f7bfbc79b886044f2fe31695990b4e210d",error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,label:this.label,prefix:this.prefix,required:this.required,showOptional:this.showOptional,variant:"write"},s("p-dropdown",{key:"85f6409928f327efcfc78cef1dddb9c30178e6ed",applyChevron:!1,applyFullWidth:!0,applyMaxWidth:!1,"disable-trigger-click":this.disabled,insideClick:!0,manual:!0,scrollable:!this.enableAutocomplete||"large",show:this._showDropdown,slot:"content",strategy:this.strategy,onIsOpen:t=>this._onDropdownOpen(t)},s("p-button",{key:"9c892e4edc472af73e0c2cbba419012d08302adc",active:this._showDropdown,chevron:!!this.showChevron&&(this._showDropdown?"up":"down"),class:"w-full",error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],size:this.size,slot:"trigger",variant:"secondary",onClick:t=>this._onClick(t)},s("div",{key:"6fa19bac84f26dbc0c3aa97985c6deb40c4eb641",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){this._showDropdown&&!h(t,this._el)&&(this._showDropdown=!1)}_valueChange(){setTimeout((()=>{this._preselectItem(),this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){this._selectedItem&&!Array.isArray(this._selectedItem)&&(this._selectedItem=[])}_preselectItem(){let t="string"==typeof this.value&&this.multi?JSON.parse(this.value):this.value;if(this.multi)return Array.isArray(t)?(this.value=t,0===t.length?void(this._selectedItem=[]):void(this._selectedItem=this.valueKey&&"false"!==this.valueKey?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t])):(this.value=[],void this.valueChange.emit(this.value));this._selectedItem||t||!this.autoSelectFirst||(t=this._items[0]);const e="object"==typeof t&&null!==t?t[this._identifierKey]:t,i="string"==typeof e||"number"==typeof e?e:JSON.stringify(e),s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null,r="string"==typeof s||"number"==typeof s?s:JSON.stringify(s);if(this._selectedItem&&r===i)return;if(!this._items?.length&&t)return void this._selectValue(t,!1);const a=this._getParsedItems(!1).find((t=>{const e=t?.[this._identifierKey];return("string"==typeof e||"number"==typeof e?e:JSON.stringify(e))===i}));this._selectValue(a??t,!1)}_selectValue(t,e=!0){let i=this.valueKey&&"false"!==this.valueKey&&null!==t&&!this.loading?t?.[this.valueKey]:t;if(this.multi){this._selectedItem&&Array.isArray(this._selectedItem)||(this._selectedItem=[]),this.value&&Array.isArray(this.value)||(this.value=[]);const e=[...this._selectedItem],s=[...this.value],r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));return-1===r?(e.push(t),s.push(i)):(e.splice(r,1),s.splice(r,1)),this._selectedItem=e,this.value=s,void this.valueChange.emit(s)}this._selectedItem=t,this._onBlur(e),i!==this.value&&(this.value=i,this.valueChange.emit(i))}_onClick(t){const e=t?.composedPath();for(const t of e){if("p-button"===t.nodeName.toLowerCase())break;if(t.classList?.contains("item"))return}this._showDropdown=!this._showDropdown}_onBlur(t=!1){this.enableAutocomplete&&!t||(this._showDropdown=!1)}_onAutoComplete(t){this.enableAutocomplete&&(this._showDropdown=!0,this.query=t.detail,this.queryChange.emit(t.detail))}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.some((e=>e[this._identifierKey]===t[this._identifierKey])):t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{active:e,checkbox:!!this.multi,enableTextWrap:this.enableTextWrap,slot:"items",useContainer:!1,onClick:()=>this._selectValue(t)},this._getDisplay(t,!1,e))}));return 0===this._items.length&&(t=[s("p",{class:"w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200",slot:"items"},this.emptyStateText)]),this.enableSelectAll&&this._items.length>0&&t.unshift(s("p-dropdown-menu-item",{active:this._allSelected,slot:"items",useContainer:!1,checkbox:!0,onClick:()=>this._selectAllChange()},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText)),this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAddItem(){return s("p-dropdown-menu-item",{slot:"items",useContainer:!1,onClick:()=>this.add.emit()},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"})))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:!1,slot:"items"},s("p-loader",{class:"h-6 w-full rounded",variant:"ghost"}))));return this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,value:this.query,onInputRefChange:t=>this.autocompleteInputRef=t.detail,onValueChange:t=>this._onAutoComplete(t)}))}_setMultiContainerMaxWidth(){this._inputRef&&this._multiContainerRef&&(this._multiContainerRef.style.maxWidth=`${Math.max(this._inputRef.clientWidth-16,16)}px`)}_setCheckSelectedItemsTimeout(){this._checkSelectedItemsTimeout&&clearTimeout(this._checkSelectedItemsTimeout),this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef)return;const t=this._multiContainerRef.getBoundingClientRect(),e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e)s.classList.remove("hidden"),s.classList.add("flex"),s.getBoundingClientRect().right>t.right&&(s.classList.remove("flex"),s.classList.add("hidden"),i++);this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");s&&(s.classList.contains("hidden")||s.classList.add("hidden"),i>0&&s.classList.remove("hidden"))}_onDropdownOpen(t){t.detail&&this.autocompleteInputRef&&setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected,this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=!1,i=!1){let r=s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);return this.avatarKey&&(r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{letters:t[this.avatarLettersKey],size:"sm",src:t[this.avatarKey]}),s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),!this.iconKey||e&&!this.showIconOnSelectedItem||(r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:o("text-storm-300 dark:text-hurricane-200",e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu?"":t?.[this.iconClassKey]??""),variant:t[this.iconKey]}),s("div",{class:c({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu||!t?.[this.classKey]?.length?r:s("div",{class:t[this.classKey]},r)}_getParsedItems(t=!0){if(!this.items||this.loading)return[];let e="string"==typeof this.items?JSON.parse(this.items):this.items;return"string"==typeof e?.[0]&&(this.displayKey="text",this.valueKey="value",e=e.map((t=>({value:t,text:t})))),this.query?.length&&!this.asyncFilter&&(e=e.filter((t=>this.queryKey?this._checkvalue(this.queryKey,t):this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)))),t?e?.slice(0,this.maxDisplayedItems):e}static get formAssociated(){return!0}static get watchers(){return{value:[{_valueChange:0}],items:[{itemChanges:0}],_showDropdown:[{_showDropdownChanges:0}],multi:[{multiChanges:0}]}}};p.style="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.mb-3{margin-bottom:.75rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-8{height:2rem}.h-\\[1\\.625rem\\]{height:1.625rem}.h-full{height:100%}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1 1 0%}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.bg-indigo-100{--tw-bg-opacity:1;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-indigo-500{--tw-text-opacity:1;color:rgb(142 179 251/var(--tw-text-opacity,1))}.text-indigo-600{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity,1))}.text-negative-red-700{--tw-text-opacity:1;color:rgb(147 16 16/var(--tw-text-opacity,1))}.text-storm-100{--tw-text-opacity:1;color:rgb(209 210 212/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-400{--tw-text-opacity:1;color:rgb(70 75 84/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1;color:rgb(141 16 16/var(--tw-text-opacity,1))}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1;color:rgb(27 88 210/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{p as p_select}
|