From f30f84fe7b1d09ee63a1f2a1d5c8cb303e31669a Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 25 四月 2023 17:47:26 +0800
Subject: [PATCH] 修改失单页面
---
force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js | 173 +++++++++++++++++++
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js | 135 +++++++-------
force-app/main/default/lwc/multiSelectCombobox/__tests__/multiSelectCombobox.test.js | 25 ++
force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox .css | 35 +++
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html | 55 ++++--
force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html | 58 ++++++
force-app/main/default/classes/lexPCLLostReportLwcController.cls | 25 ++
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.css | 21 ++
force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js-meta.xml | 5
9 files changed, 448 insertions(+), 84 deletions(-)
diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index 2127ee4..776380d 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -353,6 +353,31 @@
return dataCheck;
}
@AuraEnabled
+ public static List<String> getValuesFromTable(){
+ String ObjectApi_name = 'PCLLostBrand__c';
+ String Field_name = 'Lost_By_Company__c';
+ List<String> lstPickvals=new List<String>();
+ //From the Object Api name retrieving the SObject
+ Schema.SObjectType targetType = Schema.getGlobalDescribe().get(ObjectApi_name);
+ Sobject Object_name = targetType.newSObject();
+ //grab the sobject that was passed
+ Schema.sObjectType sobject_type = Object_name.getSObjectType();
+ //describe the sobject
+ Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
+ //get a map of fields for the passed sobject
+ Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
+ //grab the list of picklist values for the passed field on the sobject
+ List<Schema.PicklistEntry> pick_list_values = field_map.get(Field_name).getDescribe().getPickListValues();
+
+ for (Schema.PicklistEntry a : pick_list_values)
+ { //for all values in the picklist list
+
+ lstPickvals.add(a.getValue());//add the value to our final list
+ }
+
+ return lstPickvals;
+ }
+ @AuraEnabled
public static list<LostBrand> brandcopy(){
list<LostBrand> tempbrands = new list<LostBrand>();
for(LostBrand tempbrand: LostReport.LostBrands) {
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.css b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.css
new file mode 100644
index 0000000..ab3e552
--- /dev/null
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.css
@@ -0,0 +1,21 @@
+.combobox-container {
+ display: flex;
+ align-items: center;
+}
+
+.combobox-container label {
+ margin-right: 10px;
+}
+
+
+.my-combobox {
+ display: flex;
+ align-items: center;
+ padding: 0 0.5rem;
+ width: 144px;
+}
+
+.slds-form-element__label {
+ width: 144px;
+ margin-right: -5rem;
+}
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
index dc39ff7..1d122cd 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,48 +4,67 @@
* @Author: chen jing wu
* @Date: 2023-04-20 17:16:48
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-24 16:34:14
+ * @LastEditTime: 2023-04-25 17:45:31
-->
<template>
<lightning-card variant="Narrow">
+ <!-- <lightning-input onchange={initAll}></lightning-input> -->
<div style="padding: 0 20px">
<lightning-layout>
- <div style="padding: 10px 3px;border-bottom: 1px solid;font: 16px;font-size: blod;">澶卞崟鎶ュ憡缂栬緫椤甸潰</div>
- <lightning-layout-item flexibility="auto" padding="around-small">
- <lightning-button label="杩藉姞鍝佺墝" onclick={addBrandJs}></lightning-button>
+ <lightning-layout-item>
+ <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;">澶卞崟鎶ュ憡缂栬緫椤甸潰</div>
</lightning-layout-item>
- <lightning-layout-item flexibility="auto" padding="around-small">
+ <div class="slds-align_absolute-center">
+ <lightning-layout-item size="12">
+ <lightning-button label="杩藉姞鍝佺墝" onclick={addBrandJs}></lightning-button>
+ <lightning-button label="淇濆瓨" onclick={saveJs}></lightning-button>
+ <lightning-button label="杩斿洖璇环" onclick={cancel}></lightning-button>
+ </lightning-layout-item>
+ </div>
+ <!-- <lightning-layout-item flexibility="auto" padding="around-small">
<lightning-button label="淇濆瓨" onclick={saveJs}></lightning-button>
</lightning-layout-item>
<lightning-layout-item flexibility="auto" padding="around-small">
<lightning-button label="杩斿洖璇环" onclick={cancel}></lightning-button>
- </lightning-layout-item>
+ </lightning-layout-item> -->
</lightning-layout>
<div style="margin-top: 5px">
<lightning-layout>
<lightning-layout-item flexibility="auto" padding="around-small">
- <lightning-combobox name="progress" label="澶卞崟绫诲瀷" value={lostReportObj.RecordType} options={RecordTypeOptions}
- onchange={handleStatus1Change} class="searchField">
- </lightning-combobox>
+ <!-- <div class="combobox-container">
+ <label for="losttype">澶卞崟绫诲瀷:</label>
+ <lightning-combobox id="losttype" name="progress" value={lostReportObj.RecordType} options={RecordTypeOptions}
+ onchange={handleStatus1Change} class="searchField" style="width: 71.33px; height: 32px;">
+ </lightning-combobox>
+ </div> -->
+ <div class="slds-form_horizontal my-combobox">
+ <label class="slds-form-element__label">澶卞崟绫诲瀷</label>
+ <lightning-combobox name="progress" value={lostReportObj.RecordType} options={RecordTypeOptions}
+ onchange={handleStatus1Change} class="searchField" style="width: 71.33px; height: 32px;">
+ </lightning-combobox>
+ </div>
</lightning-layout-item>
<lightning-layout-item flexibility="auto" padding="around-small">
- <div style="padding: 10px 3px;border-bottom: 1px solid;font: 14px;font-size: blod;">澶卞崟鎬婚噾棰濓紙鍏冿級:</div>
- <lightning-output-field>{LostReport.lostReport.LostTotalAmount__c}</lightning-output-field>
+ <div style="padding: 10px 3px;font: 16px;">澶卞崟鎬婚噾棰濓紙鍏冿級:</div>
+ <!-- <lightning-output-field>{LostReport.lostReport.LostTotalAmount__c}</lightning-output-field> -->
+ <lightning-output-field>0</lightning-output-field>
</lightning-layout-item>
<lightning-layout-item>
- <div style="padding: 10px 3px;border-bottom: 1px solid;font: 14px;font-size: blod;">鐘舵��:</div>
- <lightning-output-field>{LostReport.lostReport.Report_Status__c}</lightning-output-field>
+ <div style="padding: 10px 3px;font: 16px;">鐘舵��:</div>
+ <!-- <lightning-output-field>{LostReport.lostReport.Report_Status__c}</lightning-output-field> -->
+ <div style="padding: 10px 3px;font: 16px;">鑽夋涓�</div>
</lightning-layout-item>
+ <lightning-record-view-form>
+
+ </lightning-record-view-form>
</lightning-layout>
- <!-- <lightning-layout>
- <lightning-accordion allow-multiple-sections-open
- onsectiontoggle={handleSectionToggle}
- active-section-name={activeSections}>
+ <lightning-layout>
+ <lightning-accordion>
<lightning-accordion-section name="澶卞崟鍝佺墝" label="澶卞崟鍝佺墝">
</lightning-accordion-section>
</lightning-accordion>
- </lightning-layout> -->
+ </lightning-layout>
</div>
</div>
</lightning-card>
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
index 0b3ba85..2d46a12 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
* @Author: chen jing wu
* @Date: 2023-04-20 15:04:03
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-24 16:46:31
+ * @LastEditTime: 2023-04-25 17:37:35
*/
/*
* @Description:
@@ -14,44 +14,53 @@
* @LastEditors: chen jing wu
* @LastEditTime: 2023-04-20 17:11:01
*/
-import { api, wire,LightningElement } from 'lwc';
+import { api, wire,track,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import save from '@salesforce/apex/lexPCLLostReportLwcController.save';
-import jquery from '@salesforce/resourceUrl/jquery183minjs';
-import blockUIcss from '@salesforce/resourceUrl/blockUIcss';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
import setbrand from '@salesforce/apex/lexPCLLostReportLwcController.setBrand';
import init from '@salesforce/apex/lexPCLLostReportLwcController.init';
-import PleaseWaitDialog from '@salesforce/resourceUrl/PleaseWaitDialog';
import initForApex from '@salesforce/apex/lexPCLLostReportLwcController.initForApex';
+import getValuesFromTable from '@salesforce/apex/lexPCLLostReportLwcController.getValuesFromTable';
export default class LexPCLLostReportPage extends LightningElement {
- @api oppId;
+ @api oppId = '0061000001R2xjWAAR';
@api lostReportId;
- @api pageStatus;
- @api lostType;
+ @api pageStatus = 'Create';
+ @api lostType = '澶卞崟';
@api submitFlag;
+ searchResult;
LostReport;
brandCount;
- lostReportObj;
+
+
+
+ connectedCallback() {
+
+ }
+
+
//澶卞崟绫诲瀷
RecordTypeOptions = [{ label: '--鏃�--', value: '' },
{ label: '澶卞崟', value: '澶卞崟' },
{ label: '閮ㄥ垎澶卞崟', value: '閮ㄥ垎澶卞崟' }];
- // @wire(CurrentPageReference)
- // getStateParameters(currentPageReference) {
- // console.log(111);
- // console.log(currentPageReference);
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log(111);
+ console.log(currentPageReference);
- // if (currentPageReference) {
- // const urlValue = currentPageReference.state.recordId;
- // if (urlValue) {
- // let str = `${urlValue}`;
- // console.log("str");
- // console.log(str);
- // this.oppId = str;
- // }
- // }
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ console.log("str");
+ console.log(str);
+ this.oppId = str;
+ }
+ }
+ }
+ // connectedCallback(){
+ // this.initAll();
// }
// connectedCallback(){
@@ -78,6 +87,42 @@
// });
// });
// }
+ handleSearchBrand(event){
+ const searchText = event.target.value;
+ searchBrand({
+ name: searchText
+ }).then(result=>{
+ this.searchResult = result;
+ });
+ }
+ initAll(){
+ console.log(this.oppId);
+ console.log(this.lostReportId);
+ console.log(this.pageStatus);
+ console.log(this.lostType);
+ console.log(this.submitFlag);
+ initForApex({
+ oppId1: this.oppId,
+ lostReportId1: this.lostReportId,
+ pageStatus1: this.pageStatus,
+ lostType1: this.lostType,
+ submitFlag1: this.submitFlag
+ }).then(()=>{
+ console.log("2");
+ init().then(result=>{
+ console.log("3");
+ console.log(result);
+ if(result.message == '鎻愪氦鎴愬姛锛�'){
+ this.showToast(result.message,"success");
+ this.LostReport = result.LostReport;
+ }else{
+ console.log("211");
+ this.showToast(result.message,"error");
+ console.log("985");
+ }
+ });
+ });
+ }
getParamValue(paramName) {
// Use the URLSearchParams API to get the value of a query parameter
@@ -85,23 +130,18 @@
return params.get(paramName);
}
saveJs() {
- this.blockMyself();
save().then(result=>{
if(result){
this.showToast(result,"success");
- this.unblock();
this.clearBrandMannualName();
}
})
}
addBrandJs() {
- this.blockMyself();
addBrand().then(()=>{
- this.unblock();
});
}
submitJS() {
- this.blockMyself();
submit().then(result=>{
if(result.get('error')){
this.showToast(result.get('error'),"error");
@@ -114,54 +154,21 @@
pageStatus: result.get('pageStatus'),
submitFlag: result.get('submitFlag')
}
- });
- this.unblock();
+ });
}
});
}
addProductJs(number) {
- this.blockMyself();
addProduct().then(()=>{
- this.unblock();
});
}
RemoveJs(number) {
- this.blockMyself();
- Remove().then(()=>{
- this.unblock();
+ Remove().then(()=>{
});
}
// add tcm 20211118 start
searchJs(topNum, secondNum) {
- this.blockMyself();
search().then(()=>{
- this.unblock();
- });
- }
- blockMyself(){
- Promise.all([
- loadScript(this,PleaseWaitDialog),
- loadStyle(this,blockUIcss),
- loadScript(this, jquery)
- //loadScript(this, jq + "/dist/jquery.min.js")
- ]).then(() =>{
- blockme();
- }).catch(error => {
- console.log("321");
- console.log('Failed to load the JQuery : ' +error);
- });
- }
- unblock(){
- Promise.all([
- loadScript(this,PleaseWaitDialog),
- loadStyle(this,blockUIcss),
- loadScript(this, jquery)
- //loadScript(this, jq + "/dist/jquery.min.js")
- ]).then(() =>{
- unblockUI();
- }).catch(error => {
- console.log("321");
- console.log('Failed to load the JQuery : ' +error);
});
}
get pageStatusIsCreateOrEdit() {
@@ -200,16 +207,12 @@
//console.log('setLostTotalAmount end');
}
setBrandName(brandNumber) {
- this.blockMyself();
setbrand().then(()=>{
this.clearBrandMannualName();
- this.unblock();
});
}
setBrandMannualName(brandNumber) {
- this.blockMyself();
setbrandmannual().then(()=>{
- this.unblock();
});
}
// 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢� thh 2022-01-13 start
diff --git a/force-app/main/default/lwc/multiSelectCombobox/__tests__/multiSelectCombobox.test.js b/force-app/main/default/lwc/multiSelectCombobox/__tests__/multiSelectCombobox.test.js
new file mode 100644
index 0000000..1410cce
--- /dev/null
+++ b/force-app/main/default/lwc/multiSelectCombobox/__tests__/multiSelectCombobox.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import MultiSelectCombobox from 'c/multiSelectCombobox';
+
+describe('c-multi-select-combobox', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-multi-select-combobox', {
+ is: MultiSelectCombobox
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox .css b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox .css
new file mode 100644
index 0000000..4442364
--- /dev/null
+++ b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox .css
@@ -0,0 +1,35 @@
+.verticalAlign {
+ cursor: pointer;
+ padding: 0px 5px !important;
+}
+.slds-dropdown {
+ padding:0px !important;
+}
+.recordListBox {
+ margin-top:0px !important;
+ overflow-y: scroll;
+}
+.slds-listbox li {
+ padding: .45rem 0.7rem !important;
+ display: flex;
+}
+.inputBox input {
+ padding-left: 10px;
+}
+.eachItem:hover {
+ background-color: #F1F1F1;
+ cursor: pointer;
+}
+
+/* For Scrolling */
+::-webkit-scrollbar {
+ width: 7px;
+ height: 7px;
+}
+::-webkit-scrollbar-track {
+ display: none !important;
+}
+::-webkit-scrollbar-thumb {
+ border-radius: 10px;
+ background: rgba(0,0,0,0.4);
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html
new file mode 100644
index 0000000..37465b0
--- /dev/null
+++ b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html
@@ -0,0 +1,58 @@
+<!--
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-25 17:41:26
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-25 17:45:57
+-->
+
+<!-- Code by CafeForce || www.cafeforce.com || support@cafeforce.com || Mandatory Header -->
+<template>
+
+ <!-- Header Label -->
+ <template if:true={label}>
+ <label class="slds-form-element__label">{label}</label>
+ </template>
+ <div class="slds-combobox_container">
+ <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox">
+ <!-- Search Input -->
+ <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none">
+ <lightning-input disabled={disabled} class="inputBox" placeholder="Select an Option" onblur={blurEvent} onclick={showOptions} onkeyup={filterOptions} value={searchString} auto-complete="off" variant="label-hidden" id="combobox-id-1" ></lightning-input>
+ <lightning-icon class="slds-input__icon" icon-name="utility:down" size="x-small" alternative-text="search"></lightning-icon>
+ </div>
+ <!-- Dropdown List -->
+ <template if:true={showDropdown}>
+ <div id="listbox-id-1" class="slds-dropdown slds-dropdown_length-5 slds-dropdown_fluid"><!--style="{! 'max-height:' + (8 + (v.recordCount * 40)) + 'px' }""-->
+ <ul class="slds-listbox slds-listbox_vertical recordListBox" role="presentation">
+ <template if:false={message} >
+ <template for:each={optionData} for:item="option">
+ <template if:true={option.isVisible}>
+ <li key={option.value} data-id={option.value} onmousedown={selectItem} class="slds-listbox__item eachItem">
+ <template if:true={option.selected}>
+ <lightning-icon icon-name="utility:check" size="x-small" alternative-text="icon" ></lightning-icon>
+ </template>
+ <span class="slds-media slds-listbox__option_entity verticalAlign slds-truncate">{option.label}</span>
+ </li>
+ </template>
+ </template>
+ </template>
+ <template if:true={message} >
+ <li class="slds-listbox__item">
+ <span class="slds-media slds-listbox__option_entity verticalAlign slds-truncate">{message}</span>
+ </li>
+ </template>
+ </ul>
+ </div>
+ </template>
+ </div>
+ </div>
+ <!-- Multi Select Pills -->
+ <template for:each={optionData} for:item="option">
+ <template if:true={option.selected}>
+ <lightning-pill key={option.value} class="slds-m-around_xx-small" name={option.value} label={option.label} onremove={removePill}></lightning-pill>
+ </template>
+ </template>
+</template>
+
+
diff --git a/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js
new file mode 100644
index 0000000..5bd3990
--- /dev/null
+++ b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js
@@ -0,0 +1,173 @@
+/* Code by CafeForce || www.cafeforce.com || support@cafeforce.com || Mandatory Header */
+import { LightningElement, track, api } from 'lwc';
+
+export default class MultiSelectCombobox extends LightningElement {
+
+ @api options;
+ @api selectedValue;
+ @api selectedValues = [];
+ @api label;
+ @api minChar = 2;
+ @api disabled = false;
+ @api multiSelect = false;
+ @track value;
+ @track values = [];
+ @track optionData;
+ @track searchString;
+ @track message;
+ @track showDropdown = false;
+
+ connectedCallback() {
+ this.showDropdown = false;
+ var optionData = this.options ? (JSON.parse(JSON.stringify(this.options))) : null;
+ var value = this.selectedValue ? (JSON.parse(JSON.stringify(this.selectedValue))) : null;
+ var values = this.selectedValues ? (JSON.parse(JSON.stringify(this.selectedValues))) : null;
+ if(value || values) {
+ var searchString;
+ var count = 0;
+ for(var i = 0; i < optionData.length; i++) {
+ if(this.multiSelect) {
+ if(values.includes(optionData[i].value)) {
+ optionData[i].selected = true;
+ count++;
+ }
+ } else {
+ if(optionData[i].value == value) {
+ searchString = optionData[i].label;
+ }
+ }
+ }
+ if(this.multiSelect)
+ this.searchString = count + ' Option(s) Selected';
+ else
+ this.searchString = searchString;
+ }
+ this.value = value;
+ this.values = values;
+ this.optionData = optionData;
+ }
+
+ filterOptions(event) {
+ this.searchString = event.target.value;
+ if( this.searchString && this.searchString.length > 0 ) {
+ this.message = '';
+ if(this.searchString.length >= this.minChar) {
+ var flag = true;
+ for(var i = 0; i < this.optionData.length; i++) {
+ if(this.optionData[i].label.toLowerCase().trim().startsWith(this.searchString.toLowerCase().trim())) {
+ this.optionData[i].isVisible = true;
+ flag = false;
+ } else {
+ this.optionData[i].isVisible = false;
+ }
+ }
+ if(flag) {
+ this.message = "No results found for '" + this.searchString + "'";
+ }
+ }
+ this.showDropdown = true;
+ } else {
+ this.showDropdown = false;
+ }
+ }
+
+ selectItem(event) {
+ var selectedVal = event.currentTarget.dataset.id;
+ if(selectedVal) {
+ var count = 0;
+ var options = JSON.parse(JSON.stringify(this.optionData));
+ for(var i = 0; i < options.length; i++) {
+ if(options[i].value === selectedVal) {
+ if(this.multiSelect) {
+ if(this.values.includes(options[i].value)) {
+ this.values.splice(this.values.indexOf(options[i].value), 1);
+ } else {
+ this.values.push(options[i].value);
+ }
+ options[i].selected = options[i].selected ? false : true;
+ } else {
+ this.value = options[i].value;
+ this.searchString = options[i].label;
+ }
+ }
+ if(options[i].selected) {
+ count++;
+ }
+ }
+ this.optionData = options;
+ if(this.multiSelect)
+ this.searchString = count + ' Option(s) Selected';
+ if(this.multiSelect)
+ event.preventDefault();
+ else
+ this.showDropdown = false;
+ }
+ }
+
+ showOptions() {
+ if(this.disabled == false && this.options) {
+ this.message = '';
+ this.searchString = '';
+ var options = JSON.parse(JSON.stringify(this.optionData));
+ for(var i = 0; i < options.length; i++) {
+ options[i].isVisible = true;
+ }
+ if(options.length > 0) {
+ this.showDropdown = true;
+ }
+ this.optionData = options;
+ }
+ }
+
+ removePill(event) {
+ var value = event.currentTarget.name;
+ var count = 0;
+ var options = JSON.parse(JSON.stringify(this.optionData));
+ for(var i = 0; i < options.length; i++) {
+ if(options[i].value === value) {
+ options[i].selected = false;
+ this.values.splice(this.values.indexOf(options[i].value), 1);
+ }
+ if(options[i].selected) {
+ count++;
+ }
+ }
+ this.optionData = options;
+ if(this.multiSelect)
+ this.searchString = count + ' Option(s) Selected';
+ }
+
+ blurEvent() {
+ var previousLabel;
+ var count = 0;
+ for(var i = 0; i < this.optionData.length; i++) {
+ if(this.optionData[i].value === this.value) {
+ previousLabel = this.optionData[i].label;
+ }
+ if(this.optionData[i].selected) {
+ count++;
+ }
+ }
+ if(this.multiSelect)
+ this.searchString = count + ' Option(s) Selected';
+ else
+ this.searchString = previousLabel;
+
+ this.showDropdown = false;
+
+ this.dispatchEvent(new CustomEvent('select', {
+ detail: {
+ 'payloadType' : 'multi-select',
+ 'payload' : {
+ 'value' : this.value,
+ 'values' : this.values
+ }
+ }
+ }));
+ }
+}
+/*
+ Code by CafeForce
+ Website: http://www.cafeforce.com
+ DO NOT REMOVE THIS HEADER/FOOTER FOR FREE CODE USAGE
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js-meta.xml b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js-meta.xml
new file mode 100644
index 0000000..f8c5cb4
--- /dev/null
+++ b/force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
--
Gitblit v1.9.1