bitboss-ui 2.0.101 → 2.0.103

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.
Files changed (172) hide show
  1. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +10 -16
  2. package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +109 -7
  3. package/dist/components/BbSelect/BbSelect.vue.d.ts +2 -16
  4. package/dist/composables/useBaseOptions.d.ts +31 -0
  5. package/dist/composables/useCoherence.d.ts +20 -0
  6. package/dist/composables/useHashedWatcher.d.ts +2 -0
  7. package/dist/composables/useIndexById.d.ts +11 -0
  8. package/dist/composables/useItemsGetter.d.ts +12 -0
  9. package/dist/composables/usePrefill.d.ts +12 -0
  10. package/dist/index100.js +88 -60
  11. package/dist/index101.js +10 -13
  12. package/dist/index111.js +154 -126
  13. package/dist/index119.js +1 -1
  14. package/dist/index121.js +4 -4
  15. package/dist/index123.js +1 -1
  16. package/dist/index127.js +1 -1
  17. package/dist/index128.js +1 -1
  18. package/dist/index129.js +1 -1
  19. package/dist/index13.js +54 -45
  20. package/dist/index131.js +1 -1
  21. package/dist/index132.js +69 -65
  22. package/dist/index133.js +2 -2
  23. package/dist/index15.js +4 -4
  24. package/dist/index17.js +3 -3
  25. package/dist/index19.js +126 -82
  26. package/dist/index205.js +52 -80
  27. package/dist/index207.js +13 -5
  28. package/dist/index208.js +19 -124
  29. package/dist/index209.js +4 -19
  30. package/dist/index21.js +14 -14
  31. package/dist/index210.js +124 -14
  32. package/dist/index211.js +5 -16
  33. package/dist/index212.js +125 -2
  34. package/dist/index213.js +19 -2
  35. package/dist/index214.js +15 -40
  36. package/dist/index215.js +15 -19
  37. package/dist/index216.js +2 -6
  38. package/dist/index217.js +2 -53
  39. package/dist/index218.js +43 -0
  40. package/dist/index219.js +6 -13
  41. package/dist/index220.js +2 -2
  42. package/dist/index222.js +3 -3
  43. package/dist/index223.js +2 -4
  44. package/dist/index224.js +4 -3
  45. package/dist/index225.js +2 -8
  46. package/dist/index226.js +3 -2
  47. package/dist/index227.js +7 -4
  48. package/dist/index228.js +8 -2
  49. package/dist/index229.js +3 -2
  50. package/dist/index23.js +13 -13
  51. package/dist/index230.js +84 -19
  52. package/dist/index232.js +8 -3
  53. package/dist/index233.js +23 -248
  54. package/dist/index234.js +17 -52
  55. package/dist/index235.js +47 -43
  56. package/dist/index236.js +15 -5
  57. package/dist/index237.js +12 -60
  58. package/dist/index238.js +16 -3
  59. package/dist/index239.js +19 -7
  60. package/dist/index240.js +25 -166
  61. package/dist/index241.js +243 -77
  62. package/dist/index242.js +54 -0
  63. package/dist/index243.js +43 -7
  64. package/dist/index244.js +5 -2
  65. package/dist/index245.js +59 -17
  66. package/dist/index246.js +2 -106
  67. package/dist/index247.js +117 -0
  68. package/dist/index248.js +3 -100
  69. package/dist/index249.js +4 -0
  70. package/dist/index25.js +5 -5
  71. package/dist/index250.js +18 -2
  72. package/dist/index251.js +106 -2
  73. package/dist/index253.js +100 -3
  74. package/dist/index255.js +12 -23
  75. package/dist/index256.js +2 -89
  76. package/dist/index257.js +4 -0
  77. package/dist/index258.js +10 -6
  78. package/dist/index259.js +3 -16
  79. package/dist/index260.js +6 -3
  80. package/dist/index261.js +18 -0
  81. package/dist/index262.js +8 -6
  82. package/dist/index263.js +23 -176
  83. package/dist/index264.js +89 -9
  84. package/dist/index266.js +3 -281
  85. package/dist/index268.js +7 -2
  86. package/dist/index269.js +176 -2
  87. package/dist/index27.js +1 -1
  88. package/dist/index270.js +281 -2
  89. package/dist/index271.js +6 -2
  90. package/dist/index272.js +2 -2
  91. package/dist/index273.js +2 -126
  92. package/dist/index274.js +2 -431
  93. package/dist/index275.js +2 -22
  94. package/dist/index276.js +4 -0
  95. package/dist/index277.js +126 -2
  96. package/dist/index278.js +430 -3
  97. package/dist/index279.js +20 -7
  98. package/dist/index281.js +2 -2
  99. package/dist/index282.js +4 -2
  100. package/dist/index283.js +28 -2
  101. package/dist/index284.js +200 -2
  102. package/dist/index285.js +436 -2
  103. package/dist/index286.js +127 -2
  104. package/dist/index287.js +85 -24
  105. package/dist/index288.js +9 -22
  106. package/dist/{index302.js → index289.js} +1 -1
  107. package/dist/index29.js +3 -3
  108. package/dist/index290.js +6 -435
  109. package/dist/index291.js +10 -126
  110. package/dist/index292.js +14 -197
  111. package/dist/index293.js +9 -89
  112. package/dist/index294.js +8 -3
  113. package/dist/index295.js +2 -12
  114. package/dist/index296.js +2 -9
  115. package/dist/index297.js +2 -17
  116. package/dist/index298.js +2 -4
  117. package/dist/index299.js +2 -7
  118. package/dist/index300.js +2 -11
  119. package/dist/index301.js +22 -3
  120. package/dist/index303.js +224 -213
  121. package/dist/index304.js +3 -5
  122. package/dist/index305.js +3 -2
  123. package/dist/index306.js +206 -59
  124. package/dist/index307.js +2 -3
  125. package/dist/index308.js +5 -3
  126. package/dist/index309.js +66 -3
  127. package/dist/index31.js +2 -2
  128. package/dist/index310.js +3 -58
  129. package/dist/index311.js +3 -5
  130. package/dist/index312.js +57 -7
  131. package/dist/index313.js +1 -1
  132. package/dist/index314.js +4 -3
  133. package/dist/index315.js +7 -6
  134. package/dist/index316.js +3 -7
  135. package/dist/index317.js +3 -18
  136. package/dist/index320.js +6 -46
  137. package/dist/index321.js +19 -2
  138. package/dist/index322.js +9 -0
  139. package/dist/index323.js +47 -480
  140. package/dist/index324.js +2 -424
  141. package/dist/index326.js +480 -2
  142. package/dist/index327.js +426 -0
  143. package/dist/index329.js +4 -0
  144. package/dist/index33.js +102 -61
  145. package/dist/index35.js +3 -3
  146. package/dist/index37.js +284 -244
  147. package/dist/index39.js +5 -5
  148. package/dist/index41.js +2 -2
  149. package/dist/index43.js +129 -84
  150. package/dist/index45.js +122 -120
  151. package/dist/index47.js +2 -2
  152. package/dist/index49.js +2 -2
  153. package/dist/index55.js +1 -1
  154. package/dist/index57.js +2 -2
  155. package/dist/index61.js +13 -9
  156. package/dist/index75.js +3 -3
  157. package/dist/index79.js +2 -2
  158. package/dist/index81.js +1 -1
  159. package/dist/index84.js +2 -2
  160. package/dist/index86.js +1 -1
  161. package/dist/index88.js +4 -4
  162. package/dist/index90.js +1 -1
  163. package/package.json +1 -1
  164. package/dist/composables/useOptions.d.ts +0 -43
  165. package/dist/index206.js +0 -128
  166. package/dist/index231.js +0 -29
  167. package/dist/index252.js +0 -12
  168. package/dist/index254.js +0 -11
  169. package/dist/index265.js +0 -226
  170. package/dist/index267.js +0 -8
  171. package/dist/index280.js +0 -10
  172. /package/dist/{index325.js → index328.js} +0 -0
