fds-vue-core 9.0.0 → 9.1.0
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/components/FdsSearchSelectPro/FdsSearchSelectPro.js.map +1 -1
- package/dist/components/FdsSearchSelectPro/FdsSearchSelectPro.vue.d.ts +1 -0
- package/dist/components/FdsSearchSelectPro/FdsSearchSelectPro.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/components/FdsSearchSelectPro/FdsSearchSelectPro.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/FdsSearchSelectPro/types.d.ts +2 -0
- package/dist/components/FdsSearchSelectPro/useSearchSelectProItems.js +1 -1
- package/dist/components/FdsSearchSelectPro/useSearchSelectProItems.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/FdsSearchSelectPro/FdsSearchSelectPro.stories.ts +24 -0
- package/src/components/FdsSearchSelectPro/FdsSearchSelectPro.vue +1 -0
- package/src/components/FdsSearchSelectPro/types.ts +2 -0
- package/src/components/FdsSearchSelectPro/useSearchSelectProItems.ts +1 -1
package/package.json
CHANGED
|
@@ -39,6 +39,10 @@ const meta: Meta<typeof FdsSearchSelect> = {
|
|
|
39
39
|
control: { type: 'boolean' },
|
|
40
40
|
description: 'Allows divider rows to be selectable',
|
|
41
41
|
},
|
|
42
|
+
keepDividerOrder: {
|
|
43
|
+
control: { type: 'boolean' },
|
|
44
|
+
description: 'Keeps explicit divider groups in the given order instead of sorting them by label',
|
|
45
|
+
},
|
|
42
46
|
showLoadMore: {
|
|
43
47
|
control: { type: 'boolean' },
|
|
44
48
|
description: 'Shows load-more action row at the end of list',
|
|
@@ -684,6 +688,26 @@ export const SingleSelectWithSelectableDivider: Story = {
|
|
|
684
688
|
},
|
|
685
689
|
}
|
|
686
690
|
|
|
691
|
+
export const KeepDividerOrder: Story = {
|
|
692
|
+
args: {
|
|
693
|
+
items: [
|
|
694
|
+
{ id: 'shown', name: 'Visas i App och Portal', isDivider: true },
|
|
695
|
+
{ id: 1, name: 'Hälsoundersökning' },
|
|
696
|
+
{ id: 2, name: 'Vaccination' },
|
|
697
|
+
{ id: 'hidden', name: 'Visas ej i App och Portal', isDivider: true },
|
|
698
|
+
{ id: 3, name: 'Hörseltest' },
|
|
699
|
+
{ id: 'scheduling', name: 'Schemaläggning: Visas som fysiskt besök', isDivider: true },
|
|
700
|
+
{ id: 4, name: 'Syntest' },
|
|
701
|
+
],
|
|
702
|
+
keepDividerOrder: true,
|
|
703
|
+
itemKey: 'id',
|
|
704
|
+
searchFields: ['name'],
|
|
705
|
+
label: 'Tjänstetyp',
|
|
706
|
+
searchContext: { context: 'tjänstetyper', linkWord: 'av' },
|
|
707
|
+
noResultPrompt: 'Inga resultat hittades',
|
|
708
|
+
},
|
|
709
|
+
}
|
|
710
|
+
|
|
687
711
|
export const MultipleWithLoadMore: Story = {
|
|
688
712
|
args: {
|
|
689
713
|
items: largeHierarchicalItems,
|
|
@@ -29,6 +29,8 @@ export interface FdsSearchSelectProProps extends Omit</* @vue-ignore */ HTMLAttr
|
|
|
29
29
|
dividerField?: string
|
|
30
30
|
/** Allows divider rows/group headers to be selectable as regular options. */
|
|
31
31
|
dividerSelectable?: boolean
|
|
32
|
+
/** Keeps explicit divider groups in the order given in `items` instead of sorting them by label. */
|
|
33
|
+
keepDividerOrder?: boolean
|
|
32
34
|
/** Field name used to auto-insert divider groups from raw items (for example region). */
|
|
33
35
|
autoDividerBy?: string
|
|
34
36
|
/** Field name containing hierarchy level number (defaults to `level`). */
|
|
@@ -190,7 +190,7 @@ export const useSearchSelectProItems = ({
|
|
|
190
190
|
if (!groupField) {
|
|
191
191
|
const dividerField = props.dividerField ?? 'isDivider'
|
|
192
192
|
const hasExplicitDividers = baseItems.some((item) => item[dividerField] === true || item.type === 'divider')
|
|
193
|
-
if (!hasExplicitDividers) return baseItems
|
|
193
|
+
if (!hasExplicitDividers || props.keepDividerOrder) return baseItems
|
|
194
194
|
|
|
195
195
|
const locale = resolvedLocale.value
|
|
196
196
|
return reorderExplicitDividerGroups(baseItems, locale)
|