@bexis2/bexis2-core-ui 0.4.95 → 0.4.97

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 (89) hide show
  1. package/README.md +105 -24
  2. package/dist/components/CodeEditor/CodeEditor.svelte +2 -2
  3. package/dist/components/Facets/ShowMore.svelte +4 -6
  4. package/dist/components/File/FileUploader.svelte +6 -3
  5. package/dist/components/Table/Table.svelte +31 -5
  6. package/dist/components/Table/TableContent.svelte +226 -27
  7. package/dist/components/Table/TableFilter.svelte +25 -12
  8. package/dist/components/Table/TableFilterServer.svelte +51 -6
  9. package/dist/components/Table/TablePaginationServer.svelte +27 -8
  10. package/dist/components/Table/clientDB.d.ts +22 -0
  11. package/dist/components/Table/clientDB.js +236 -0
  12. package/dist/components/Table/filter.js +21 -2
  13. package/dist/components/Table/tableWorker.d.ts +1 -0
  14. package/dist/components/Table/tableWorker.js +179 -0
  15. package/dist/components/Table/utils.d.ts +1 -2
  16. package/dist/components/Table/utils.js +64 -31
  17. package/dist/components/form/CheckboxKvPList.svelte +15 -15
  18. package/dist/components/form/CheckboxList.svelte +1 -1
  19. package/dist/components/form/DateInput.svelte +12 -1
  20. package/dist/components/form/DatePickerInput.svelte +51 -29
  21. package/dist/components/form/Dropdown.svelte +14 -3
  22. package/dist/components/form/DropdownKvP.svelte +13 -2
  23. package/dist/components/form/InputContainer.svelte +17 -15
  24. package/dist/components/form/MultiSelect.svelte +30 -29
  25. package/dist/components/form/NumberInput.svelte +12 -1
  26. package/dist/components/form/TextArea.svelte +12 -1
  27. package/dist/components/form/TextInput.svelte +12 -1
  28. package/dist/components/page/Alert.svelte +5 -1
  29. package/dist/components/page/BackToTop.svelte +3 -1
  30. package/dist/components/page/Docs.svelte +9 -2
  31. package/dist/components/page/GoToTop.svelte +14 -15
  32. package/dist/components/page/Page.svelte +50 -56
  33. package/dist/components/page/breadcrumb/BreadcrumbDataCaller.js +11 -15
  34. package/dist/components/page/menu/MenuAccountBar.svelte +1 -5
  35. package/dist/components/page/menu/MenuDataCaller.js +1 -1
  36. package/dist/components/page/menu/MenuItem.svelte +9 -7
  37. package/dist/components/page/menu/MenuSublist.svelte +7 -5
  38. package/dist/components/page/menu/SettingsBar.svelte +4 -1
  39. package/dist/components/toggle/Toggle.svelte +9 -9
  40. package/dist/css/core.ui.postcss +1 -2
  41. package/dist/services/Api.js +4 -4
  42. package/dist/services/BaseCaller.js +1 -1
  43. package/package.json +114 -114
  44. package/src/lib/components/CodeEditor/CodeEditor.svelte +4 -4
  45. package/src/lib/components/Facets/Facets.svelte +2 -2
  46. package/src/lib/components/Facets/ShowMore.svelte +4 -6
  47. package/src/lib/components/File/FileUploader.svelte +17 -14
  48. package/src/lib/components/Table/Table.svelte +32 -5
  49. package/src/lib/components/Table/TableContent.svelte +261 -38
  50. package/src/lib/components/Table/TableFilter.svelte +34 -8
  51. package/src/lib/components/Table/TableFilterServer.svelte +65 -9
  52. package/src/lib/components/Table/TablePagination.svelte +6 -2
  53. package/src/lib/components/Table/TablePaginationServer.svelte +36 -10
  54. package/src/lib/components/Table/clientDB.js +236 -0
  55. package/src/lib/components/Table/filter.ts +44 -24
  56. package/src/lib/components/Table/tableWorker.js +179 -0
  57. package/src/lib/components/Table/utils.ts +80 -46
  58. package/src/lib/components/form/Checkbox.svelte +1 -1
  59. package/src/lib/components/form/CheckboxKvPList.svelte +15 -16
  60. package/src/lib/components/form/CheckboxList.svelte +1 -1
  61. package/src/lib/components/form/DateInput.svelte +13 -2
  62. package/src/lib/components/form/DatePickerInput.svelte +51 -29
  63. package/src/lib/components/form/Dropdown.svelte +14 -3
  64. package/src/lib/components/form/DropdownKvP.svelte +13 -2
  65. package/src/lib/components/form/InputContainer.svelte +18 -17
  66. package/src/lib/components/form/MultiSelect.svelte +30 -29
  67. package/src/lib/components/form/NumberInput.svelte +21 -12
  68. package/src/lib/components/form/TextArea.svelte +13 -2
  69. package/src/lib/components/form/TextInput.svelte +13 -2
  70. package/src/lib/components/page/Alert.svelte +5 -1
  71. package/src/lib/components/page/BackToTop.svelte +3 -1
  72. package/src/lib/components/page/Docs.svelte +9 -2
  73. package/src/lib/components/page/GoToTop.svelte +14 -15
  74. package/src/lib/components/page/Notification.svelte +1 -1
  75. package/src/lib/components/page/Page.svelte +67 -78
  76. package/src/lib/components/page/breadcrumb/Breadcrumb.svelte +2 -3
  77. package/src/lib/components/page/breadcrumb/BreadcrumbDataCaller.js +11 -15
  78. package/src/lib/components/page/menu/MenuAccountBar.svelte +1 -6
  79. package/src/lib/components/page/menu/MenuDataCaller.js +1 -1
  80. package/src/lib/components/page/menu/MenuItem.svelte +10 -8
  81. package/src/lib/components/page/menu/MenuSublist.svelte +35 -41
  82. package/src/lib/components/page/menu/SettingsBar.svelte +5 -2
  83. package/src/lib/components/toggle/Toggle.svelte +28 -30
  84. package/src/lib/css/core.ui.postcss +1 -2
  85. package/src/lib/index.ts +1 -2
  86. package/src/lib/services/Api.ts +21 -20
  87. package/src/lib/services/BaseCaller.js +1 -1
  88. package/src/lib/stores/apiStores.ts +1 -5
  89. package/src/lib/stores/pageStores.ts +0 -2