@@ -1,13 +1,6 @@
1
1
  import { nextTick, HTMLAttributes, InputHTMLAttributes } from 'vue';
2
2
  import { Option as BaseOption } from '../../types/Option';
3
3
  export type BaseSelectProps = {
4
- /**
5
- * Allows the user to add options to the list by
6
- * inserting text in the input and pressing ENTER.
7
- * The value and text of the option generated is a
8
- * string equal to what has been inserted.
9
- */
10
- addOptions?: boolean;
11
4
  /**
12
5
  * Allows typing into the input.
13
6
  */
@@ -151,14 +144,6 @@ export type BaseSelectProps = {
151
144
  * Sets the input as required.
152
145
  */
153
146
  required?: boolean;
154
- /**
155
- * If `true` when in multiple selection, reset the query immediately
156
- * upon selecting an option. By default the query is
157
- * not reset until focus is lost so the user can search
158
- * for "Cath" and select "Cathy" and then write more to
159
- * search for "Catherine"
160
- */
161
- resetQueryOnOptionSelected?: boolean;
162
147
  /**
163
148
  * Adds a stash to accumulate selected values. Especially
164
149
  * useful when searching in a big database of items.
@@ -183,6 +168,7 @@ export type BaseSelectEvents = {
183
168
  (e: 'inactive'): void;
184
169
  (e: 'input', event: Event): void;
185
170
  (e: 'update:modelValue', value: any): void;
171
+ (e: 'option:add', text: string): void;
186
172
  };
187
173
  export type BaseSelectSlots = {
188
174
  append?: (props: {
@@ -223,6 +209,12 @@ export type BaseSelectSlots = {
223
209
  text: string;
224
210
  value: any;
225
211
  }) => any;
212
+ 'option:append'?: (props: {
213
+ item: any;
214
+ }) => any;
215
+ 'option:prepend'?: (props: {
216
+ item: any;
217
+ }) => any;
226
218
  'options:append'?: (props: object) => any;
227
219
  'options:prepend'?: (props: object) => any;
228
220
  prefix?: (props: object) => any;
@@ -552,6 +544,7 @@ declare const __VLS_component: import('vue').DefineComponent<BaseSelectProps, {}
552
544
  click: (event: MouseEvent) => any;
553
545
  focus: (event: FocusEvent) => any;
554
546
  inactive: () => any;
547
+ "option:add": (text: string) => any;
555
548
  }, string, import('vue').PublicProps, Readonly<BaseSelectProps> & Readonly<{
556
549
  onInput?: ((event: Event) => any) | undefined;
557
550
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
@@ -560,6 +553,7 @@ declare const __VLS_component: import('vue').DefineComponent<BaseSelectProps, {}
560
553
  onClick?: ((event: MouseEvent) => any) | undefined;
561
554
  onFocus?: ((event: FocusEvent) => any) | undefined;
562
555
  onInactive?: (() => any) | undefined;
556
+ "onOption:add"?: ((text: string) => any) | undefined;
563
557
  }>, {
564
558
  autocomplete: string;
565
559
  transitionDuration: number;
@@ -569,8 +563,8 @@ declare const __VLS_component: import('vue').DefineComponent<BaseSelectProps, {}
569
563
  loadingText: string;
570
564
  modelValueDebounceTime: number;
571
565
  noDataText: string;
572
- prefill: boolean | "focus";
573
566
  max: number;
567
+ prefill: boolean | "focus";
574
568
  filterBy: string | string[] | false | ((value: any, item: any) => boolean) | null;
575
569
  maxSelectedLabels: number;
576
570
  queryDebounceTime: number;
@@ -1,11 +1,113 @@
1
+ import { HTMLAttributes, InputHTMLAttributes, MaybeRefOrGetter } from 'vue';
2
+ import { NestedKeyOf } from '../../types/NestedKeyOf';
1
3
  import { SlotAttributes } from '../BaseCheckbox/BaseCheckbox.vue';
2
- import { BaseCheckboxGroupEvents, BaseCheckboxGroupProps } from '../BaseCheckboxGroup/BaseCheckboxGroup.vue';
3
- export type BaseSwitchGroupEvents = BaseCheckboxGroupEvents;
4
- export type BaseSwitchGroupProps<T> = BaseCheckboxGroupProps<T>;
4
+ export type BaseSwitchGroupProps<T> = {
5
+ /**
6
+ * Guides to the browser as to the type of information expected in the field.
7
+ */
8
+ ariaDescribedby?: InputHTMLAttributes['aria-describedby'];
9
+ /**
10
+ * Sets autofocus on page load.
11
+ */
12
+ autofocus?: InputHTMLAttributes['autofocus'];
13
+ /**
14
+ * Define a color for the component.
15
+ *
16
+ * Either a custom color or a coded color in common HEX, RGB, etc... format.
17
+ */
18
+ color?: string;
19
+ /**
20
+ * Defines an array of dependencies that will trigger actions in the component upon change.
21
+ */
22
+ dependencies?: any[];
23
+ /**
24
+ * Timeout used to debounce response to changes to dependencies.
25
+ */
26
+ depsDebounceTime?: number;
27
+ /**
28
+ * Direction of the layout of the inputs inside the fieldset. It can be either `horizontal` or `vertical`
29
+ */
30
+ direction?: 'horizontal' | 'vertical';
31
+ /**
32
+ * Disables the component
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * If coherence is enforce the input cannot have a modelValue the is incoherent with its current items.
37
+ *
38
+ * e.g. You cannot set v-model to a user that is not present in the items passed.
39
+ *
40
+ * modelValue will be reset upon incoherence.
41
+ */
42
+ enforceCoherence?: boolean;
43
+ /**
44
+ * Define if the component should be in an error state.
45
+ * It usually attaches a CSS class for styling purposes.
46
+ */
47
+ hasErrors?: boolean;
48
+ /**
49
+ * Visually hides the label of the input while maintaining accessibility.
50
+ */
51
+ hideLabel?: boolean;
52
+ /**
53
+ * The identifier of the component.
54
+ */
55
+ id?: HTMLAttributes['id'];
56
+ /**
57
+ * Used to retrieve items can be an array or a function.
58
+ */
59
+ items: T[] | ((prefill: boolean, modelValue?: any[]) => Promise<T[]>) | ((prefill: boolean, modelValue?: any[]) => T[]);
60
+ /**
61
+ * Defines a path that returns a property of the object to use as text or a function that returns a string
62
+ */
63
+ itemText?: T extends object ? NestedKeyOf<T> | ((item: T) => string) : ((item: T) => string) | undefined;
64
+ /**
65
+ * Defines a path that returns a property of the object to use as value or a function that returns any value
66
+ */
67
+ itemValue?: T extends object ? NestedKeyOf<T> | ((item: T) => string) : ((item: T) => any) | undefined;
68
+ /**
69
+ * String displayed while items are being loaded.
70
+ */
71
+ loadingText?: string;
72
+ /**
73
+ * Maximum number of selected items.
74
+ */
75
+ max?: number;
76
+ /**
77
+ * Used by v-model. Can be an array of any serializable type.
78
+ */
79
+ modelValue: any[];
80
+ /**
81
+ * Timeout used to debounce response to changes to modelValue.
82
+ */
83
+ modelValueDebounceTime?: number;
84
+ /**
85
+ * Defines the name of the input.
86
+ */
87
+ name?: InputHTMLAttributes['name'];
88
+ /**
89
+ * String displayed when there are no items to display.
90
+ */
91
+ noDataText?: MaybeRefOrGetter<string>;
92
+ /**
93
+ * Sets the input in a readonly state.
94
+ */
95
+ readonly?: boolean;
96
+ };
97
+ export type BaseSwitchGroupEvents = {
98
+ (e: 'blur', event: FocusEvent): void;
99
+ (e: 'change', event: Event): void;
100
+ (e: 'click', event: MouseEvent): void;
101
+ (e: 'focus', event: FocusEvent): void;
102
+ (e: 'inactive'): void;
103
+ (e: 'input', event: Event): void;
104
+ (e: 'keydown', event: KeyboardEvent): void;
105
+ (e: 'mousedown', event: MouseEvent): void;
106
+ (e: 'mouseup', event: MouseEvent): void;
107
+ (e: 'update:modelValue', value: any): void;
108
+ };
5
109
  declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
6
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
7
- readonly [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
8
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, `on${Capitalize<any>}`> & BaseSwitchGroupProps<T>> & import('vue').PublicProps;
110
+ props: __VLS_PrettifyLocal<any & BaseSwitchGroupProps<T>> & import('vue').PublicProps;
9
111
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
10
112
  attrs: any;
11
113
  slots: Readonly<{
@@ -65,7 +167,7 @@ declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_
65
167
  }) => any;
66
168
  append?: (props: object) => any;
67
169
  };
