@rkosafo/cai.components 0.0.61 → 0.0.63
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/forms/FormSelect/FormSelect.svelte +3 -2
- package/dist/layout/ComponentCanvas/index.d.ts +2 -3
- package/dist/layout/ComponentCanvas/index.js +2 -3
- package/dist/ui/datatable/Datatable.svelte +0 -10
- package/dist/ui/datatable/Datatable.svelte.d.ts +1 -2
- package/dist/ui/datatable/index.d.ts +3 -2
- package/dist/ui/datatable/index.js +6 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/tableHeightUtils.d.ts +26 -0
- package/dist/utils/tableHeightUtils.js +45 -0
- package/package.json +1 -1
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
function handleChange(e: any) {
|
|
29
29
|
if (!e) return;
|
|
30
30
|
if (!multiple) {
|
|
31
|
-
setData({ ...$data, [name]: e.value });
|
|
31
|
+
setData({ ...$data, [name]: e.value || e.id });
|
|
32
32
|
} else {
|
|
33
|
-
const d = e.map((a: any) => a.value);
|
|
33
|
+
const d = e.map((a: any) => a.value || a.id);
|
|
34
34
|
// console.log({ d });
|
|
35
35
|
setData({ ...$data, [name]: d });
|
|
36
36
|
}
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
{hasError}
|
|
66
66
|
minHeight={40}
|
|
67
67
|
hasSuccess={isSuccess}
|
|
68
|
+
{placeholder}
|
|
68
69
|
{...otherProps}
|
|
69
70
|
/>
|
|
70
71
|
<!-- {/key} -->
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Canvas as ComponentCanvas, addMapper as addComponentMapper, removeMapper as removeComponentMapper };
|
|
1
|
+
export { default as ComponentCanvas } from './Canvas.svelte';
|
|
2
|
+
export { addMapper as addComponentMapper, removeMapper as removeComponentMapper } from './ComponentRenderer.svelte';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Canvas as ComponentCanvas, addMapper as addComponentMapper, removeMapper as removeComponentMapper };
|
|
1
|
+
export { default as ComponentCanvas } from './Canvas.svelte';
|
|
2
|
+
export { addMapper as addComponentMapper, removeMapper as removeComponentMapper } from './ComponentRenderer.svelte';
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
export function refetchDatatable(params?: TableFilter) {
|
|
3
|
-
window.dispatchEvent(
|
|
4
|
-
new CustomEvent('reFetchTableData', {
|
|
5
|
-
detail: params
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
}
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
1
|
<script lang="ts">
|
|
12
2
|
import { goto } from '$app/navigation';
|
|
13
3
|
import { page } from '$app/state';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { type DatatableProps, type TableFilter } from '../../index.js';
|
|
1
|
+
import { type DatatableProps } from '../../index.js';
|
|
3
2
|
declare const Datatable: import("svelte").Component<DatatableProps<any>, {}, "read" | "query">;
|
|
4
3
|
type Datatable = ReturnType<typeof Datatable>;
|
|
5
4
|
export default Datatable;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { Datatable
|
|
1
|
+
import type { TableFilter } from '../../index.js';
|
|
2
|
+
export { default as Datatable } from './Datatable.svelte';
|
|
3
|
+
export declare function refetchDatatable(params?: TableFilter): void;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { default as Datatable } from './Datatable.svelte';
|
|
2
|
+
export function refetchDatatable(params) {
|
|
3
|
+
window.dispatchEvent(new CustomEvent('reFetchTableData', {
|
|
4
|
+
detail: params
|
|
5
|
+
}));
|
|
6
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ClassValue } from 'clsx';
|
|
|
2
2
|
export { default as Popper } from './Popper.svelte';
|
|
3
3
|
export * from './closeButton/index.js';
|
|
4
4
|
export { trapFocus } from './action.js';
|
|
5
|
+
export * from './tableHeightUtils.js';
|
|
5
6
|
import type { ICaseCategory } from '../index.js';
|
|
6
7
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
7
8
|
export declare function saveToLocalStorage<T>(key: string, data: T): void;
|
package/dist/utils/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
6
6
|
export { default as Popper } from './Popper.svelte';
|
|
7
7
|
export * from './closeButton/index.js';
|
|
8
8
|
export { trapFocus } from './action.js';
|
|
9
|
+
export * from './tableHeightUtils.js';
|
|
9
10
|
import dayjs from 'dayjs';
|
|
10
11
|
export function cn(...inputs) {
|
|
11
12
|
return twMerge(clsx(inputs));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface TableHeightConfig {
|
|
2
|
+
headerOffset?: number;
|
|
3
|
+
footerOffset?: number;
|
|
4
|
+
additionalOffset?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Calculate table height based on window dimensions and offsets
|
|
8
|
+
*/
|
|
9
|
+
export declare function calculateTableHeight(config?: TableHeightConfig): number;
|
|
10
|
+
/**
|
|
11
|
+
* Create a reactive table height store that updates on window resize
|
|
12
|
+
*/
|
|
13
|
+
export declare function createTableHeightStore(config?: TableHeightConfig): {
|
|
14
|
+
readonly height: number;
|
|
15
|
+
update: () => void;
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Get table height for specific use cases with predefined offsets
|
|
20
|
+
*/
|
|
21
|
+
export declare const tableHeightPresets: {
|
|
22
|
+
default: () => number;
|
|
23
|
+
compact: () => number;
|
|
24
|
+
spacious: () => number;
|
|
25
|
+
custom: (config: TableHeightConfig) => number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const defaultConfig = {
|
|
2
|
+
headerOffset: 200,
|
|
3
|
+
footerOffset: 70,
|
|
4
|
+
additionalOffset: 0
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Calculate table height based on window dimensions and offsets
|
|
8
|
+
*/
|
|
9
|
+
export function calculateTableHeight(config = {}) {
|
|
10
|
+
const { headerOffset, footerOffset, additionalOffset } = { ...defaultConfig, ...config };
|
|
11
|
+
return window.innerHeight - headerOffset - footerOffset - additionalOffset;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a reactive table height store that updates on window resize
|
|
15
|
+
*/
|
|
16
|
+
export function createTableHeightStore(config = {}) {
|
|
17
|
+
let height = calculateTableHeight(config);
|
|
18
|
+
const updateHeight = () => {
|
|
19
|
+
height = calculateTableHeight(config);
|
|
20
|
+
};
|
|
21
|
+
// Initialize and set up resize listener
|
|
22
|
+
if (typeof window !== 'undefined') {
|
|
23
|
+
window.addEventListener('resize', updateHeight);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
get height() {
|
|
27
|
+
return height;
|
|
28
|
+
},
|
|
29
|
+
update: updateHeight,
|
|
30
|
+
dispose: () => {
|
|
31
|
+
if (typeof window !== 'undefined') {
|
|
32
|
+
window.removeEventListener('resize', updateHeight);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get table height for specific use cases with predefined offsets
|
|
39
|
+
*/
|
|
40
|
+
export const tableHeightPresets = {
|
|
41
|
+
default: () => calculateTableHeight(),
|
|
42
|
+
compact: () => calculateTableHeight({ headerOffset: 150, footerOffset: 50 }),
|
|
43
|
+
spacious: () => calculateTableHeight({ headerOffset: 250, footerOffset: 100 }),
|
|
44
|
+
custom: (config) => calculateTableHeight(config)
|
|
45
|
+
};
|