@streamscloud/kit 0.39.0 → 0.40.1
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/core/utils/filter-helper.d.ts +8 -0
- package/dist/core/utils/filter-helper.js +25 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/styles/_semantic.scss +1 -0
- package/dist/ui/table/table-cells/table-image-cell.svelte +12 -0
- package/dist/ui/table/table-cells/table-image-cell.svelte.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class FilterHelper {
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether `filters` differs from its empty/default state.
|
|
4
|
+
* Strings are compared trimmed; arrays and any key present in `empty` via {@link Utils.areEqual} (deep);
|
|
5
|
+
* a key absent from `empty` is considered applied when its value isn't `null`/`undefined`.
|
|
6
|
+
*/
|
|
7
|
+
static isApplied<T extends Record<string, unknown>>(filters: T, empty?: Partial<T>): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Utils } from './utils';
|
|
2
|
+
export class FilterHelper {
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether `filters` differs from its empty/default state.
|
|
5
|
+
* Strings are compared trimmed; arrays and any key present in `empty` via {@link Utils.areEqual} (deep);
|
|
6
|
+
* a key absent from `empty` is considered applied when its value isn't `null`/`undefined`.
|
|
7
|
+
*/
|
|
8
|
+
static isApplied(filters, empty = {}) {
|
|
9
|
+
const keys = new Set([...Object.keys(filters), ...Object.keys(empty)]);
|
|
10
|
+
return [...keys].some((key) => {
|
|
11
|
+
const value = filters[key];
|
|
12
|
+
const probe = value ?? empty[key];
|
|
13
|
+
if (typeof probe === 'string') {
|
|
14
|
+
return (value ?? '').trim() !== (empty[key] ?? '').trim();
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(probe)) {
|
|
17
|
+
return !Utils.areEqual(value ?? [], empty[key] ?? []);
|
|
18
|
+
}
|
|
19
|
+
if (key in empty) {
|
|
20
|
+
return !Utils.areEqual(value, empty[key]);
|
|
21
|
+
}
|
|
22
|
+
return value !== null && value !== undefined;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -5,6 +5,7 @@ export * from './base64-serializer';
|
|
|
5
5
|
export * from './browser';
|
|
6
6
|
export * from './date-helper';
|
|
7
7
|
export * from './dom-helper';
|
|
8
|
+
export * from './filter-helper';
|
|
8
9
|
export * from './href-validator';
|
|
9
10
|
export * from './html-helper';
|
|
10
11
|
export * from './image-preloader';
|
package/dist/core/utils/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './base64-serializer';
|
|
|
5
5
|
export * from './browser';
|
|
6
6
|
export * from './date-helper';
|
|
7
7
|
export * from './dom-helper';
|
|
8
|
+
export * from './filter-helper';
|
|
8
9
|
export * from './href-validator';
|
|
9
10
|
export * from './html-helper';
|
|
10
11
|
export * from './image-preloader';
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
--sc-kit--color--bg--active: light-dark(#eef2f8, #{$color-dark-600});
|
|
17
17
|
--sc-kit--color--bg--menu-active: light-dark(#{$color-blue-50}, #{$color-dark-500});
|
|
18
18
|
--sc-kit--color--bg--images: light-dark(#{$color-neutral-300}, #{$color-dark-50});
|
|
19
|
+
--sc-kit--color--bg--images-subtle: light-dark(#{$color-neutral-100}, #{$color-dark-50});
|
|
19
20
|
|
|
20
21
|
// ============================================================
|
|
21
22
|
// COLOR — TEXT
|
|
@@ -32,7 +32,18 @@ const getValueForColumn = (column, item) => (column.valueFactory ? column.valueF
|
|
|
32
32
|
{/if}
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
+
<!--
|
|
36
|
+
@component
|
|
37
|
+
Image cell for table rows. Renders one of several image layouts depending on `column.format`.
|
|
38
|
+
|
|
39
|
+
### CSS Custom Properties
|
|
40
|
+
| Property | Description | Default |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `--sc-kit--table-image-cell--image--background` | Background behind a `square-contain` image (letterboxing) | `var(--sc-kit--color--bg--images-subtle)` |
|
|
43
|
+
-->
|
|
44
|
+
|
|
35
45
|
<style>.table-image-cell {
|
|
46
|
+
--_table-image-cell--image--background: var(--sc-kit--table-image-cell--image--background, var(--sc-kit--color--bg--images-subtle));
|
|
36
47
|
display: flex;
|
|
37
48
|
height: 3.125em;
|
|
38
49
|
min-height: 3.125em;
|
|
@@ -60,6 +71,7 @@ const getValueForColumn = (column, item) => (column.valueFactory ? column.valueF
|
|
|
60
71
|
}
|
|
61
72
|
.table-image-cell__image--contain {
|
|
62
73
|
--sc-kit--image--object-fit: contain;
|
|
74
|
+
--sc-kit--image--background: var(--_table-image-cell--image--background);
|
|
63
75
|
height: var(--_table-image-cell--cover-height);
|
|
64
76
|
}
|
|
65
77
|
.table-image-cell__image--cover {
|
|
@@ -32,6 +32,14 @@ interface $$IsomorphicComponent {
|
|
|
32
32
|
}>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
33
33
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Image cell for table rows. Renders one of several image layouts depending on `column.format`.
|
|
37
|
+
*
|
|
38
|
+
* ### CSS Custom Properties
|
|
39
|
+
* | Property | Description | Default |
|
|
40
|
+
* |---|---|---|
|
|
41
|
+
* | `--sc-kit--table-image-cell--image--background` | Background behind a `square-contain` image (letterboxing) | `var(--sc-kit--color--bg--images-subtle)` |
|
|
42
|
+
*/
|
|
35
43
|
declare const TableImageCell: $$IsomorphicComponent;
|
|
36
44
|
type TableImageCell<T extends {
|
|
37
45
|
id: string;
|