68
- emit: BaseCheckboxGroupEvents;
170
+ emit: BaseSwitchGroupEvents;
69
171
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
70
172
  [key: string]: any;
71
173
  }> & {
@@ -2,13 +2,6 @@ import { BaseSelectEvents } from '../BaseSelect/BaseSelect.vue';
2
2
  import { NestedKeyOf } from '../../types/NestedKeyOf';
3
3
  import { HTMLAttributes, InputHTMLAttributes } from 'vue';
4
4
  export type BbSelectProps<T> = {
5
- /**
6
- * Allows the user to add options to the list by
7
- * inserting text in the input and pressing ENTER.
8
- * The value and text of the option generated is a
9
- * string equal to what has been inserted.
10
- */
11
- addOptions?: boolean;
12
5
  /**
13
6
  * Allows typing into the input.
14
7
  */
@@ -176,14 +169,6 @@ export type BbSelectProps<T> = {
176
169
  * Sets the input in a readonly state.
177
170
  */
178
171
  readonly?: boolean;
179
- /**
180
- * If `true` when in multiple selection, reset the query immediately
181
- * upon selecting an option. By default the query is
182
- * not reset until focus is lost so the user can search
183
- * for "Cath" and select "Cathy" and then write more to
184
- * search for "Catherine"
185
- */
186
- resetQueryOnOptionSelected?: boolean;
187
172
  /**
188
173
  * Reverses the layout. Applicable in every direction the order of the label and the input is swapped.
189
174
  */
@@ -266,7 +251,8 @@ declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_
266
251
  readonly onClick?: ((event: MouseEvent) => any) | undefined;
267
252
  readonly onFocus?: ((event: FocusEvent) => any) | undefined;
268
253
  readonly onInactive?: (() => any) | undefined;
269
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onInput" | "onClick" | "onUpdate:modelValue" | "onInactive"> & BbSelectProps<T>> & import('vue').PublicProps;
254
+ readonly "onOption:add"?: ((text: string) => any) | undefined;
255
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onInput" | "onClick" | "onUpdate:modelValue" | "onInactive" | "onOption:add"> & BbSelectProps<T>> & import('vue').PublicProps;
270
256
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
271
257
  attrs: any;
272
258
  slots: Readonly<BbSelectSlots<T>> & BbSelectSlots<T>;
@@ -0,0 +1,31 @@
1
+ import { MaybeRef } from 'vue';
2
+ import { IndexById } from './useIndexById';
3
+ type Options = {
4
+ disabled: MaybeRef<boolean>;
5
+ selectable: boolean | ((item: any) => boolean);
6
+ max: number | undefined;
7
+ items: MaybeRef<any[]>;
8
+ selectedIndexedByHash: IndexById['data'];
9
+ itemText: MaybeRef<string | ((item: any) => string) | undefined>;
10
+ itemValue: MaybeRef<string | ((item: any) => string) | undefined>;
11
+ };
12
+ type BaseOption2 = {
13
+ item: any;
14
+ text: string;
15
+ value: any;
16
+ valueHash: string;
17
+ selected: boolean;
18
+ disabled: boolean;
19
+ };
20
+ export declare const useBaseOptions: ({ items, disabled, selectable, itemText, itemValue, selectedIndexedByHash, max, }: Options) => {
21
+ options: import('vue').ComputedRef<BaseOption2[]>;
22
+ createOption: (item: any) => {
23
+ item: any;
24
+ text: string;
25
+ value: any;
26
+ valueHash: string;
27
+ selected: boolean;
28
+ disabled: boolean;
29
+ };
30
+ };
31
+ export {};
@@ -0,0 +1,20 @@
1
+ import { MaybeRef } from 'vue';
2
+ type Options = {
3
+ /**
4
+ * The model value to check for coherence
5
+ */
6
+ modelValue: MaybeRef<any[]>;
7
+ /**
8
+ * An iteratee that returns a boolean indicating whether the value is coherent or not
9
+ */
10
+ iteratee: (item: any) => boolean;
11
+ multiple: boolean;
12
+ };
13
+ export declare const useCoherence: ({ modelValue, iteratee, multiple }: Options) => {
14
+ status: import('vue').ComputedRef<{
15
+ coherent: any[];
16
+ incoherent: any[];
17
+ }>;
18
+ coherent: import('vue').ComputedRef<boolean>;
19
+ };
20
+ export {};
@@ -0,0 +1,2 @@
1
+ import { WatchDebouncedOptions } from '@vueuse/core';
2
+ export declare const useHashedWatcher: (source: any, callback: (...args: any[]) => any, options?: WatchDebouncedOptions<any>) => void;
@@ -0,0 +1,11 @@
1
+ import { MaybeRef } from 'vue';
2
+ type Options = {
3
+ items: MaybeRef<any[]>;
4
+ key?: string;
5
+ };
6
+ export type IndexById = ReturnType<typeof useIndexById>;
7
+ export declare const useIndexById: ({ items, key }: Options) => {
8
+ data: import('vue').ComputedRef<Record<string, any>>;
9
+ get: (value: any) => any;
10
+ };
11
+ export {};
@@ -0,0 +1,12 @@
1
+ import { MaybeRef } from 'vue';
2
+ type Options = {
3
+ items: MaybeRef<unknown>;
4
+ debounce?: number;
5
+ };
6
+ export declare const useItemsGetter: (options: Options) => {
7
+ getter: (...args: any[]) => Promise<void>;
8
+ debouncedGetter: import('@vueuse/shared').PromisifyFn<(...args: any[]) => Promise<void>>;
9
+ items: import('vue').Ref<any[], any[]>;
10
+ loading: import('vue').ComputedRef<boolean>;
11
+ };
12
+ export {};
@@ -0,0 +1,12 @@
1
+ type Options = {
2
+ fn: (...args: any[]) => any;
3
+ onStart?: boolean;
4
+ multiple?: boolean;
5
+ currentValue?: any;
6
+ };
7
+ export declare const usePrefill: ({ fn, onStart, multiple, currentValue, }: Options) => {
8
+ isPrefilling: import('vue').Ref<boolean, boolean>;
9
+ hasPrefilled: import('vue').Ref<boolean, boolean>;
10
+ prefill: () => Promise<void>;
11
+ };
12
+ export {};
package/dist/index100.js CHANGED
@@ -1,12 +1,16 @@
1
- import { defineComponent as S, mergeModels as v, computed as y, toRef as u, reactive as $, useModel as b, watch as A, openBlock as h, createElementBlock as V, Fragment as k, renderSlot as r, unref as L, createCommentVNode as R, renderList as q } from "vue";
2
- import { useOptions as E } from "./index240.js";
3
- import { useItemValue as Q } from "./index279.js";
4
- import { isNil as g } from "./index251.js";
5
- import { indexBy as j } from "./index280.js";
6
- import { hash as B } from "./index232.js";
7
- const X = /* @__PURE__ */ S({
1
+ import { defineComponent as L, mergeModels as V, computed as b, toRef as m, reactive as P, useModel as I, watch as R, openBlock as B, createElementBlock as g, Fragment as k, renderSlot as r, unref as j, createCommentVNode as E, renderList as G } from "vue";
2
+ import { useItemValue as U } from "./index293.js";
3
+ import { isNil as x } from "./index257.js";
4
+ import { indexBy as W } from "./index294.js";
5
+ import { hash as H } from "./index229.js";
6
+ import { useItemsGetter as q } from "./index233.js";
7
+ import { usePrefill as z } from "./index238.js";
8
+ import { useIndexById as J } from "./index234.js";
9
+ import { useBaseOptions as K } from "./index235.js";
10
+ import { useHashedWatcher as Q } from "./index237.js";
11
+ const ne = /* @__PURE__ */ L({
8
12
  __name: "BbRows",
9
- props: /* @__PURE__ */ v({
13
+ props: /* @__PURE__ */ V({
10
14
  columns: { default: () => [] },
11
15
  dependencies: { default: () => [] },
12
16
  depsDebounceTime: { default: 0 },
@@ -26,72 +30,96 @@ const X = /* @__PURE__ */ S({
26
30
  "select-all": { type: Boolean, default: !1 },
27
31
  "select-allModifiers": {}
28
32
  }),
29
- emits: /* @__PURE__ */ v(["update:modelValue"], ["update:unselected-items", "update:select-all"]),
30
- setup(d, { emit: I }) {
31
- const l = d, m = I, { getItemValue: x } = Q(), p = y(() => !!(l.loading || M.value)), { options: O, selectOption: T, unselectOption: D, internalItems: H, innerLoading: M } = E({
32
- emit: m,
33
+ emits: /* @__PURE__ */ V(["update:modelValue"], ["update:unselected-items", "update:select-all"]),
34
+ setup(d, { emit: w }) {
35
+ const l = d, u = w, { getItemValue: M } = U(), p = b(() => !!(l.loading || O.value)), {
36
+ getter: f,
37
+ items: v,
38
+ loading: O
39
+ } = q({
40
+ items: m(l, "items")
41
+ }), { hasPrefilled: S } = z({
42
+ onStart: !0,
43
+ currentValue: l.modelValue,
44
+ multiple: l.multiple,
45
+ fn: async ({ prefill: e }) => {
46
+ await f(e, l.modelValue);
47
+ }
48
+ }), { data: y } = J({
49
+ items: m(l, "modelValue")
50
+ }), { options: F } = K({
51
+ disabled: m(l, "disabled"),
52
+ items: v,
33
53
  itemText: void 0,
34
54
  itemValue: l.itemValue,
35
55
  max: l.max,
36
- modelValue: u(l, "modelValue"),
37
- multiple: l.multiple,
38
- resetQueryOnOptionSelected: !1,
39
- stash: !1,
40
- items: u(l, "items"),
41
- enforceCoherence: !1,
42
- prefill: !0,
43
- modelValueDebounceTime: 0,
44
- dependencies: u(l, "dependencies"),
45
- depsDebounceTime: l.depsDebounceTime,
46
- queryDebounceTime: 0,
47
- disabled: u(l, "disabled")
48
- }), f = y(() => O.value.map((e) => {
49
- let s = !l.selectable;
50
- return typeof l.selectable == "function" && (s = !l.selectable(e.item)), s = s || !!e.disabled, {
51
- columns: j(
52
- l.columns.map((t) => {
53
- const { label: F, key: N } = t;
54
- let o = x(e.item, t.key);
55
- return t.formatter && // By default the formatter runs anyway
56
- (!g(o) || t.formatOnNull !== !1) && (o = t.formatter(o, t.key, e.item)), t.placeholder && g(o) && (o = t.placeholder), {
56
+ selectable: !0,
57
+ selectedIndexedByHash: y
58
+ }), N = async (e) => {
59
+ l.multiple ? u("update:modelValue", l.modelValue.concat(e.value)) : u("update:modelValue", e.value);
60
+ }, T = async (e) => {
61
+ if (l.multiple) {
62
+ const t = { ...y.value };
63
+ delete t[e.valueHash], u("update:modelValue", Object.values(t));
64
+ } else
65
+ u("update:modelValue", null);
66
+ };
67
+ Q(
68
+ () => [l.dependencies, l.items],
69
+ async () => {
70
+ S.value && await f(!1, l.modelValue);
71
+ },
72
+ {
73
+ debounce: l.depsDebounceTime
74
+ }
75
+ );
76
+ const h = b(() => F.value.map((e) => {
77
+ let t = !l.selectable;
78
+ return typeof l.selectable == "function" && (t = !l.selectable(e.item)), t = t || !!e.disabled, {
79
+ columns: W(
80
+ l.columns.map((a) => {
81
+ const { label: C, key: D } = a;
82
+ let o = M(e.item, a.key);
83
+ return a.formatter && // By default the formatter runs anyway
84
+ (!x(o) || a.formatOnNull !== !1) && (o = a.formatter(o, a.key, e.item)), a.placeholder && x(o) && (o = a.placeholder), {
57
85
  value: o,
58
- key: N,
59
- label: F
86
+ key: D,
87
+ label: C
60
88
  };
61
89
  }),
62
- (t) => t.key
90
+ (a) => a.key
63
91
  ),
64
92
  item: e.item,
65
93
  text: e.text,
66
94
  valueHash: e.valueHash,
67
95
  value: e.value,
68
- selected: !!(e.selected || c.value),
69
- disabled: s
96
+ selected: !!(e.selected || i.value),
97
+ disabled: t
70
98
  };
71
- })), w = (e) => {
72
- c.value || T(e), i.delete(e.valueHash), n.value = n.value.filter(
73
- (s) => B(s) !== B(e.item)
99
+ })), $ = (e) => {
100
+ i.value || N(e), c.delete(e.valueHash), n.value = n.value.filter(
101
+ (t) => H(t) !== H(e.item)
74
102
  );
75
- }, C = (e) => {
76
- i.add(e.valueHash), n.value.push(e.item), D(e);
77
- }, i = $(/* @__PURE__ */ new Set()), n = b(d, "unselected-items");
78
- let c = b(d, "select-all");
79
- return A(c, () => {
80
- i.clear(), n.value = [], m("update:modelValue", []);
81
- }), (e, s) => (h(), V(k, null, [
103
+ }, A = (e) => {
104
+ c.add(e.valueHash), n.value.push(e.item), T(e);
105
+ }, c = P(/* @__PURE__ */ new Set()), n = I(d, "unselected-items");
106
+ let i = I(d, "select-all");
107
+ return R(i, () => {
108
+ c.clear(), n.value = [], u("update:modelValue", []);
109
+ }), (e, t) => (B(), g(k, null, [
82
110
  p.value ? r(e.$slots, "loading", {
83
111
  key: 0,
84
- items: L(H)
85
- }) : R("", !0),
86
- f.value.length ? (h(!0), V(k, { key: 2 }, q(f.value, (a) => r(e.$slots, "default", {
87
- key: a.valueHash,
88
- checked: a.selected,
89
- columns: a.columns,
90
- disabled: a.disabled,
91
- item: a.item,
92
- select: () => w(a),
93
- unselect: () => C(a),
94
- value: a.value
112
+ items: j(v)
113
+ }) : E("", !0),
114
+ h.value.length ? (B(!0), g(k, { key: 2 }, G(h.value, (s) => r(e.$slots, "default", {
115
+ key: s.valueHash,
116
+ checked: s.selected,
117
+ columns: s.columns,
118
+ disabled: s.disabled,
119
+ item: s.item,
120
+ select: () => $(s),
121
+ unselect: () => A(s),
122
+ value: s.value
95
123
  })), 128)) : r(e.$slots, "no-data", {
96
124
  key: 1,
97
125
  loading: p.value
@@ -100,5 +128,5 @@ const X = /* @__PURE__ */ S({
100
128
  }
101
129
  });
102
130
  export {
103
- X as default
131
+ ne as default
104
132
  };
package/dist/index101.js CHANGED
@@ -1,12 +1,11 @@
1
- import { defineComponent as h, ref as y, computed as B, openBlock as v, createBlock as g, withCtx as n, renderSlot as a, normalizeProps as i, guardReactiveProps as l, createVNode as $, mergeProps as T } from "vue";
1
+ import { defineComponent as h, ref as y, computed as v, openBlock as B, createBlock as g, withCtx as n, renderSlot as a, normalizeProps as i, guardReactiveProps as l, createVNode as $, mergeProps as T } from "vue";
2
2
  import V from "./index27.js";
3
3
  /* empty css */
4
- import q from "./index37.js";
4
+ import w from "./index37.js";
5
5
  /* empty css */
6
- const L = /* @__PURE__ */ h({
6
+ const P = /* @__PURE__ */ h({
7
7
  __name: "BbSelect",
8
8
  props: {
9
- addOptions: { type: Boolean },
10
9
  allowWriting: { type: [Boolean, String], default: !0 },
11
10
  "append:icon": {},
12
11
  autocomplete: {},
@@ -45,18 +44,18 @@ const L = /* @__PURE__ */ h({
45
44
  required: { type: Boolean },
46
45
  queryDebounceTime: {},
47
46
  readonly: { type: Boolean },
48
- resetQueryOnOptionSelected: { type: Boolean },
49
47
  reverse: { type: Boolean },
50
48
  stash: { type: Boolean },
51
49
  transitionDuration: {},
52
50
  updateOnAnimationFrame: { type: Boolean }
53
51
  },
54
- emits: ["blur", "change", "click", "focus", "inactive", "input", "update:modelValue"],
52
+ emits: ["blur", "change", "click", "focus", "inactive", "input", "update:modelValue", "option:add"],
55
53
  setup(d, { emit: m }) {
56
- const r = d, t = m, p = y(!1), u = B(() => r.persistentHint || p.value), c = {
54
+ const r = d, t = m, p = y(!1), u = v(() => r.persistentHint || p.value), c = {
57
55
  onBlur: (e) => t("blur", e),
58
56
  onChange: (e) => t("change", e),
59
57
  onClick: (e) => t("click", e),
58
+ "onOption:add": (e) => t("option:add", e),
60
59
  onFocus: (e) => {
61
60
  p.value = !0, t("focus", e);
62
61
  },
@@ -66,7 +65,7 @@ const L = /* @__PURE__ */ h({
66
65
  onInput: (e) => t("input", e),
67
66
  "onUpdate:modelValue": (e) => t("update:modelValue", e)
68
67
  };
69
- return (e, w) => (v(), g(V, {
68
+ return (e, D) => (B(), g(V, {
70
69
  id: e.id,
71
70
  class: "bb-select",
72
71
  compact: e.compact,
@@ -86,9 +85,8 @@ const L = /* @__PURE__ */ h({
86
85
  a(e.$slots, "label", i(l(s)))
87
86
  ]),
88
87
  input: n(({ id: s, hasErrors: b, ariaDescribedby: f }) => [
89
- $(q, T({
88
+ $(w, T({
90
89
  id: s,
91
- "add-options": e.addOptions,
92
90
  "allow-writing": e.allowWriting,
93
91
  "append:icon": r["append:icon"],
94
92
  "aria-describedby": f,
@@ -120,7 +118,6 @@ const L = /* @__PURE__ */ h({
120
118
  "query-debounce-time": e.queryDebounceTime,
121
119
  readonly: e.readonly,
122
120
  required: e.required,
123
- "reset-query-on-option-selected": e.resetQueryOnOptionSelected,
124
121
  stash: e.stash,
125
122
  "transition-duration": e.transitionDuration,
126
123
  "update-on-animation-frame": e.updateOnAnimationFrame
@@ -171,12 +168,12 @@ const L = /* @__PURE__ */ h({
171
168
  a(e.$slots, "spinner", i(l(o)))
172
169
  ]),
173
170
  _: 2
174
- }, 1040, ["id", "add-options", "allow-writing", "append:icon", "aria-describedby", "autocomplete", "autofocus", "comma", "compact", "dependencies", "deps-debounce-time", "disabled", "enforce-coherence", "filter-by", "has-errors", "item-text", "item-value", "items", "loading", "loading-text", "max", "max-selected-labels", "model-value", "model-value-debounce-time", "multiple", "name", "no-data-text", "placeholder", "prefill", "prepend:icon", "query-debounce-time", "readonly", "required", "reset-query-on-option-selected", "stash", "transition-duration", "update-on-animation-frame"])
171
+ }, 1040, ["id", "allow-writing", "append:icon", "aria-describedby", "autocomplete", "autofocus", "comma", "compact", "dependencies", "deps-debounce-time", "disabled", "enforce-coherence", "filter-by", "has-errors", "item-text", "item-value", "items", "loading", "loading-text", "max", "max-selected-labels", "model-value", "model-value-debounce-time", "multiple", "name", "no-data-text", "placeholder", "prefill", "prepend:icon", "query-debounce-time", "readonly", "required", "stash", "transition-duration", "update-on-animation-frame"])
175
172
  ]),
176
173
  _: 3
177
174
  }, 8, ["id", "compact", "direction", "errors", "has-errors", "hide-label", "hint", "label", "label-position", "model-value", "name", "reverse", "show-hint"]));
178
175
  }
179
176
  });
180
177
  export {
181
- L as default
178
+ P as default
182
179
  };