@@ -41,13 +41,10 @@ export const getResizeStyles = (
41
41
  ) => {
42
42
  return `
43
43
  min-height: ${rowHeights && rowHeights[+id] ? `${rowHeights[+id].min}px` : 'auto'};
44
- max-height: ${index !== 0 && rowHeights && rowHeights[+id]
45
- ? `${rowHeights[+id].max}px`
46
- : 'auto'
47
- };
44
+ max-height: ${index !== 0 && rowHeights && rowHeights[+id] ? `${rowHeights[+id].max}px` : 'auto'};
48
45
  height: ${rowHeights && rowHeights[+id] ? `${rowHeights[+id].min}px` : 'auto'};
49
46
  `;
50
- }
47
+ };
51
48
  // Function to normalize the filters for back-end
52
49
  export const normalizeFilters = (filters: {
53
50
  [key: string]: { [key in FilterOptionsEnum]?: number | string | Date };
@@ -103,14 +100,12 @@ export const jsonToCsv = (data: string): string => {
103
100
  // Create CSV rows
104
101
  const rows = [
105
102
  headers.join(','), // Header row
106
- ...json.map((row) =>
107
- headers.map(header => escapeCsvCell(row[header])).join(',')
108
- ) // Data rows
103
+ ...json.map((row) => headers.map((header) => escapeCsvCell(row[header])).join(',')) // Data rows
109
104
  ];
110
105
 
111
106
  // Join rows with newlines
112
107
  return rows.join('\n');
113
- }
108
+ };
114
109
  // Resetting the resized columns and/or rows
115
110
  export const resetResize = (
116
111
  headerRows: any,
@@ -162,12 +157,12 @@ export const missingValuesFn = (
162
157
  const foundKey =
163
158
  typeof key === 'number' && key.toString().includes('e')
164
159
  ? Object.keys(missingValues).find((item) => {
165
- return (item as string).toLowerCase() === key.toString().toLowerCase();
166
- })
160
+ return (item as string).toLowerCase() === key.toString().toLowerCase();
161
+ })
167
162
  : typeof key === 'string' && parseInt(key).toString().length !== key.length && new Date(key)
168
163
  ? Object.keys(missingValues).find(
169
- (item) => new Date(item).getTime() === new Date(key).getTime()
170
- )
164
+ (item) => new Date(item).getTime() === new Date(key).getTime()
165
+ )
171
166
  : key in missingValues
