@likable-hair/svelte 0.0.54 → 0.0.57

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.
@@ -4,79 +4,70 @@
4
4
  export let headers = undefined, items = undefined, backgroundColor = "rgba(255,255,255,0)", headerColor = "rgba(0,0,0,0.05)", rowSeparatorColor = headerColor, headerHeight = "30px", rowHeight = "70px", minWidth = undefined, height = "100%", width = "100%";
5
5
  </script>
6
6
 
7
- {#if !!items && Array.isArray(items) }
7
+ {#if !!items && Array.isArray(items)}
8
8
  <div class="container" style:height style:width>
9
- <table
10
- style:background-color={backgroundColor}
11
- style:width="100%"
12
- style:min-width={minWidth}
13
- >
14
- <thead
15
- style:background-color={headerColor}
16
- style:height={headerHeight}
17
- >
18
- {#each headers as head}
19
- <th
20
- style:width={head.width}
21
- style:min-width={head.minWidth}
22
- >
23
- {head.label}
24
- </th>
25
- {/each}
26
- {#if $$slots.appendLastColumn}
27
- <th></th>
28
- {/if}
29
- </thead>
30
- <tbody>
31
- {#each items as item, i}
32
- <tr
33
- style:border-color={rowSeparatorColor}
34
- style:height={rowHeight}
35
- >
36
- {#each headers as header , j}
37
- <td>
38
- {#if header.type=='custom'}
39
- <slot
40
- name="customColumn"
41
- index={i}
42
- columnIndex={j}
43
- header={header}
44
- item={item}
45
- ></slot>
46
- {:else if header.type=='date'}
47
- {dateToString(item[header.value], 'dayAndHours', 'it')}
48
- {:else}
49
- {item[header.value]}
50
- {/if}
51
- </td>
52
- {/each}
53
- {#if $$slots.appendLastColumn}
54
- <td>
55
- <slot name="appendLastColumn" index={i} item={item}></slot>
56
- </td>
57
- {/if}
58
- </tr>
59
- {/each}
60
- </tbody>
61
- </table>
9
+ <table
10
+ style:background-color={backgroundColor}
11
+ style:width="100%"
12
+ style:min-width={minWidth}
13
+ >
14
+ <thead style:background-color={headerColor} style:height={headerHeight}>
15
+ {#each headers as head}
16
+ <th style:width={head.width} style:min-width={head.minWidth}>
17
+ {head.label}
18
+ </th>
19
+ {/each}
20
+ {#if $$slots.appendLastColumn}
21
+ <th />
22
+ {/if}
23
+ </thead>
24
+ <tbody>
25
+ {#each items as item, i}
26
+ <tr style:border-color={rowSeparatorColor} style:height={rowHeight}>
27
+ {#each headers as header, j}
28
+ <td>
29
+ {#if header.type == "custom"}
30
+ <slot
31
+ name="customColumn"
32
+ index={i}
33
+ columnIndex={j}
34
+ {header}
35
+ {item}
36
+ />
37
+ {:else if header.type == "date"}
38
+ {dateToString(item[header.value], "dayAndHours", "it")}
39
+ {:else}
40
+ {item[header.value]}
41
+ {/if}
42
+ </td>
43
+ {/each}
44
+ {#if $$slots.appendLastColumn}
45
+ <td>
46
+ <slot name="appendLastColumn" index={i} {item} />
47
+ </td>
48
+ {/if}
49
+ </tr>
50
+ {/each}
51
+ </tbody>
52
+ </table>
62
53
  </div>
63
54
  {/if}
64
55
 
65
56
  <style>
66
- table {
67
- border-collapse: collapse;
68
- width: 100%;
69
- }
70
- th {
71
- text-align: start;
72
- padding-left: 10px;
73
- min-width: 100px;
74
- }
75
- td {
76
- padding-left: 10px;
77
- }
78
- tr:not(:first-child) {
79
- border: solid;
80
- border-width: 2px 0;
81
- }
57
+ table {
58
+ border-collapse: collapse;
59
+ width: 100%;
60
+ }
61
+ th {
62
+ text-align: start;
63
+ padding-left: 10px;
64
+ min-width: 100px;
65
+ }
66
+ td {
67
+ padding-left: 10px;
68
+ }
69
+ tr:not(:first-child) {
70
+ border: solid;
71
+ border-width: 2px 0;
72
+ }
82
73
  </style>
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  export declare type Header = {
3
3
  value: string;
4
4
  label: string;
5
- type: 'boolean' | 'string' | 'number' | 'date' | 'custom';
5
+ type: "boolean" | "string" | "number" | "date" | "custom";
6
6
  width?: string;
7
7
  minWidth?: string;
8
8
  data?: {
@@ -1,6 +1,6 @@
1
1
  <script context="module" ></script>
2
2
 
3
- <script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", maxWidth = undefined,
3
+ <script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", height = "auto", maxWidth = undefined,
4
4
  // textfield
5
5
  textFieldLabel = "", textFieldPlaceholder = "", textFieldColor = null, textFieldVariant = 'boxed', textFieldMaxWidth = "min(100px, 90%)", textFieldMinWidth = undefined, textFieldHeight = "auto", textFieldTextColor = "black", textFieldBorderWeight = "2px", textFieldBorderRadius = "5px", textFieldBorderColor = null, textFieldFocusBorderColor = null, textFieldFocusedBoxShadow = undefined, textFieldBackgroundColor = null, textFieldPadding = undefined, textFieldPaddingLeft = undefined, textFieldPaddingRight = undefined, textFieldPaddingBottom = undefined, textFieldPaddingTop = undefined, textFieldFontSize = undefined,
6
6
  // menu
@@ -21,7 +21,6 @@ function unselect(item) {
21
21
  }
22
22
  function toggle(item) {
23
23
  const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
24
- console.log(item, alreadyPresent);
25
24
  if (alreadyPresent)
26
25
  unselect(item);
27
26
  else
@@ -94,6 +93,7 @@ import Menu from '../common/Menu.svelte';
94
93
  bind:this={activator}
95
94
  style:width={width}
96
95
  style:max-width={maxWidth}
96
+ style:height={height}
97
97
  style:opacity={disabled ? '50%' : '100%'}
98
98
  on:click={handleContainerClick}
99
99
  >
@@ -13,6 +13,7 @@ declare const __propDef: {
13
13
  multiple?: boolean;
14
14
  disabled?: boolean;
15
15
  width?: string;
16
+ height?: string;
16
17
  maxWidth?: string;
17
18
  textFieldLabel?: string;
18
19
  textFieldPlaceholder?: string;
@@ -43,18 +43,20 @@ import Avatar from "./Avatar.svelte";
43
43
  class="descriptive-avatar-container"
44
44
  >
45
45
  <div class="avatar-container">
46
- <Avatar
47
- src={src}
48
- width={width}
49
- maxWidth={maxWidth}
50
- minWidth={minWidth}
51
- height={height}
52
- maxHeight={maxHeight}
53
- minHeight={minHeight}
54
- borderRadius={borderRadius}
55
- lazyLoaded={lazyLoaded}
56
- referrerpolicy={referrerpolicy}
57
- ></Avatar>
46
+ <slot name="avatar">
47
+ <Avatar
48
+ src={src}
49
+ width={width}
50
+ maxWidth={maxWidth}
51
+ minWidth={minWidth}
52
+ height={height}
53
+ maxHeight={maxHeight}
54
+ minHeight={minHeight}
55
+ borderRadius={borderRadius}
56
+ lazyLoaded={lazyLoaded}
57
+ referrerpolicy={referrerpolicy}
58
+ ></Avatar>
59
+ </slot>
58
60
  </div>
59
61
  <div
60
62
  style:margin-left={!reverse && direction === 'row' ? avatarSpacing : undefined}
@@ -20,7 +20,9 @@ declare const __propDef: {
20
20
  events: {
21
21
  [evt: string]: CustomEvent<any>;
22
22
  };
23
- slots: {};
23
+ slots: {
24
+ avatar: {};
25
+ };
24
26
  };
25
27
  export declare type DescriptiveAvatarProps = typeof __propDef.props;
26
28
  export declare type DescriptiveAvatarEvents = typeof __propDef.events;
@@ -23,8 +23,10 @@ function handleTabClick(clickedTab, nativeEvent) {
23
23
  }
24
24
  function setBookmarkPosition() {
25
25
  let tabButton = tabButtons[selected];
26
- bookmarkWidth = tabButton.offsetWidth - 10;
27
- bookmarkLeft = tabButton.offsetLeft + 5;
26
+ if (!!tabButton) {
27
+ bookmarkWidth = tabButton.offsetWidth - 10;
28
+ bookmarkLeft = tabButton.offsetLeft + 5;
29
+ }
28
30
  }
29
31
  $: if (!!selected)
30
32
  setBookmarkPosition();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "0.0.54",
4
+ "version": "0.0.57",
5
5
  "devDependencies": {
6
6
  "@sveltejs/adapter-auto": "next",
7
7
  "@sveltejs/kit": "next",