@leaflink/stash 53.1.1 → 53.3.4
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/Copy.js +92 -53
- package/dist/Copy.js.map +1 -1
- package/dist/Copy.vue.d.ts +14 -6
- package/dist/Dialog.js +6 -6
- package/dist/Dialog.js.map +1 -1
- package/dist/FileUpload.js +43 -43
- package/dist/FileUpload.js.map +1 -1
- package/dist/ListView.js +78 -78
- package/dist/ListView.js.map +1 -1
- package/dist/MoreActions.js +1 -1
- package/dist/Select.js +1 -1
- package/dist/Select.js.map +1 -1
- package/dist/Thumbnail.js +27 -27
- package/dist/Thumbnail.js.map +1 -1
- package/dist/ThumbnailEmpty.js +5 -5
- package/dist/ThumbnailEmpty.js.map +1 -1
- package/dist/ThumbnailGroup.js +16 -16
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js → Tooltip.vue_vue_type_script_setup_true_lang-CF6sw2VC.js} +2 -2
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js.map → Tooltip.vue_vue_type_script_setup_true_lang-CF6sw2VC.js.map} +1 -1
- package/dist/components.css +1 -1
- package/dist/index-B1Gkwuxd.js +277 -0
- package/dist/index-B1Gkwuxd.js.map +1 -0
- package/dist/useSortable.js +1 -1
- package/package.json +2 -2
- package/dist/index-DBV9Uz0C.js +0 -294
- package/dist/index-DBV9Uz0C.js.map +0 -1
package/dist/FileUpload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/FileUpload.constants.ts","../src/components/FileUpload/FileUpload.vue"],"sourcesContent":["export const FILE_TYPES = {\n CSV: {\n EXTENSION: ['csv'],\n MIME_TYPES: ['text/csv', 'application/octet-stream', 'application/vnd.ms-excel'],\n ILLUSTRATION: 'csv',\n },\n PDF: {\n EXTENSION: ['pdf'],\n MIME_TYPES: ['application/pdf'],\n ILLUSTRATION: 'pdf',\n },\n PNG: {\n EXTENSION: ['png'],\n MIME_TYPES: ['image/png'],\n ILLUSTRATION: 'image',\n },\n JPEG: {\n EXTENSION: ['jpg', 'jpeg'],\n MIME_TYPES: ['image/jpeg'],\n ILLUSTRATION: 'image',\n },\n DOC: {\n EXTENSION: ['doc', 'docx'],\n MIME_TYPES: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ILLUSTRATION: 'document',\n },\n XLS: {\n EXTENSION: ['xls', 'xlsx'],\n MIME_TYPES: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ILLUSTRATION: 'csv',\n },\n};\n\nexport enum FileUploadSizes {\n Dense = 'dense',\n Standard = 'standard',\n}\n\nexport type FileUploadSize = `${FileUploadSizes}`;\n","<script lang=\"ts\">\n export * from './FileUpload.constants';\n</script>\n\n<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, inject, ref, useAttrs, useCssModule } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashProvideState } from '../../../types/misc';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import { FILE_TYPES, FileUploadSize, FileUploadSizes } from './FileUpload.constants';\n\n export type FileType = 'CSV' | 'PDF' | 'PNG' | 'JPEG' | 'DOC' | 'XLS';\n\n export interface FileUploadProps {\n /**\n * Files to display in the component\n */\n files?: File[];\n\n /**\n * Accepted file types\n */\n fileTypes?: FileType[];\n\n /**\n * Should display only the button\n */\n buttonOnly?: boolean;\n\n /**\n * Allows upload of multiple files\n */\n multiple?: boolean;\n\n /**\n * Is the input disabled\n */\n disabled?: boolean;\n\n /**\n * Component size\n */\n size?: FileUploadSize;\n }\n\n const props = withDefaults(defineProps<FileUploadProps>(), {\n files: () => [],\n fileTypes: () => ['CSV', 'PDF', 'PNG', 'JPEG', 'DOC', 'XLS'],\n buttonOnly: false,\n disabled: false,\n multiple: false,\n size: 'standard',\n });\n\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'file-select', { files }: { files: FileUploadProps['files'] }): void;\n (e: 'file-delete', file: File): void;\n (e: 'file-error', message: string): void;\n }>();\n\n const isDraggingOver = ref(false);\n const fileUploadRef = ref<HTMLInputElement>();\n\n const stashOptions = inject<StashProvideState>('stashOptions');\n const attributes = useAttrs();\n\n const inputAttrs = computed(() => {\n const attrs = { ...attributes };\n\n delete attrs['data-test'];\n delete attrs.class;\n delete attrs.type;\n delete attrs.accept;\n\n return attrs;\n });\n\n function concatArraysToFirst(a: string[], b: string[]) {\n return a.concat(b);\n }\n\n const acceptedMimeTypes = computed(() => {\n return props.fileTypes.map((fileType) => FILE_TYPES[fileType].MIME_TYPES).reduce(concatArraysToFirst);\n });\n\n const acceptedFileExtensions = computed(() => {\n return props.fileTypes.map((fileType) => FILE_TYPES[fileType].EXTENSION).reduce(concatArraysToFirst);\n });\n\n const illustrationPath = computed(() => {\n return `${stashOptions?.staticPath}/illustrations/FileUpload/${FILE_TYPES[props.fileTypes[0]].ILLUSTRATION}.svg`;\n });\n\n function openFileDialog() {\n if (fileUploadRef.value) {\n fileUploadRef.value.value = '';\n fileUploadRef.value.click();\n }\n }\n\n function handleDragEnter() {\n isDraggingOver.value = true;\n }\n\n function handleDragLeave() {\n isDraggingOver.value = false;\n }\n\n function handleFileError(error: Error) {\n const message = t('ll.fileUpload.errors.incorrectFileType', {\n fileTypes: acceptedFileExtensions.value.join(', '),\n });\n\n emit('file-error', message);\n\n logger.log(error);\n }\n\n async function areFileTypesAccepted(files: File[]) {\n if (!acceptedMimeTypes.value.length) return true;\n\n const mimeTypes = await Promise.all(files.map((file) => readMimeType(file)));\n\n const allCorrectMimeTypes =\n !!mimeTypes.length && mimeTypes.every((mimeType) => acceptedMimeTypes.value.includes(mimeType));\n\n if (!allCorrectMimeTypes) {\n throw new Error('One or more files contains an unacceptable mime type.');\n }\n\n const allCorrectFileExtensions = files.every((file) => {\n const extension = file.name.split('.').pop();\n\n return extension && acceptedFileExtensions.value.includes(extension);\n });\n\n if (!allCorrectFileExtensions) {\n throw new Error('One or more files contains an unacceptable extension.');\n }\n\n return true;\n }\n\n async function processFiles(files: File[]) {\n try {\n await areFileTypesAccepted(files);\n\n emit('file-select', { files });\n } catch (error) {\n handleFileError(error as Error);\n }\n }\n\n /**\n * Sets file(s) to selected file(s) from dialogue\n * @param {Object} event - file select event that contains file(s)\n * @returns {Array} An array of files\n */\n function handleFileInput(event: Event) {\n const files = [...((event.target as HTMLInputElement)?.files || [])];\n\n processFiles(files);\n }\n\n /**\n * Sets file to dropped file if it is proper file type\n * @param {Object} event - file select event that contains file\n */\n function handleDropFile(event: DragEvent) {\n if (props.disabled) {\n return;\n }\n\n const files = [...(event.dataTransfer?.files || [])];\n\n isDraggingOver.value = false;\n\n return processFiles(files);\n }\n\n function handleFileDelete(file: File) {\n emit('file-delete', file);\n }\n\n function readMimeType(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n if (file.type) {\n return resolve(file.type);\n } else if (window.FileReader) {\n const fileReader = new FileReader();\n\n fileReader.onload = () => {\n const mimeType =\n fileReader.result && (fileReader.result as string).match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)\n ? ((fileReader.result as string).match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/) as string[])[0]\n : '';\n\n resolve(mimeType);\n };\n\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('Failed to read file.'));\n }\n });\n }\n</script>\n\n<template>\n <div class=\"stash-file-upload\" :class=\"attributes.class\" data-test=\"stash-file-upload\">\n <div v-if=\"buttonOnly\">\n <Button secondary type=\"button\" :disabled=\"props.disabled\" @click.stop.prevent=\"openFileDialog\">\n <slot name=\"submitText\">\n {{ t('ll.fileUpload.uploadFile') }}\n </slot>\n </Button>\n </div>\n <div\n v-else\n class=\"rounded p-6\"\n :class=\"[\n classes['file-dropbox'],\n {\n [classes['is-dragging']]: isDraggingOver,\n [classes['is-disabled']]: props.disabled,\n },\n ]\"\n @dragover.prevent=\"handleDragEnter\"\n @drop.prevent=\"handleDropFile\"\n @dragleave.prevent=\"handleDragLeave\"\n >\n <div\n class=\"flex flex-col items-center justify-center text-center\"\n :class=\"[{ 'items-center md:flex-row': size === FileUploadSizes.Dense }]\"\n >\n <template v-if=\"!files.length\">\n <InlineSvg v-if=\"size !== FileUploadSizes.Dense\" :src=\"illustrationPath\" name=\"file\" width=\"84\" height=\"96\" />\n <span class=\"text-ice-900\">\n {{ t('ll.fileUpload.dragDropFileHere') }}\n </span>\n <span\n :class=\"size === FileUploadSizes.Dense ? 'md:ml-1.5 md:mr-3 md:my-0 my-1.5 text-ice-900' : 'mt-1.5 my-1.5'\"\n >\n {{ t('ll.fileUpload.or') }}\n </span>\n <Button\n class=\"mt-1.5\"\n secondary\n type=\"button\"\n :class=\"classes['file-select-button']\"\n :disabled=\"disabled\"\n @click.stop.prevent=\"openFileDialog\"\n >\n <!-- @slot for custom submit text -->\n <slot name=\"submitText\">{{ t('ll.fileUpload.uploadFile') }}</slot>\n </Button>\n </template>\n <template v-else>\n <div v-for=\"file in files\" :key=\"file.name\">\n <Icon name=\"file\" />\n <span>{{ file.name }}</span>\n <Button :class=\"[classes['remove-button'], classes['button']]\" @click.stop.prevent=\"handleFileDelete(file)\">\n {{ t('ll.fileUpload.remove') }}\n </Button>\n </div>\n </template>\n </div>\n <div v-if=\"$slots.hint && !files.length\" class=\"mt-6 text-center text-xs text-ice-700\">\n <!-- @slot for displaying helpful text and/or links -->\n <slot name=\"hint\"></slot>\n </div>\n </div>\n <input\n v-show=\"false\"\n v-bind=\"inputAttrs\"\n ref=\"fileUploadRef\"\n data-test=\"stash-file-upload|input\"\n type=\"file\"\n :disabled=\"disabled\"\n :accept=\"acceptedMimeTypes.join(',')\"\n :multiple=\"props.multiple\"\n @change=\"handleFileInput\"\n />\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .file-dropbox {\n background: var(--color-ice-200);\n background-image: url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='4' ry='4' stroke='%23C5C9D4FF' stroke-width='1' stroke-dasharray='5 %2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\");\n background-repeat: no-repeat;\n border: var(--border-width) solid var(--color-ice-500);\n border-color: transparent;\n }\n\n .is-dragging {\n background-image: none;\n border-color: var(--color-ice-500);\n\n & > * {\n pointer-events: none;\n }\n }\n\n .is-disabled {\n cursor: no-drop;\n }\n\n /* Constrain the upload icon for drag/drop to the required size */\n .upload-icon {\n height: 98px;\n width: 84px;\n }\n\n .remove-button.button {\n background: transparent;\n border: none;\n color: var(--color-red-500);\n\n &:hover {\n background: transparent;\n border: none;\n }\n }\n }\n</style>\n"],"names":["FILE_TYPES","FileUploadSizes","props","__props","classes","useCssModule","emit","__emit","isDraggingOver","ref","fileUploadRef","stashOptions","inject","attributes","useAttrs","inputAttrs","computed","attrs","concatArraysToFirst","a","b","acceptedMimeTypes","fileType","acceptedFileExtensions","illustrationPath","openFileDialog","handleDragEnter","handleDragLeave","handleFileError","error","message","t","logger","areFileTypesAccepted","files","mimeTypes","file","readMimeType","mimeType","extension","processFiles","handleFileInput","event","_a","handleDropFile","handleFileDelete","resolve","reject","fileReader"],"mappings":";;;;;;;AAAO,MAAMA,IAAa;AAAA,EACxB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,YAAY,4BAA4B,0BAA0B;AAAA,IAC/E,cAAc;AAAA,EAAA;AAAA,EAEhB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,iBAAiB;AAAA,IAC9B,cAAc;AAAA,EAAA;AAAA,EAEhB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,WAAW;AAAA,IACxB,cAAc;AAAA,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M,WAAN,gBAAAC,EAAmC,UAAS,CAAA,CAAG;AAEnE,MAAAH,EAAaN,CAAK;AAAA,IACpB;AAMA,aAASU,EAAeF,GAAkB;;AACxC,UAAIxC,EAAM;AACR;AAGF,YAAMgC,IAAQ,CAAC,KAAIS,IAAAD,EAAM,iBAAN,gBAAAC,EAAoB,UAAS,CAAA,CAAG;AAEnD,aAAAnC,EAAe,QAAQ,IAEhBgC,EAAaN,CAAK;AAAA,IAC3B;AAEA,aAASW,EAAiBT,GAAY;AACpC,MAAA9B,EAAK,eAAe8B,CAAI;AAAA,IAC1B;AAEA,aAASC,EAAaD,GAA6B;AACjD,aAAO,IAAI,QAAQ,CAACU,GAASC,MAAW;AACtC,YAAIX,EAAK;AACP,iBAAOU,EAAQV,EAAK,IAAI;AAC1B,YAAW,OAAO,YAAY;AAC5B,gBAAMY,IAAa,IAAI,WAAA;AAEvB,UAAAA,EAAW,SAAS,MAAM;AACxB,kBAAMV,IACJU,EAAW,UAAWA,EAAW,OAAkB,MAAM,4BAA4B,IAC/EA,EAAW,OAAkB,MAAM,4BAA4B,EAAe,CAAC,IACjF;AAEN,YAAAF,EAAQR,CAAQ;AAAA,UAClB,GAEAU,EAAW,cAAcZ,CAAI;AAAA,QAC/B;AACE,UAAAW,EAAO,IAAI,MAAM,sBAAsB,CAAC;AAAA,MAE5C,CAAC;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"FileUpload.js","sources":["../src/components/FileUpload/FileUpload.constants.ts","../src/components/FileUpload/FileUpload.vue"],"sourcesContent":["export const FILE_TYPES = {\n CSV: {\n EXTENSION: ['csv'],\n MIME_TYPES: ['text/csv', 'application/octet-stream', 'application/vnd.ms-excel'],\n ILLUSTRATION: 'csv',\n },\n PDF: {\n EXTENSION: ['pdf'],\n MIME_TYPES: ['application/pdf'],\n ILLUSTRATION: 'pdf',\n },\n PNG: {\n EXTENSION: ['png'],\n MIME_TYPES: ['image/png'],\n ILLUSTRATION: 'image',\n },\n JPEG: {\n EXTENSION: ['jpg', 'jpeg'],\n MIME_TYPES: ['image/jpeg'],\n ILLUSTRATION: 'image',\n },\n DOC: {\n EXTENSION: ['doc', 'docx'],\n MIME_TYPES: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ILLUSTRATION: 'document',\n },\n XLS: {\n EXTENSION: ['xls', 'xlsx'],\n MIME_TYPES: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ILLUSTRATION: 'csv',\n },\n};\n\nexport enum FileUploadSizes {\n Dense = 'dense',\n Standard = 'standard',\n}\n\nexport type FileUploadSize = `${FileUploadSizes}`;\n","<script lang=\"ts\">\n export * from './FileUpload.constants';\n</script>\n\n<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, inject, ref, useAttrs, useCssModule } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashProvideState } from '../../../types/misc';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import { FILE_TYPES, FileUploadSize, FileUploadSizes } from './FileUpload.constants';\n\n export type FileType = 'CSV' | 'PDF' | 'PNG' | 'JPEG' | 'DOC' | 'XLS';\n\n export interface FileUploadProps {\n /**\n * Files to display in the component\n */\n files?: File[];\n\n /**\n * Accepted file types\n */\n fileTypes?: FileType[];\n\n /**\n * Should display only the button\n */\n buttonOnly?: boolean;\n\n /**\n * Allows upload of multiple files\n */\n multiple?: boolean;\n\n /**\n * Is the input disabled\n */\n disabled?: boolean;\n\n /**\n * Component size\n */\n size?: FileUploadSize;\n }\n\n const props = withDefaults(defineProps<FileUploadProps>(), {\n files: () => [],\n fileTypes: () => ['CSV', 'PDF', 'PNG', 'JPEG', 'DOC', 'XLS'],\n buttonOnly: false,\n disabled: false,\n multiple: false,\n size: 'standard',\n });\n\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'file-select', { files }: { files: FileUploadProps['files'] }): void;\n (e: 'file-delete', file: File): void;\n (e: 'file-error', message: string): void;\n }>();\n\n const isDraggingOver = ref(false);\n const fileUploadRef = ref<HTMLInputElement>();\n\n const stashOptions = inject<StashProvideState>('stashOptions');\n const attributes = useAttrs();\n\n const inputAttrs = computed(() => {\n const attrs = { ...attributes };\n\n delete attrs['data-test'];\n delete attrs.class;\n delete attrs.type;\n delete attrs.accept;\n\n return attrs;\n });\n\n function concatArraysToFirst(a: string[], b: string[]) {\n return a.concat(b);\n }\n\n const acceptedMimeTypes = computed(() => {\n return props.fileTypes.map((fileType) => FILE_TYPES[fileType].MIME_TYPES).reduce(concatArraysToFirst);\n });\n\n const acceptedFileExtensions = computed(() => {\n return props.fileTypes.map((fileType) => FILE_TYPES[fileType].EXTENSION).reduce(concatArraysToFirst);\n });\n\n const illustrationPath = computed(() => {\n return `${stashOptions?.staticPath}/illustrations/FileUpload/${FILE_TYPES[props.fileTypes[0]].ILLUSTRATION}.svg`;\n });\n\n function openFileDialog() {\n if (fileUploadRef.value) {\n fileUploadRef.value.value = '';\n fileUploadRef.value.click();\n }\n }\n\n function handleDragEnter() {\n isDraggingOver.value = true;\n }\n\n function handleDragLeave() {\n isDraggingOver.value = false;\n }\n\n function handleFileError(error: Error) {\n const message = t('ll.fileUpload.errors.incorrectFileType', {\n fileTypes: acceptedFileExtensions.value.join(', '),\n });\n\n emit('file-error', message);\n\n logger.log(error);\n }\n\n async function areFileTypesAccepted(files: File[]) {\n if (!acceptedMimeTypes.value.length) return true;\n\n const mimeTypes = await Promise.all(files.map((file) => readMimeType(file)));\n\n const allCorrectMimeTypes =\n !!mimeTypes.length && mimeTypes.every((mimeType) => acceptedMimeTypes.value.includes(mimeType));\n\n if (!allCorrectMimeTypes) {\n throw new Error('One or more files contains an unacceptable mime type.');\n }\n\n const allCorrectFileExtensions = files.every((file) => {\n const extension = file.name.split('.').pop();\n\n return extension && acceptedFileExtensions.value.includes(extension);\n });\n\n if (!allCorrectFileExtensions) {\n throw new Error('One or more files contains an unacceptable extension.');\n }\n\n return true;\n }\n\n async function processFiles(files: File[]) {\n try {\n await areFileTypesAccepted(files);\n\n emit('file-select', { files });\n } catch (error) {\n handleFileError(error as Error);\n }\n }\n\n /**\n * Sets file(s) to selected file(s) from dialogue\n * @param {Object} event - file select event that contains file(s)\n * @returns {Array} An array of files\n */\n function handleFileInput(event: Event) {\n const files = [...((event.target as HTMLInputElement)?.files || [])];\n\n processFiles(files);\n }\n\n /**\n * Sets file to dropped file if it is proper file type\n * @param {Object} event - file select event that contains file\n */\n function handleDropFile(event: DragEvent) {\n if (props.disabled) {\n return;\n }\n\n const files = [...(event.dataTransfer?.files || [])];\n\n isDraggingOver.value = false;\n\n return processFiles(files);\n }\n\n function handleFileDelete(file: File) {\n emit('file-delete', file);\n }\n\n function readMimeType(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n if (file.type) {\n return resolve(file.type);\n } else if (window.FileReader) {\n const fileReader = new FileReader();\n\n fileReader.onload = () => {\n const mimeType =\n fileReader.result && (fileReader.result as string).match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)\n ? ((fileReader.result as string).match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/) as string[])[0]\n : '';\n\n resolve(mimeType);\n };\n\n fileReader.readAsDataURL(file);\n } else {\n reject(new Error('Failed to read file.'));\n }\n });\n }\n</script>\n\n<template>\n <div class=\"stash-file-upload\" :class=\"attributes.class\" data-test=\"stash-file-upload\">\n <div v-if=\"buttonOnly\">\n <Button secondary type=\"button\" :disabled=\"props.disabled\" @click.stop.prevent=\"openFileDialog\">\n <slot name=\"submitText\">\n {{ t('ll.fileUpload.uploadFile') }}\n </slot>\n </Button>\n </div>\n <div\n v-else\n class=\"rounded p-6\"\n :class=\"[\n classes['file-dropbox'],\n {\n [classes['is-dragging']]: isDraggingOver,\n [classes['is-disabled']]: props.disabled,\n },\n ]\"\n @dragover.prevent=\"handleDragEnter\"\n @drop.prevent=\"handleDropFile\"\n @dragleave.prevent=\"handleDragLeave\"\n >\n <div\n class=\"flex flex-col items-center justify-center text-center\"\n :class=\"[{ 'items-center md:flex-row': size === FileUploadSizes.Dense }]\"\n >\n <template v-if=\"!files.length\">\n <InlineSvg v-if=\"size !== FileUploadSizes.Dense\" :src=\"illustrationPath\" name=\"file\" width=\"84\" height=\"96\" />\n <span class=\"text-ice-900\">\n {{ t('ll.fileUpload.dragDropFileHere') }}\n </span>\n <span\n :class=\"size === FileUploadSizes.Dense ? 'md:ml-1.5 md:mr-3 md:my-0 my-1.5 text-ice-900' : 'mt-1.5 my-1.5'\"\n >\n {{ t('ll.fileUpload.or') }}\n </span>\n <Button\n class=\"mt-1.5\"\n secondary\n type=\"button\"\n :class=\"classes['file-select-button']\"\n :disabled=\"disabled\"\n @click.stop.prevent=\"openFileDialog\"\n >\n <!-- @slot for custom submit text -->\n <slot name=\"submitText\">{{ t('ll.fileUpload.uploadFile') }}</slot>\n </Button>\n </template>\n <template v-else>\n <div v-for=\"file in files\" :key=\"file.name\">\n <Icon name=\"file\" />\n <span>{{ file.name }}</span>\n <Button :class=\"[classes['remove-button'], classes['button']]\" @click.stop.prevent=\"handleFileDelete(file)\">\n {{ t('ll.fileUpload.remove') }}\n </Button>\n </div>\n </template>\n </div>\n <div v-if=\"$slots.hint && !files.length\" class=\"mt-6 text-center text-xs text-ice-700\">\n <!-- @slot for displaying helpful text and/or links -->\n <slot name=\"hint\"></slot>\n </div>\n </div>\n <input\n v-show=\"false\"\n v-bind=\"inputAttrs\"\n ref=\"fileUploadRef\"\n data-test=\"stash-file-upload|input\"\n type=\"file\"\n :disabled=\"disabled\"\n :accept=\"acceptedMimeTypes.join(',')\"\n :multiple=\"props.multiple\"\n @change=\"handleFileInput\"\n />\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .file-dropbox {\n background: var(--color-ice-200);\n background-image: url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='4' ry='4' stroke='%23C5C9D4FF' stroke-width='1' stroke-dasharray='5 %2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e\");\n background-repeat: no-repeat;\n border: 1px solid var(--color-ice-500);\n border-color: transparent;\n }\n\n .is-dragging {\n background-image: none;\n border-color: var(--color-ice-500);\n\n & > * {\n pointer-events: none;\n }\n }\n\n .is-disabled {\n cursor: no-drop;\n }\n\n /* Constrain the upload icon for drag/drop to the required size */\n .upload-icon {\n height: 98px;\n width: 84px;\n }\n\n .remove-button.button {\n background: transparent;\n border: none;\n color: var(--color-red-500);\n\n &:hover {\n background: transparent;\n border: none;\n }\n }\n }\n</style>\n"],"names":["FILE_TYPES","FileUploadSizes","props","__props","classes","useCssModule","emit","__emit","isDraggingOver","ref","fileUploadRef","stashOptions","inject","attributes","useAttrs","inputAttrs","computed","attrs","concatArraysToFirst","a","b","acceptedMimeTypes","fileType","acceptedFileExtensions","illustrationPath","openFileDialog","handleDragEnter","handleDragLeave","handleFileError","error","message","t","logger","areFileTypesAccepted","files","mimeTypes","file","readMimeType","mimeType","extension","processFiles","handleFileInput","event","_a","handleDropFile","handleFileDelete","resolve","reject","fileReader"],"mappings":";;;;;;;AAAO,MAAMA,IAAa;AAAA,EACxB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,YAAY,4BAA4B,0BAA0B;AAAA,IAC/E,cAAc;AAAA,EAAA;AAAA,EAEhB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,iBAAiB;AAAA,IAC9B,cAAc;AAAA,EAAA;AAAA,EAEhB,KAAK;AAAA,IACH,WAAW,CAAC,KAAK;AAAA,IACjB,YAAY,CAAC,WAAW;AAAA,IACxB,cAAc;AAAA,EAAA;AAAA,EAEhB,MAAM;AAAA,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AAA,CAAG;AAEnE,MAAAH,EAAaN,CAAK;AAAA,IACpB;AAMA,aAASU,EAAeF,GAAkB;;AACxC,UAAIxC,EAAM;AACR;AAGF,YAAMgC,IAAQ,CAAC,KAAIS,IAAAD,EAAM,iBAAN,gBAAAC,EAAoB,UAAS,CAAA,CAAG;AAEnD,aAAAnC,EAAe,QAAQ,IAEhBgC,EAAaN,CAAK;AAAA,IAC3B;AAEA,aAASW,EAAiBT,GAAY;AACpC,MAAA9B,EAAK,eAAe8B,CAAI;AAAA,IAC1B;AAEA,aAASC,EAAaD,GAA6B;AACjD,aAAO,IAAI,QAAQ,CAACU,GAASC,MAAW;AACtC,YAAIX,EAAK;AACP,iBAAOU,EAAQV,EAAK,IAAI;AAC1B,YAAW,OAAO,YAAY;AAC5B,gBAAMY,IAAa,IAAI,WAAA;AAEvB,UAAAA,EAAW,SAAS,MAAM;AACxB,kBAAMV,IACJU,EAAW,UAAWA,EAAW,OAAkB,MAAM,4BAA4B,IAC/EA,EAAW,OAAkB,MAAM,4BAA4B,EAAe,CAAC,IACjF;AAEN,YAAAF,EAAQR,CAAQ;AAAA,UAClB,GAEAU,EAAW,cAAcZ,CAAI;AAAA,QAC/B;AACE,UAAAW,EAAO,IAAI,MAAM,sBAAsB,CAAC;AAAA,MAE5C,CAAC;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/ListView.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import W from "lodash-es/cloneDeep";
|
|
2
|
-
import { resolveComponent as d, createElementBlock as o, openBlock as r, normalizeClass as a, createElementVNode as u, createCommentVNode as n, createVNode as S, toDisplayString as
|
|
2
|
+
import { resolveComponent as d, createElementBlock as o, openBlock as r, normalizeClass as a, createElementVNode as u, createCommentVNode as n, createVNode as S, toDisplayString as b, createBlock as h, withCtx as m, createTextVNode as T, renderSlot as f, TransitionGroup as F, resolveDirective as O, withDirectives as E, withKeys as q, normalizeStyle as Y, Fragment as J, renderList as Q, mergeProps as X, resolveDynamicComponent as Z, computed as $ } from "vue";
|
|
3
3
|
import ee from "./useSearch.js";
|
|
4
|
-
import { CSS_VARS as
|
|
5
|
-
import
|
|
4
|
+
import { CSS_VARS as z, LLLV_CHANGE_TRIGGERS as k } from "./constants.js";
|
|
5
|
+
import L from "./directives/sticky.js";
|
|
6
6
|
import { t as p } from "./locale.js";
|
|
7
7
|
import { persistentStorage as A } from "./storage.js";
|
|
8
|
-
import { getCssVar as
|
|
8
|
+
import { getCssVar as V, sortItems as te, filterItems as se } from "./utils/helpers.js";
|
|
9
9
|
import le from "./Badge.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import v from "./Button.js";
|
|
11
|
+
import D from "./Checkbox.js";
|
|
12
12
|
import ie from "./Dropdown.js";
|
|
13
|
-
import { _ as
|
|
13
|
+
import { _ as R } from "./Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js";
|
|
14
14
|
import re from "./Filters.js";
|
|
15
15
|
import B from "./Icon.js";
|
|
16
16
|
import ae from "./Input.js";
|
|
@@ -25,8 +25,8 @@ const de = "_checkbox_11ksu_13", he = "_actions_11ksu_17", ue = {
|
|
|
25
25
|
}, me = {
|
|
26
26
|
name: "bulk-actions",
|
|
27
27
|
components: {
|
|
28
|
-
"ll-button":
|
|
29
|
-
"ll-checkbox":
|
|
28
|
+
"ll-button": v,
|
|
29
|
+
"ll-checkbox": D
|
|
30
30
|
},
|
|
31
31
|
props: {
|
|
32
32
|
allowSelectAll: Boolean,
|
|
@@ -118,7 +118,7 @@ function ye(e, l, s, _, i, t) {
|
|
|
118
118
|
"onUpdate:checked": t.onSelectPage
|
|
119
119
|
}, null, 8, ["class", "checked", "indeterminate", "label", "onUpdate:checked"]),
|
|
120
120
|
s.totalSelectedCount && !s.hideBulkActionOptions ? (r(), o("div", ge, [
|
|
121
|
-
s.hideNumberOfTotalSelected ? n("", !0) : (r(), o("div", fe,
|
|
121
|
+
s.hideNumberOfTotalSelected ? n("", !0) : (r(), o("div", fe, b(t.numberOfTotalSelectedText), 1)),
|
|
122
122
|
u("div", {
|
|
123
123
|
class: a({ "ml-3": !s.hideNumberOfTotalSelected })
|
|
124
124
|
}, [
|
|
@@ -128,7 +128,7 @@ function ye(e, l, s, _, i, t) {
|
|
|
128
128
|
onClick: t.selectAll
|
|
129
129
|
}, {
|
|
130
130
|
default: m(() => [
|
|
131
|
-
T(
|
|
131
|
+
T(b(t.selectAllCountText), 1)
|
|
132
132
|
]),
|
|
133
133
|
_: 1
|
|
134
134
|
}, 8, ["onClick"])) : (r(), h(g, {
|
|
@@ -137,13 +137,13 @@ function ye(e, l, s, _, i, t) {
|
|
|
137
137
|
onClick: t.clearSelected
|
|
138
138
|
}, {
|
|
139
139
|
default: m(() => [
|
|
140
|
-
T(
|
|
140
|
+
T(b(t.clearSelectedText), 1)
|
|
141
141
|
]),
|
|
142
142
|
_: 1
|
|
143
143
|
}, 8, ["onClick"]))
|
|
144
144
|
], 2)
|
|
145
145
|
])) : s.hideBulkActionOptions && s.totalSelectedCount ? (r(), o("div", Se, [
|
|
146
|
-
u("h4", null,
|
|
146
|
+
u("h4", null, b(t.numItemsSelectedText), 1)
|
|
147
147
|
])) : n("", !0)
|
|
148
148
|
], 2),
|
|
149
149
|
s.totalSelectedCount && !s.hideBulkActionOptions ? (r(), o("div", {
|
|
@@ -156,7 +156,7 @@ function ye(e, l, s, _, i, t) {
|
|
|
156
156
|
}
|
|
157
157
|
const pe = {
|
|
158
158
|
$style: ue
|
|
159
|
-
}, _e = /* @__PURE__ */ C(me, [["render", ye], ["__cssModules", pe]]),
|
|
159
|
+
}, _e = /* @__PURE__ */ C(me, [["render", ye], ["__cssModules", pe]]), be = {
|
|
160
160
|
name: "loading-manager",
|
|
161
161
|
components: {
|
|
162
162
|
EmptyState: oe,
|
|
@@ -174,7 +174,7 @@ const pe = {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
|
-
function
|
|
177
|
+
function ke(e, l, s, _, i, t) {
|
|
178
178
|
const c = d("Loading"), g = d("EmptyState");
|
|
179
179
|
return s.loading ? (r(), h(c, {
|
|
180
180
|
key: 0,
|
|
@@ -194,22 +194,22 @@ function be(e, l, s, _, i, t) {
|
|
|
194
194
|
text: s.emptyStateText
|
|
195
195
|
}, null, 8, ["text"]));
|
|
196
196
|
}
|
|
197
|
-
const Ce = /* @__PURE__ */ C(
|
|
198
|
-
"main-header": "_main-
|
|
199
|
-
"expanded-content-header": "_expanded-content-
|
|
200
|
-
"expanded-content-header-grid": "_expanded-content-header-
|
|
201
|
-
"expansion-toggle-button": "_expansion-toggle-
|
|
202
|
-
"list-group": "_list-
|
|
203
|
-
"expanded-content-list-items-wrapper": "_expanded-content-list-items-
|
|
197
|
+
const Ce = /* @__PURE__ */ C(be, [["render", ke]]), we = {
|
|
198
|
+
"main-header": "_main-header_1j6ei_5",
|
|
199
|
+
"expanded-content-header": "_expanded-content-header_1j6ei_21",
|
|
200
|
+
"expanded-content-header-grid": "_expanded-content-header-grid_1j6ei_44",
|
|
201
|
+
"expansion-toggle-button": "_expansion-toggle-button_1j6ei_62",
|
|
202
|
+
"list-group": "_list-group_1j6ei_66",
|
|
203
|
+
"expanded-content-list-items-wrapper": "_expanded-content-list-items-wrapper_1j6ei_73"
|
|
204
204
|
}, Te = {
|
|
205
205
|
name: "list-group",
|
|
206
206
|
components: {
|
|
207
|
-
Expand:
|
|
208
|
-
"ll-button":
|
|
207
|
+
Expand: R,
|
|
208
|
+
"ll-button": v,
|
|
209
209
|
Icon: B
|
|
210
210
|
},
|
|
211
211
|
directives: {
|
|
212
|
-
sticky:
|
|
212
|
+
sticky: L
|
|
213
213
|
},
|
|
214
214
|
props: {
|
|
215
215
|
/**
|
|
@@ -244,7 +244,7 @@ const Ce = /* @__PURE__ */ C(ke, [["render", be]]), we = {
|
|
|
244
244
|
},
|
|
245
245
|
computed: {
|
|
246
246
|
headerOffset() {
|
|
247
|
-
return parseFloat(
|
|
247
|
+
return parseFloat(V(z.TOP_HEADER_HEIGHT));
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
250
|
methods: {
|
|
@@ -255,9 +255,9 @@ const Ce = /* @__PURE__ */ C(ke, [["render", be]]), we = {
|
|
|
255
255
|
this.$refs.actionsContainer.contains(e.target) || this.toggleExpand();
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
},
|
|
258
|
+
}, Ie = { class: "flex-auto" }, xe = { ref: "actionsContainer" }, ve = { class: "relative w-full lg:shadow" };
|
|
259
259
|
function Be(e, l, s, _, i, t) {
|
|
260
|
-
const c = d("Icon"), g = d("ll-button"),
|
|
260
|
+
const c = d("Icon"), g = d("ll-button"), I = d("Expand"), x = O("sticky");
|
|
261
261
|
return r(), o("div", {
|
|
262
262
|
class: a([
|
|
263
263
|
e.$style["list-group"],
|
|
@@ -284,19 +284,19 @@ function Be(e, l, s, _, i, t) {
|
|
|
284
284
|
]),
|
|
285
285
|
_: 1
|
|
286
286
|
}, 8, ["class"])) : n("", !0),
|
|
287
|
-
u("div",
|
|
287
|
+
u("div", Ie, [
|
|
288
288
|
f(e.$slots, "title")
|
|
289
289
|
]),
|
|
290
|
-
u("div",
|
|
290
|
+
u("div", xe, [
|
|
291
291
|
f(e.$slots, "actions")
|
|
292
292
|
], 512)
|
|
293
293
|
], 2),
|
|
294
|
-
S(
|
|
294
|
+
S(I, {
|
|
295
295
|
"is-expanded": i.isExpanded,
|
|
296
296
|
onAfterExpand: l[1] || (l[1] = (w) => i.isDoneExpanding = !0)
|
|
297
297
|
}, {
|
|
298
298
|
default: m(() => [
|
|
299
|
-
u("div",
|
|
299
|
+
u("div", ve, [
|
|
300
300
|
e.$slots["expanded-content-list-header"] ? E((r(), o("header", {
|
|
301
301
|
key: 0,
|
|
302
302
|
class: a(e.$style["expanded-content-header"])
|
|
@@ -307,7 +307,7 @@ function Be(e, l, s, _, i, t) {
|
|
|
307
307
|
f(e.$slots, "expanded-content-list-header")
|
|
308
308
|
], 2)
|
|
309
309
|
], 2)), [
|
|
310
|
-
[
|
|
310
|
+
[x, i.isExpanded && i.isDoneExpanding ? t.headerOffset : 0]
|
|
311
311
|
]) : n("", !0),
|
|
312
312
|
u("div", {
|
|
313
313
|
class: a(e.$style["expanded-content-list-items-wrapper"])
|
|
@@ -424,32 +424,32 @@ function Ee(e, l, s, _, i, t) {
|
|
|
424
424
|
], 2)
|
|
425
425
|
], 2);
|
|
426
426
|
}
|
|
427
|
-
const
|
|
427
|
+
const ze = {
|
|
428
428
|
$style: Fe
|
|
429
|
-
}, gt = /* @__PURE__ */ C(Oe, [["render", Ee], ["__cssModules",
|
|
430
|
-
"list-items": "_list-
|
|
431
|
-
"legacy-box": "_legacy-
|
|
432
|
-
header:
|
|
433
|
-
"header-grid-container": "_header-grid-
|
|
434
|
-
"header-grid": "_header-
|
|
435
|
-
"search-input": "_search-
|
|
436
|
-
"clear-button": "_clear-
|
|
437
|
-
"search-button": "_search-
|
|
438
|
-
"total-sort": "_total-
|
|
439
|
-
"filter-toggle-btn": "_filter-toggle-
|
|
440
|
-
"filter-toggle-btn-with-hint-text": "_filter-toggle-btn-with-hint-
|
|
441
|
-
"filters-expand": "_filters-
|
|
442
|
-
"filters-wrapper": "_filters-
|
|
443
|
-
separator:
|
|
444
|
-
"filters-half-width": "_filters-half-
|
|
445
|
-
dropdown:
|
|
446
|
-
"sort-option": "_sort-
|
|
447
|
-
"select-all": "_select-
|
|
429
|
+
}, gt = /* @__PURE__ */ C(Oe, [["render", Ee], ["__cssModules", ze]]), Le = "_header_102z7_28", Ve = "_separator_102z7_1", De = "_dropdown_102z7_202", Re = {
|
|
430
|
+
"list-items": "_list-items_102z7_5",
|
|
431
|
+
"legacy-box": "_legacy-box_102z7_19",
|
|
432
|
+
header: Le,
|
|
433
|
+
"header-grid-container": "_header-grid-container_102z7_78",
|
|
434
|
+
"header-grid": "_header-grid_102z7_78",
|
|
435
|
+
"search-input": "_search-input_102z7_112",
|
|
436
|
+
"clear-button": "_clear-button_102z7_123",
|
|
437
|
+
"search-button": "_search-button_102z7_137",
|
|
438
|
+
"total-sort": "_total-sort_102z7_154",
|
|
439
|
+
"filter-toggle-btn": "_filter-toggle-btn_102z7_161",
|
|
440
|
+
"filter-toggle-btn-with-hint-text": "_filter-toggle-btn-with-hint-text_102z7_165",
|
|
441
|
+
"filters-expand": "_filters-expand_102z7_180",
|
|
442
|
+
"filters-wrapper": "_filters-wrapper_102z7_181",
|
|
443
|
+
separator: Ve,
|
|
444
|
+
"filters-half-width": "_filters-half-width_102z7_194",
|
|
445
|
+
dropdown: De,
|
|
446
|
+
"sort-option": "_sort-option_102z7_206",
|
|
447
|
+
"select-all": "_select-all_102z7_210"
|
|
448
448
|
}, P = {
|
|
449
449
|
isSearchable: !0,
|
|
450
450
|
placeholder: "Search",
|
|
451
451
|
searchBy: ["name"]
|
|
452
|
-
},
|
|
452
|
+
}, Ne = {
|
|
453
453
|
name: "ll-list-view",
|
|
454
454
|
components: {
|
|
455
455
|
BulkActions: _e,
|
|
@@ -457,15 +457,15 @@ const Le = {
|
|
|
457
457
|
Paginate: ne,
|
|
458
458
|
LoadingManager: Ce,
|
|
459
459
|
Badge: le,
|
|
460
|
-
Button:
|
|
460
|
+
Button: v,
|
|
461
461
|
Icon: B,
|
|
462
462
|
Dropdown: ie,
|
|
463
|
-
Expand:
|
|
464
|
-
Checkbox:
|
|
463
|
+
Expand: R,
|
|
464
|
+
Checkbox: D,
|
|
465
465
|
Input: ae
|
|
466
466
|
},
|
|
467
467
|
directives: {
|
|
468
|
-
sticky:
|
|
468
|
+
sticky: L
|
|
469
469
|
},
|
|
470
470
|
inject: {
|
|
471
471
|
trackSearch: { default: () => () => {
|
|
@@ -788,7 +788,7 @@ const Le = {
|
|
|
788
788
|
return this.selectedItems.length;
|
|
789
789
|
},
|
|
790
790
|
headerOffset() {
|
|
791
|
-
return this.disableStickyHeader ? null : this.stickyHeaderOffset ?? parseFloat(
|
|
791
|
+
return this.disableStickyHeader ? null : this.stickyHeaderOffset ?? parseFloat(V(z.TOP_HEADER_HEIGHT));
|
|
792
792
|
}
|
|
793
793
|
},
|
|
794
794
|
watch: {
|
|
@@ -909,7 +909,7 @@ const Le = {
|
|
|
909
909
|
*/
|
|
910
910
|
reset() {
|
|
911
911
|
if (this.$emit("change:reset"), this.searchTerm = "", this.setPage({ pageNumber: 1 }), this.isServerSide) {
|
|
912
|
-
this.change({ trigger:
|
|
912
|
+
this.change({ trigger: k.RESET });
|
|
913
913
|
return;
|
|
914
914
|
}
|
|
915
915
|
this.processResults();
|
|
@@ -927,7 +927,7 @@ const Le = {
|
|
|
927
927
|
* by Filters.
|
|
928
928
|
*/
|
|
929
929
|
onSearch() {
|
|
930
|
-
this.$refs.llFilters.applyFilters({ trigger:
|
|
930
|
+
this.$refs.llFilters.applyFilters({ trigger: k.SEARCH });
|
|
931
931
|
},
|
|
932
932
|
/**
|
|
933
933
|
* Event handler for when the user:
|
|
@@ -939,7 +939,7 @@ const Le = {
|
|
|
939
939
|
* @param {string} [options.trigger] - what caused the changes
|
|
940
940
|
* @returns {Promise<void>}
|
|
941
941
|
*/
|
|
942
|
-
async onFilter({ trigger: e =
|
|
942
|
+
async onFilter({ trigger: e = k.APPLY } = {}) {
|
|
943
943
|
if (this.setPage({ pageNumber: 1 }), this.change({ trigger: e }), this.trackSearch(this.searchTerm), this.trackFilters(this.filters), this.selectedItems = [], !this.isServerSide) {
|
|
944
944
|
try {
|
|
945
945
|
this.isFiltering = !0, await this.processResults({ trigger: e });
|
|
@@ -969,7 +969,7 @@ const Le = {
|
|
|
969
969
|
* @param {string} term The updated sort term
|
|
970
970
|
*/
|
|
971
971
|
onSort(e) {
|
|
972
|
-
e !== this.sortTerm && (this.sortTerm = e, this.$emit("change:sort", e), this.trackSort(e), this.clearSelected(), this.setPage({ pageNumber: 1 }), this.change({ trigger:
|
|
972
|
+
e !== this.sortTerm && (this.sortTerm = e, this.$emit("change:sort", e), this.trackSort(e), this.clearSelected(), this.setPage({ pageNumber: 1 }), this.change({ trigger: k.SORT }));
|
|
973
973
|
},
|
|
974
974
|
/**
|
|
975
975
|
* Sets current page for the Paginator.
|
|
@@ -978,7 +978,7 @@ const Le = {
|
|
|
978
978
|
* @param {boolean} data.forceChange - flag to force the change
|
|
979
979
|
*/
|
|
980
980
|
setPage({ pageNumber: e, forceChange: l = !1 } = {}) {
|
|
981
|
-
this.previousPage = this.currentPage, this.currentPage = e, this.isServerSide || this.$emit("change:page", e), l && this.change({ trigger:
|
|
981
|
+
this.previousPage = this.currentPage, this.currentPage = e, this.isServerSide || this.$emit("change:page", e), l && this.change({ trigger: k.PAGE });
|
|
982
982
|
},
|
|
983
983
|
/**
|
|
984
984
|
* Set the scroll position to the top of the list view.
|
|
@@ -1020,12 +1020,12 @@ const Le = {
|
|
|
1020
1020
|
return e.reduce((l, s) => this.isItemDisabled(s) ? l : [...l, s], []);
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
},
|
|
1023
|
+
}, je = { class: "ll-grid grid-cols-4 md:grid-cols-8 lg:grid-cols-12" }, He = ["disabled"], Me = { class: "button-grid col-span-1 items-end justify-end md:col-span-6 lg:col-span-3" }, Ge = {
|
|
1024
1024
|
key: 0,
|
|
1025
1025
|
class: "text-xs"
|
|
1026
1026
|
};
|
|
1027
1027
|
function Ue(e, l, s, _, i, t) {
|
|
1028
|
-
const c = d("Icon"), g = d("Button"),
|
|
1028
|
+
const c = d("Icon"), g = d("Button"), I = d("Input"), x = d("Badge"), w = d("Filters"), N = d("Expand"), j = d("Dropdown"), H = d("Checkbox"), M = d("BulkActions"), G = d("Paginate"), U = O("sticky");
|
|
1029
1029
|
return r(), o("div", null, [
|
|
1030
1030
|
t.showPrimaryControls || t.showSecondaryControls ? (r(), o("div", {
|
|
1031
1031
|
key: 0,
|
|
@@ -1037,8 +1037,8 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1037
1037
|
class: a(["controls", [e.$style["legacy-box"], { "col-span-12 lg:col-span-6": t.showSecondaryControls }]]),
|
|
1038
1038
|
"data-test": "filters|controls"
|
|
1039
1039
|
}, [
|
|
1040
|
-
u("div",
|
|
1041
|
-
t.internalSearchSchema.isSearchable ? (r(), h(
|
|
1040
|
+
u("div", je, [
|
|
1041
|
+
t.internalSearchSchema.isSearchable ? (r(), h(I, {
|
|
1042
1042
|
key: 0,
|
|
1043
1043
|
ref: "search-input",
|
|
1044
1044
|
modelValue: i.searchTerm,
|
|
@@ -1066,7 +1066,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1066
1066
|
onClick: l[0] || (l[0] = (...y) => t.clearSearchTerm && t.clearSearchTerm(...y))
|
|
1067
1067
|
}, [
|
|
1068
1068
|
S(c, { name: "close" })
|
|
1069
|
-
], 10,
|
|
1069
|
+
], 10, He)) : n("", !0),
|
|
1070
1070
|
S(g, {
|
|
1071
1071
|
"data-test": "button|search-button",
|
|
1072
1072
|
disabled: t.isLoading,
|
|
@@ -1091,7 +1091,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1091
1091
|
{ [e.$style["filter-toggle-btn-with-hint-text"]]: !!t.internalSearchSchema.hintText }
|
|
1092
1092
|
]])
|
|
1093
1093
|
}, [
|
|
1094
|
-
S(
|
|
1094
|
+
S(x, {
|
|
1095
1095
|
class: "w-full lg:w-auto",
|
|
1096
1096
|
content: t.numberOfFilters
|
|
1097
1097
|
}, {
|
|
@@ -1113,7 +1113,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1113
1113
|
key: 1,
|
|
1114
1114
|
name: "filter-line"
|
|
1115
1115
|
})),
|
|
1116
|
-
T(" " +
|
|
1116
|
+
T(" " + b(i.filterText), 1)
|
|
1117
1117
|
]),
|
|
1118
1118
|
_: 1
|
|
1119
1119
|
}, 8, ["disabled", "onClick"])
|
|
@@ -1125,7 +1125,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1125
1125
|
f(e.$slots, "actions")
|
|
1126
1126
|
])
|
|
1127
1127
|
]),
|
|
1128
|
-
S(
|
|
1128
|
+
S(N, {
|
|
1129
1129
|
"data-test": "filters|content",
|
|
1130
1130
|
class: a(e.$style["filters-expand"]),
|
|
1131
1131
|
"is-expanded": i.isShowingFilters
|
|
@@ -1163,8 +1163,8 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1163
1163
|
key: 1,
|
|
1164
1164
|
class: a(["mb-1.5", t.shouldShowTotal ? e.$style["total-sort"] : "text-right"])
|
|
1165
1165
|
}, [
|
|
1166
|
-
t.shouldShowTotal ? (r(), o("div", Ge,
|
|
1167
|
-
Object.keys(s.sorts).length ? (r(), h(
|
|
1166
|
+
t.shouldShowTotal ? (r(), o("div", Ge, b(t.total), 1)) : n("", !0),
|
|
1167
|
+
Object.keys(s.sorts).length ? (r(), h(j, {
|
|
1168
1168
|
key: 1,
|
|
1169
1169
|
class: a(e.$style.dropdown),
|
|
1170
1170
|
label: `${s.sortLabel} ${i.sortTerm}`,
|
|
@@ -1186,7 +1186,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1186
1186
|
onClick: (We) => t.onSort(y)
|
|
1187
1187
|
}, {
|
|
1188
1188
|
default: m(() => [
|
|
1189
|
-
T(
|
|
1189
|
+
T(b(y) + " ", 1),
|
|
1190
1190
|
y === i.sortTerm ? (r(), h(c, {
|
|
1191
1191
|
key: 0,
|
|
1192
1192
|
name: "check",
|
|
@@ -1217,7 +1217,7 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1217
1217
|
u("div", {
|
|
1218
1218
|
class: a([e.$style["header-grid-container"], "border-b border-ice-200 px-3"])
|
|
1219
1219
|
}, [
|
|
1220
|
-
s.isSelectable ? (r(), h(
|
|
1220
|
+
s.isSelectable ? (r(), h(H, {
|
|
1221
1221
|
key: 0,
|
|
1222
1222
|
class: a(["ml-3", e.$style["select-all"]]),
|
|
1223
1223
|
checked: t.isSomePageChecked,
|
|
@@ -1291,8 +1291,8 @@ function Ue(e, l, s, _, i, t) {
|
|
|
1291
1291
|
]);
|
|
1292
1292
|
}
|
|
1293
1293
|
const Ke = {
|
|
1294
|
-
$style:
|
|
1295
|
-
}, ft = /* @__PURE__ */ C(
|
|
1294
|
+
$style: Re
|
|
1295
|
+
}, ft = /* @__PURE__ */ C(Ne, [["render", Ue], ["__cssModules", Ke]]);
|
|
1296
1296
|
export {
|
|
1297
1297
|
_e as BulkActions,
|
|
1298
1298
|
mt as ListGroup,
|