172
167
  ? key
173
168
  : undefined;
@@ -180,13 +175,13 @@ export const updateTable = async (
180
175
  pageIndex: number,
181
176
  server: ServerConfig | undefined,
182
177
  filters: {
183
- [key: string]: { [key in FilterOptionsEnum]?: number | string | Date }
178
+ [key: string]: { [key in FilterOptionsEnum]?: number | string | Date };
184
179
  },
185
180
  data: Writable<any[]>,
186
181
  serverItems: Writable<number> | undefined,
187
182
  columns: Columns | undefined,
188
183
  dispatch: any,
189
- order: OrderBy[] = [],
184
+ order: OrderBy[] = []
190
185
  ) => {
191
186
  const { baseUrl, entityId, versionId, sendModel = new Send() } = server ?? {};
192
187
 
@@ -202,7 +197,7 @@ export const updateTable = async (
202
197
  // remove %%% from the columns object
203
198
  if (sendModel.order) {
204
199
  sendModel.order.forEach((order) => {
205
- if (order.column.includes("%%%")) {
200
+ if (order.column.includes('%%%')) {
206
201
  const newKey = order.column.replaceAll('%%%', '.');
207
202
  order.column = newKey;
208
203
  }
@@ -227,22 +222,52 @@ export const updateTable = async (
227
222
  throw new Error('Failed to fetch data');
228
223
  }
229
224
 
230
- const response: Receive = await fetchData.json();
225
+ // 1. Get the raw text of the response instead of parsing it automatically
226
+ const rawText = await fetchData.text();
227
+
228
+ // 2. Parse it with a reviver function that targets large integers
229
+ const response: Receive = JSON.parse(rawText, (key, value, context) => {
230
+ // If the parser thinks it's a number, but we have the raw source text
231
+ if (context && context.source && typeof value === 'number') {
232
+ // Check if the number exceeds JavaScript's safe integer limit
233
+ if (!Number.isSafeInteger(value)) {
234
+ // Return it natively as a JavaScript BigInt (e.g., 9223372036854775806n)
235
+ return BigInt(context.source);
236
+ }
237
+ }
238
+ return value;
239
+ });
240
+
241
+ const rawCount = (response as any).count;
242
+ const hasRawCount =
243
+ rawCount !== undefined && rawCount !== null && String(rawCount).trim().length > 0;
244
+ const parsedServerCount = hasRawCount
245
+ ? typeof rawCount === 'number'
246
+ ? rawCount
247
+ : Number(String(rawCount).replace(/[^0-9.-]/g, ''))
248
+ : Number.NaN;
249
+ const hasServerCount = hasRawCount && Number.isFinite(parsedServerCount) && parsedServerCount >= 0;
250
+ const normalizedCount = hasServerCount
251
+ ? parsedServerCount
252
+ : Array.isArray(response.data)
253
+ ? response.data.length
254
+ : 0;
255
+ // console.log('Server response', response);
231
256
 
232
257
  // Format server columns to the client columns
233
258
  if (response.columns !== undefined) {
234
- console.log('Server columns', response.columns);
259
+ //console.log('Server columns', response.columns);
235
260
  columns = convertServerColumns(response.columns, columns);
236
261
 
237
262
  const clientCols = response.columns.reduce((acc, col) => {
238
- console.log(col.key, col.column);
263
+ // console.log(col.key, col.column);
239
264
  // replace the . with empty string
240
265
  //const key = col.key.replaceAll('.' ,'');
241
266
  ///console.log(key, col.column);
242
267
  // set the key to the columns object
243
- col.column = col.column.replaceAll('.', "%%%");
244
- col.key = col.key.replaceAll('.', "%%%");
245
- acc[col.key] = col.column
268
+ col.column = col.column.replaceAll('.', '%%%');
269
+ col.key = col.key.replaceAll('.', '%%%');
270
+ acc[col.key] = col.column;
246
271
  //acc[col.column] = col.column;
247
272
 
248
273
  return acc;
@@ -253,23 +278,24 @@ export const updateTable = async (
253
278
  response.data.forEach((row, index) => {
254
279
  const tmp: { [key: string]: any } = {};
255
280
  Object.keys(row).forEach((key) => {
256
- tmp[clientCols[key.replaceAll('.', "%%%") ]] = row[key]
281
+ tmp[clientCols[key.replaceAll('.', '%%%')]] = row[key];
257
282
  });
258
283
  tmpArr.push(tmp);
259
284
  });
260
- dispatch('fetch', columns);
285
+ dispatch('fetch', {
286
+ columns,
287
+ count: hasServerCount ? parsedServerCount : tmpArr.length
288
+ });
289
+ serverItems?.set(hasServerCount ? parsedServerCount : tmpArr.length);
261
290
  data.set(tmpArr);
262
- console.log('Server data', tmpArr);
291
+ // console.log('Server data', tmpArr);
263
292
  return data;
264
293
  }
265
294
 
266
- serverItems?.set(response.count);
267
- console.log('Server data updated');
268
-
269
-
270
- // log the columns object
271
- console.log(response);
272
- return response;
295
+ serverItems?.set(normalizedCount);
296
+ // If backend does not provide column metadata, still render returned rows.
297
+ data.set(response.data ?? []);
298
+ return data;
273
299
  };
274
300
  // Function to convert server data to client data
275
301
  export const convertServerColumns = (
@@ -316,17 +342,17 @@ export const convertServerColumns = (
316
342
  }
317
343
 
318
344
  if (columns && col.column in columns) {
319
- columnsConfig[col.column.replaceAll('.', "%%%")] = {
320
- ...columns[col.column.replaceAll('.', "%%%")],
345
+ columnsConfig[col.column.replaceAll('.', '%%%')] = {
346
+ ...columns[col.column.replaceAll('.', '%%%')],
321
347
  instructions
322
348
  };
323
349
  } else {
324
- columnsConfig[col.column.replaceAll('.', "%%%") ] = {
350
+ columnsConfig[col.column.replaceAll('.', '%%%')] = {
325
351
  instructions
326
352
  };
327
353
  }
328
354
  });
329
- console.log('Columns config', columnsConfig);
355
+ // console.log('Columns config', columnsConfig);
330
356
  return columnsConfig;
331
357
  };
332
358
  // Calculates the maximum height of the cells in each row
@@ -340,6 +366,8 @@ export const getMaxCellHeightInRow = (
340
366
  ) => {
341
367
  if (!tableRef || resizable === 'columns' || resizable === 'none') return;
342
368
 
369
+ const measuredHeights: { [key: number]: { max: number; min: number } } = {};
370
+
343
371
  tableRef.querySelectorAll('tbody tr').forEach((row, index) => {
344
372
  const cells = row.querySelectorAll('td');
345
373
 
@@ -357,17 +385,23 @@ export const getMaxCellHeightInRow = (
357
385
  }
358
386
  });
359
387
 
360
- rowHeights.update((rh) => {
361
- const id = +row.id.split(`${tableId}-row-`)[1];
362
- return {
363
- ...rh,
364
- [id]: {
365
- max: maxHeight - 24,
366
- min: Math.max(minHeight - 24, rowHeight ?? 20)
367
- }
388
+ const id = +row.id.split(`${tableId}-row-`)[1];
389
+ if (Number.isFinite(id)) {
390
+ measuredHeights[id] = {
391
+ max: maxHeight - 24,
392
+ min: Math.max(minHeight - 24, rowHeight ?? 20)
368
393
  };
369
- });
394
+ }
370
395
  });
396
+
397
+ if (Object.keys(measuredHeights).length === 0) {
398
+ return;
399
+ }
400
+
401
+ rowHeights.update((rh) => ({
402
+ ...rh,
403
+ ...measuredHeights
404
+ }));
371
405
  };
372
406
  // Calculates the minimum width of the cells in each column
373
407
  export const getMinCellWidthInColumn = (
@@ -394,4 +428,4 @@ export const getMinCellWidthInColumn = (
394
428
  });
395
429
  return cw;
396
430
  });
397
- };
431
+ };
@@ -9,7 +9,7 @@
9
9
  export let invalid: boolean;
10
10
  export let required: boolean;
11
11
  export let feedback: [];
12
- export let description: string = '';
12
+ export let description: string = '';
13
13
  </script>
14
14
 
15
15
  <InputContainer {label} {feedback} {required} {description}>
@@ -12,23 +12,22 @@
12
12
 
13
13
  let required = false;
14
14
  export let feedback: [];
15
-
16
15
  </script>
17
16
 
18
17
  <InputContainer {id} label={title} {feedback} {required} {help} {description}>
19
- <div class="flex gap-2" class:flex-col={vertical} >
20
- {#each source as item}
21
- <label class="flex items-center space-x-2" for={item.key}>
22
- <input
23
- class="checkbox"
24
- type="checkbox"
25
- bind:group={target}
26
- checked={item.key}
27
- value={item.key}
28
- id={item.key}
29
- />
30
- <p>{item.value}</p>
31
- </label>
32
- {/each}
33
- </div>
18
+ <div class="flex gap-2" class:flex-col={vertical}>
19
+ {#each source as item}
20
+ <label class="flex items-center space-x-2" for={item.key}>
21
+ <input
22
+ class="checkbox"
23
+ type="checkbox"
24
+ bind:group={target}
25
+ checked={item.key}
26
+ value={item.key}
27
+ id={item.key}
28
+ />
29
+ <p>{item.value}</p>
30
+ </label>
31
+ {/each}
32
+ </div>
34
33
  </InputContainer>
@@ -14,7 +14,7 @@
14
14
  <InputContainer label={title} {feedback} {required} {description}>
15
15
  {#each source as item}
16
16
  <label class="flex items-center space-x-2" for={item}>
17
- <input class="checkbox" type="checkbox" bind:group={target} value={item} id={item}/>
17
+ <input class="checkbox" type="checkbox" bind:group={target} value={item} id={item} />
18
18
  <p>{item}</p>
19
19
  </label>
20
20
  {/each}
@@ -10,12 +10,23 @@
10
10
  export let feedback: string[] = [''];
11
11
  export let help = false;
12
12
  export let disabled: boolean = false;
13
- export let description : string = '';
13
+ export let description: string = '';
14
14
  export let showDescription: boolean = false;
15
15
  export let showIcon: boolean = false;
16
16
  </script>
17
17
 
18
- <InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
18
+ <InputContainer
19
+ {id}
20
+ {label}
21
+ {feedback}
22
+ {required}
23
+ {help}
24
+ {description}
25
+ {showDescription}
26
+ {showIcon}
27
+ on:showDescription
28
+ on:hideDescription
29
+ >
19
30
  <input
20
31
  {id}
21
32
  class="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400"
@@ -39,33 +39,55 @@
39
39
  }
40
40
  </script>
41
41
 
42
- <InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
43
- <!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
44
- <div class="relative w-full">
45
-
46
- <SveltyPicker
47
- {mode}
48
- name={label}
49
- {format}
50
- {displayFormat}
51
- {initialDate}
52
- bind:value
53
- on:input
54
- on:change
55
- {disabled}
56
- {placeholder}
57
- manualInput={true}
58
-
59
- inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid ? 'input-success' : ''} {invalid ? 'input-error' : ''}"
60
- />
61
- {#if mode === 'time'}
62
- <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
63
- {:else if mode === 'date' }
64
- <Fa icon={faCalendar} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
65
- {:else if mode === 'datetime'}
66
- <Fa icon={faCalendar} class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
67
- <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
68
- {/if}
69
- </div>
70
-
42
+ <InputContainer
43
+ {id}
44
+ {label}
45
+ {feedback}
46
+ {required}
47
+ {help}
48
+ {description}
49
+ {showDescription}
50
+ {showIcon}
51
+ on:showDescription
52
+ on:hideDescription
53
+ >
54
+ <!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
55
+ <div class="relative w-full">
56
+ <SveltyPicker
57
+ {mode}
58
+ name={label}
59
+ {format}
60
+ {displayFormat}
61
+ {initialDate}
62
+ bind:value
63
+ on:input
64
+ on:change
65
+ {disabled}
66
+ {placeholder}
67
+ manualInput={true}
68
+ inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid
69
+ ? 'input-success'
70
+ : ''} {invalid ? 'input-error' : ''}"
71
+ />
72
+ {#if mode === 'time'}
73
+ <Fa
74
+ icon={faClock}
75
+ class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300"
76
+ />
77
+ {:else if mode === 'date'}
78
+ <Fa
79
+ icon={faCalendar}
80
+ class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300"
81
+ />
82
+ {:else if mode === 'datetime'}
83
+ <Fa
84
+ icon={faCalendar}
85
+ class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300"
86
+ />
87
+ <Fa
88
+ icon={faClock}
89
+ class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300"
90
+ />
91
+ {/if}
92
+ </div>
71
93
  </InputContainer>
@@ -20,16 +20,27 @@
20
20
 
21
21
  function updatedSelectedValue(selection) {
22
22
  if (selection != null) {
23
- selected = selection;
23
+ selected = selection;
24
24
  }
25
25
  }
26
26
 
27
27
  function updatedTarget(value) {
28
- target = value;
28
+ target = value;
29
29
  }
30
30
  </script>
31
31
 
32
- <InputContainer {id} label={title} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
32
+ <InputContainer
33
+ {id}
34
+ label={title}
35
+ {feedback}
36
+ {required}
37
+ {help}
38
+ {description}
39
+ {showDescription}
40
+ {showIcon}
41
+ on:showDescription
42
+ on:hideDescription
43
+ >
33
44
  <select
34
45
  {id}
35
46
  class="select variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400"
@@ -11,7 +11,7 @@
11
11
  export let required = false;
12
12
  export let complexTarget = false;
13
13
  export let help = false;
14
- export let description = '';
14
+ export let description = '';
15
15
  export let showDescription = false;
16
16
  export let showIcon = false;
17
17
  $: selected = null;
@@ -38,7 +38,18 @@
38
38
  }
39
39
  </script>
40
40
 
41
- <InputContainer {id} label={title} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
41
+ <InputContainer
42
+ {id}
43
+ label={title}
44
+ {feedback}
45
+ {required}
46
+ {help}
47
+ {description}
48
+ {showDescription}
49
+ {showIcon}
50
+ on:showDescription
51
+ on:hideDescription
52
+ >
42
53
  <select
43
54
  {id}
44
55
  class="select variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400"
@@ -9,7 +9,7 @@
9
9
  export let required: boolean;
10
10
  export let feedback: string[];
11
11
  export let help: boolean = false;
12
- export let description : string = '';
12
+ export let description: string = '';
13
13
  export let showDescription: boolean = false;
14
14
  export let showIcon: boolean = false;
15
15
 
@@ -23,7 +23,6 @@
23
23
  // dispatch an event to show the description
24
24
  dispatch('showDescription', { id, description });
25
25
  }
26
-
27
26
  }
28
27
 
29
28
  export function onMouseOut() {
@@ -44,33 +43,35 @@
44
43
  on:focus={onMouseOver}
45
44
  on:mouseout={onMouseOut}
46
45
  on:blur={onMouseOut}
47
- on:focusin={onMouseOver}
48
- on:focusout={onMouseOut}
49
-
46
+ on:focusin={onMouseOver}
47
+ on:focusout={onMouseOut}
50
48
  >
51
- <label class="label w-full flex" for="{id}">
49
+ <label class="label w-full flex" for={id}>
52
50
  <span class="grow"
53
51
  >{label}
54
- {#if required} <span class="text-xs text-red-600">*</span> {/if}
52
+ {#if required}
53
+ <span class="text-xs text-red-600">*</span>
54
+ {/if}
55
55
  </span>
56
56
  {#if description && showIcon}
57
- <button class="badge " on:click={()=>showDescription = !showDescription}><Fa icon={faQuestion} /></button>
57
+ <button class="badge" on:click={() => (showDescription = !showDescription)}
58
+ ><Fa icon={faQuestion} /></button
59
+ >
58
60
  {/if}
59
61
  </label>
60
62
 
61
-
62
63
  {#if description && showDescription}
63
- <div class="card text-sm text-gray-500 p-2 mb-2">{@html description}</div>
64
+ <div class="card text-sm text-gray-500 p-2 mb-2">{@html description}</div>
64
65
  {/if}
65
66
  <slot />
66
67
  <div class="min-h-5">
67
- <span class="text-xs text-error-600 ">
68
- {#if feedback}
69
- <ul>
70
- {#each feedback as message}
71
- <li>{message}</li>
72
- {/each}
73
- </ul>
68
+ <span class="text-xs text-error-600">
69
+ {#if feedback}
70
+ <ul>
71
+ {#each feedback as message}
72
+ <li>{message}</li>
73
+ {/each}
74
+ </ul>
74
75
  {/if}
75
76
  </span>
76
77
  </div>
@@ -32,10 +32,10 @@
32
32
 
33
33
  $: value = '';
34
34
  $: updateTarget(value);
35
- $: target, setValue(target);
35
+ $: (target, setValue(target));
36
36
 
37
37
  let groupBy;
38
- $: groupBy = itemGroup ? (item) => item[itemGroup] : undefined;
38
+ $: groupBy = itemGroup ? (item) => item[itemGroup] : undefined;
39
39
 
40
40
  const dispatch = createEventDispatcher();
41
41
 
@@ -47,8 +47,6 @@
47
47
  return;
48
48
  }
49
49
 
50
-
51
-
52
50
  //console.log('update');
53
51
  //different cases
54
52
  //a) source is complex model is simple return array
@@ -151,28 +149,23 @@
151
149
  if (!isMulti) {
152
150
  //console.log("onmount",complexSource,complexTarget,value,target)
153
151
  if (!complexSource && !complexTarget) {
154
-
155
-
156
- if(groupBy) { // if groupby is set, the value needs to be set as object with label and value, otherwise the select component does not recognize the value
152
+ if (groupBy) {
153
+ // if groupby is set, the value needs to be set as object with label and value, otherwise the select component does not recognize the value
154
+ value = {
155
+ value: t,
156
+ label: t
157
+ };
158
+ } else // if there is no groupby, the value can be set as simple value, otherwise the select component does not recognize the value
159
+ {
160
+ if (t === null || t === undefined || t === '') {
161
+ value = '';
162
+ } else {
157
163
  value = {
158
- value: t,
159
- label: t
160
- };
164
+ value: t,
165
+ label: t
166
+ };
161
167
  }
162
- else // if there is no groupby, the value can be set as simple value, otherwise the select component does not recognize the value
163
- {
164
- if(t === null || t === undefined || t === '') {
165
- value = ''
166
- }
167
- else
168
- {
169
- value = {
170
- value: t,
171
- label: t
172
- };
173
- }
174
- }
175
-
168
+ }
176
169
  }
177
170
 
178
171
  if (complexSource && complexTarget) {
@@ -304,13 +297,22 @@
304
297
  target = '';
305
298
  }
306
299
 
307
- dispatch('clear', e)
308
-
300
+ dispatch('clear', e);
309
301
  }
310
-
311
302
  </script>
312
303
 
313
- <InputContainer {id} label={title} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
304
+ <InputContainer
305
+ {id}
306
+ label={title}
307
+ {feedback}
308
+ {required}
309
+ {help}
310
+ {description}
311
+ {showDescription}
312
+ {showIcon}
313
+ on:showDescription
314
+ on:hideDescription
315
+ >
314
316
  <Select
315
317
  {id}
316
318
  items={source}
@@ -320,7 +322,6 @@
320
322
  multiple={isMulti}
321
323
  bind:value
322
324
  {placeholder}
323
-
324
325
  hasError={invalid}
325
326
  {loading}
326
327
  {clearable}