{"version":3,"file":"dropDownList.js","sources":["../../../Framework/Controls/dropDownList.ts"],"sourcesContent":["// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\nimport { computed, defineComponent, PropType, ref, watch } from \"vue\";\r\nimport { Select as AntSelect } from \"ant-design-vue\";\r\nimport { ListItemBag } from \"@Obsidian/ViewModels/Utility/listItemBag\";\r\nimport RockFormField from \"./rockFormField\";\r\nimport { deepEqual } from \"@Obsidian/Utility/util\";\r\nimport { standardRockFormFieldProps, updateRefValue, useStandardRockFormFieldProps } from \"@Obsidian/Utility/component\";\r\nimport { defaultControlCompareValue } from \"@Obsidian/Utility/stringUtils\";\r\n\r\n/** The type definition for a select option, since the ones from the library are wrong. */\r\nexport type SelectOption = {\r\n value?: string;\r\n\r\n label: string;\r\n\r\n options?: SelectOption[];\r\n};\r\n\r\nexport default defineComponent({\r\n name: \"DropDownList\",\r\n\r\n components: {\r\n AntSelect,\r\n RockFormField,\r\n VNodes: (_, { attrs }) => {\r\n return attrs.vnodes;\r\n }\r\n },\r\n\r\n props: {\r\n modelValue: {\r\n type: Object as PropType,\r\n required: true\r\n },\r\n\r\n items: {\r\n type: Array as PropType,\r\n default: []\r\n },\r\n\r\n showBlankItem: {\r\n type: Boolean as PropType,\r\n default: true\r\n },\r\n\r\n blankValue: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n multiple: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n /** No longer used. */\r\n formControlClasses: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n inputClasses: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n enhanceForLongLists: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n grouped: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n disabled: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n loading: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n compareValue: {\r\n type: Function as PropType<((value: string, itemValue: string) => boolean)>,\r\n default: defaultControlCompareValue\r\n },\r\n\r\n ...standardRockFormFieldProps\r\n },\r\n\r\n emits: {\r\n open: () => true,\r\n \"update:modelValue\": (_value: string | string[]) => true\r\n },\r\n\r\n setup(props, { emit }) {\r\n // #region Values\r\n\r\n const internalValue = ref(props.modelValue ? props.modelValue : null);\r\n const controlWrapper = ref(null);\r\n const standardFieldProps = useStandardRockFormFieldProps(props);\r\n\r\n // #endregion\r\n\r\n // #region Computed Values\r\n\r\n /** Determines if the blank item should be used. */\r\n const computedShowBlankItem = computed((): boolean => {\r\n // Only show the blank item if requested and we are not in multiple\r\n // selection mode.\r\n return !props.multiple && props.showBlankItem;\r\n });\r\n\r\n /** The options to be used by the Ant Select box. */\r\n const computedOptions = computed((): SelectOption[] => {\r\n // If we are not showing grouped items then simply map our item bags\r\n // into a format that can be used by the picker.\r\n if (!props.grouped) {\r\n return props.items.map((o): SelectOption => {\r\n return {\r\n value: o.value ?? \"\",\r\n label: o.text ?? \"\"\r\n };\r\n });\r\n }\r\n\r\n const groupedOptions: SelectOption[] = [];\r\n\r\n // Loop through all the options and group everything that has a\r\n // category together.\r\n for (const o of props.items) {\r\n // If no category then just include it as a regular item.\r\n if (!o.category) {\r\n groupedOptions.push({\r\n value: o.value ?? \"\",\r\n label: o.text ?? \"\"\r\n });\r\n continue;\r\n }\r\n\r\n const matchedGroups = groupedOptions.filter(g => g.label === o.category && !!g.options);\r\n\r\n // If we found an existing group then just add this item to\r\n // that group. Otherwise create a new group for this item.\r\n if (matchedGroups.length >= 1 && !!matchedGroups[0].options) {\r\n matchedGroups[0].options.push({\r\n value: o.value ?? \"\",\r\n label: o.text ?? \"\"\r\n });\r\n }\r\n else {\r\n groupedOptions.push({\r\n label: o.category,\r\n options: [{\r\n value: o.value ?? \"\",\r\n label: o.text ?? \"\"\r\n }]\r\n });\r\n }\r\n }\r\n\r\n return groupedOptions;\r\n });\r\n\r\n /** Determines if the control is currently in a loading state. */\r\n const computedLoading = computed((): boolean => {\r\n return props.loading;\r\n });\r\n\r\n /** The mode for the Ant Select control to operate in. */\r\n const mode = computed((): \"multiple\" | undefined => {\r\n return props.multiple ? \"multiple\" : undefined;\r\n });\r\n\r\n /** Determines if we have any selected values. */\r\n const hasValue = computed((): boolean => {\r\n if (Array.isArray(internalValue.value)) {\r\n return internalValue.value.length > 0;\r\n }\r\n else {\r\n return internalValue.value !== \"\";\r\n }\r\n });\r\n\r\n /** Determines if the clear icon should be visible. */\r\n const isClearable = computed((): boolean => {\r\n return computedShowBlankItem.value && !computedLoading.value && hasValue.value && internalValue.value !== props.blankValue;\r\n });\r\n\r\n /** Determines if the control should be in a disabled state. */\r\n const isDisabled = computed((): boolean => {\r\n return props.disabled;\r\n });\r\n\r\n // #endregion\r\n\r\n // #region Functions\r\n\r\n /**\r\n * Synchronizes our internal value with the modelValue and current\r\n * component property values.\r\n */\r\n const syncInternalValue = (): void => {\r\n let value: string | string[] | null = props.modelValue;\r\n\r\n if (props.multiple) {\r\n // We are in multiple mode, if our value is a single value then\r\n // convert it to an array of the one value.\r\n if (!Array.isArray(value)) {\r\n value = value === \"\" ? [] : [value];\r\n }\r\n\r\n // Ensure they are all valid values and make sure they are the\r\n // correct matching value from the item rather than what was\r\n // originally provided.\r\n value = props.items\r\n .filter(o => (value as string[]).some(v => props.compareValue(v, o.value ?? \"\")))\r\n .map(o => o.value ?? \"\");\r\n }\r\n else {\r\n // We are in single mode, if our value is an array of values then\r\n // convert it to a single value by taking the first value.\r\n if (Array.isArray(value)) {\r\n value = value.length === 0 ? null : value[0];\r\n }\r\n\r\n // If no value is selected, then take either the blank value\r\n // or the first value in the list.\r\n if (value === null) {\r\n value = computedShowBlankItem.value\r\n ? props.blankValue\r\n : (props.items[0]?.value || props.blankValue);\r\n }\r\n\r\n // Ensure it is a valid value, if not then set it to either the\r\n // blank value or the first value in the list.\r\n const selectedOption = props.items.find(o => props.compareValue(value as string, o.value ?? \"\")) || null;\r\n\r\n if (!selectedOption) {\r\n value = computedShowBlankItem.value\r\n ? props.blankValue\r\n : (props.items[0]?.value || props.blankValue);\r\n }\r\n else {\r\n value = selectedOption.value ?? \"\";\r\n }\r\n }\r\n\r\n updateRefValue(internalValue, value);\r\n };\r\n\r\n /**\r\n * Determines if a single option should be included during a search\r\n * operation.\r\n *\r\n * @param input The search string typed by the individual.\r\n * @param option The option to be filtered.\r\n *\r\n * @returns true if the option should be included in the list, otherwise false.\r\n */\r\n const filterItem = (input: string, option: SelectOption): boolean => {\r\n return (option.label || \"\").toLocaleLowerCase().indexOf(input.toLocaleLowerCase()) >= 0;\r\n };\r\n\r\n /**\r\n * Gets the element that will contain the popup. By default this is the\r\n * document body, but that breaks if the user is viewing the page\r\n * fullscreen via one of the panel fullscreen buttons.\r\n *\r\n * @returns The HTML element to place the popup into.\r\n */\r\n const getPopupContainer = (): HTMLElement => {\r\n return controlWrapper.value ?? document.body;\r\n };\r\n\r\n // #endregion\r\n\r\n // #region Event Handlers\r\n\r\n const onDropdownVisibleChange = (open: boolean): void => {\r\n if (open) {\r\n emit(\"open\");\r\n }\r\n };\r\n\r\n // #endregion\r\n\r\n watch([() => props.modelValue, computedShowBlankItem, () => props.multiple, () => props.items], () => {\r\n syncInternalValue();\r\n });\r\n\r\n // Watch for changes to the selection made in the UI and then make\r\n // make sure its in the right format and valid.\r\n watch(internalValue, () => {\r\n let newValue = internalValue.value;\r\n\r\n if (props.multiple) {\r\n // We are in multiple select mode, but if we have a non-array\r\n // value then convert it to an array.\r\n if (!Array.isArray(newValue)) {\r\n newValue = newValue === null ? [] : [newValue];\r\n }\r\n }\r\n else {\r\n // We are in single select mode, but if we have an array\r\n // value then convert it to a single item.\r\n if (Array.isArray(newValue)) {\r\n newValue = newValue.length === 0 ? null : newValue[0];\r\n }\r\n\r\n // Ensure that single item is valid.\r\n if (newValue === null) {\r\n newValue = computedShowBlankItem.value\r\n ? props.blankValue\r\n : (props.items[0]?.value || props.blankValue);\r\n }\r\n }\r\n\r\n // If the value hasn't changed, then emit the new value. Normally\r\n // we wouldn't have to do this check, but when emitting complex\r\n // things like an array it can sometimes cause unwanted loops if\r\n // we don't.\r\n if (!deepEqual(props.modelValue, newValue, true)) {\r\n emit(\"update:modelValue\", newValue);\r\n }\r\n });\r\n\r\n syncInternalValue();\r\n\r\n return {\r\n computedLoading,\r\n computedOptions,\r\n controlWrapper,\r\n filterItem,\r\n internalValue,\r\n isClearable,\r\n isDisabled,\r\n getPopupContainer,\r\n mode,\r\n onDropdownVisibleChange,\r\n standardFieldProps\r\n };\r\n },\r\n\r\n template: `\r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n No Data
\r\n \r\n\r\n \r\n Data is loading...
\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n\r\n`\r\n});\r\n"],"names":["defineComponent","name","components","AntSelect","RockFormField","VNodes","_","_ref","attrs","vnodes","props","_objectSpread","modelValue","type","Object","required","items","Array","default","showBlankItem","Boolean","blankValue","String","multiple","formControlClasses","inputClasses","enhanceForLongLists","grouped","disabled","loading","compareValue","Function","defaultControlCompareValue","standardRockFormFieldProps","emits","open","_value","setup","_ref2","emit","internalValue","ref","controlWrapper","standardFieldProps","useStandardRockFormFieldProps","computedShowBlankItem","computed","computedOptions","map","o","_o$value","_o$text","value","label","text","groupedOptions","_iterator","_createForOfIteratorHelper","_step","_loop","category","_o$value2","_o$text2","push","matchedGroups","filter","g","options","length","_o$value3","_o$text3","_o$value4","_o$text4","s","n","done","_ret","err","e","f","computedLoading","mode","undefined","hasValue","isArray","isClearable","isDisabled","syncInternalValue","some","v","_o$value5","_o$value6","_props$items$","selectedOption","find","_o$value7","_props$items$2","_selectedOption$value","updateRefValue","filterItem","input","option","toLocaleLowerCase","indexOf","getPopupContainer","_controlWrapper$value","document","body","onDropdownVisibleChange","watch","newValue","_props$items$3","deepEqual","template"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,4CAAeA,eAAe,CAAC;MAC3BC,EAAAA,IAAI,EAAE,cAAc;MAEpBC,EAAAA,UAAU,EAAE;qBACRC,MAAS;UACTC,aAAa;MACbC,IAAAA,MAAM,EAAEA,CAACC,CAAC,EAAAC,IAAA,KAAgB;MAAA,MAAA,IAAZC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;YACf,OAAOA,KAAK,CAACC,MAAM,CAAA;MACvB,KAAA;SACH;MAEDC,EAAAA,KAAK,EAAAC,cAAA,CAAA;MACDC,IAAAA,UAAU,EAAE;MACRC,MAAAA,IAAI,EAAEC,MAAqC;MAC3CC,MAAAA,QAAQ,EAAE,IAAA;WACb;MAEDC,IAAAA,KAAK,EAAE;MACHH,MAAAA,IAAI,EAAEI,KAAgC;MACtCC,MAAAA,OAAO,EAAE,EAAA;WACZ;MAEDC,IAAAA,aAAa,EAAE;MACXN,MAAAA,IAAI,EAAEO,OAA4B;MAClCF,MAAAA,OAAO,EAAE,IAAA;WACZ;MAEDG,IAAAA,UAAU,EAAE;MACRR,MAAAA,IAAI,EAAES,MAA0B;MAChCJ,MAAAA,OAAO,EAAE,EAAA;WACZ;MAEDK,IAAAA,QAAQ,EAAE;MACNV,MAAAA,IAAI,EAAEO,OAA4B;MAClCF,MAAAA,OAAO,EAAE,KAAA;WACZ;MAGDM,IAAAA,kB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