@ims360/svelte-ivory 0.4.5 → 0.4.6

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.
@@ -38,7 +38,23 @@
38
38
 
39
39
  // Register the new column if this is the first table row that was rendered
40
40
  const tableContext = getTableContext();
41
- const column = tableContext.registerColumn({ id, width, minWidth, resizable, header });
41
+ const column = tableContext.registerColumn({
42
+ get id() {
43
+ return id;
44
+ },
45
+ get width() {
46
+ return width;
47
+ },
48
+ get minWidth() {
49
+ return minWidth;
50
+ },
51
+ get resizable() {
52
+ return resizable;
53
+ },
54
+ get header() {
55
+ return header;
56
+ }
57
+ });
42
58
  const rowContext = getRowContext();
43
59
 
44
60
  const finalOnClick = $derived(onclick || rowContext.onclick);
@@ -47,22 +63,11 @@
47
63
  return href || rowContext.href;
48
64
  });
49
65
 
50
- // passes updated props to the column
51
- $effect(() => {
52
- column.updateConfig({ resizable, minWidth, id, header });
53
- });
54
-
55
- // this must be separate to the above effect, since otherwise the width would be reset on every scroll
56
- $effect(() => {
57
- if (!resizable && typeof width !== 'undefined') column.resize(width);
58
- });
59
-
60
66
  const widthStyle = $derived(
61
67
  `calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * tableContext.nestingInset}) !important;`
62
68
  );
63
69
  </script>
64
70
 
65
- <!-- svelte-ignore a11y_no_static_element_interactions -->
66
71
  <Element
67
72
  {...props}
68
73
  onclick={finalOnClick}
@@ -1 +1 @@
1
- {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAwDL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AA6DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnController.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/columnController.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,gBAAgB;IACzB,EAAE,SAAc;IAChB,MAAM,uBAAgC;IAGtC,KAAK,qBAAoB;IACzB,QAAQ,SAAyB;IACjC,QAAQ,UAAiB;IACzB,SAAS,UAAiB;IAC1B,QAAQ,UAAiB;gBAEb,IAAI,EAAE,YAAY;IAS9B,YAAY,CAAC,IAAI,EAAE,YAAY;IAiB/B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM;CAQ3B"}
1
+ {"version":3,"file":"columnController.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/columnController.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,gBAAgB;IACzB,EAAE,SAAc;IAChB,MAAM,uBAAgC;IAGtC,KAAK,qBAAoB;IACzB,QAAQ,SAAyB;IACjC,QAAQ,UAAiB;IACzB,SAAS,UAAiB;IAC1B,QAAQ,UAAiB;gBAEb,IAAI,EAAE,YAAY;IAS9B,YAAY,CAAC,IAAI,EAAE,YAAY;IAmB/B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM;CAQ3B"}
@@ -23,6 +23,9 @@ export class ColumnController {
23
23
  const newWidth = typeof conf.width === 'undefined' ? DEFAULT_WIDTH : conf.width;
24
24
  this.width = newWidth;
25
25
  }
26
+ else {
27
+ this.width = conf.width ?? this.width;
28
+ }
26
29
  if (typeof conf.minWidth !== 'undefined') {
27
30
  this.minWidth = conf.minWidth;
28
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ims360/svelte-ivory",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "keywords": [
5
5
  "svelte"
6
6
  ],
@@ -38,7 +38,23 @@
38
38
 
39
39
  // Register the new column if this is the first table row that was rendered
40
40
  const tableContext = getTableContext();
41
- const column = tableContext.registerColumn({ id, width, minWidth, resizable, header });
41
+ const column = tableContext.registerColumn({
42
+ get id() {
43
+ return id;
44
+ },
45
+ get width() {
46
+ return width;
47
+ },
48
+ get minWidth() {
49
+ return minWidth;
50
+ },
51
+ get resizable() {
52
+ return resizable;
53
+ },
54
+ get header() {
55
+ return header;
56
+ }
57
+ });
42
58
  const rowContext = getRowContext();
43
59
 
44
60
  const finalOnClick = $derived(onclick || rowContext.onclick);
@@ -47,22 +63,11 @@
47
63
  return href || rowContext.href;
48
64
  });
49
65
 
50
- // passes updated props to the column
51
- $effect(() => {
52
- column.updateConfig({ resizable, minWidth, id, header });
53
- });
54
-
55
- // this must be separate to the above effect, since otherwise the width would be reset on every scroll
56
- $effect(() => {
57
- if (!resizable && typeof width !== 'undefined') column.resize(width);
58
- });
59
-
60
66
  const widthStyle = $derived(
61
67
  `calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * tableContext.nestingInset}) !important;`
62
68
  );
63
69
  </script>
64
70
 
65
- <!-- svelte-ignore a11y_no_static_element_interactions -->
66
71
  <Element
67
72
  {...props}
68
73
  onclick={finalOnClick}
@@ -36,6 +36,8 @@ export class ColumnController {
36
36
  if (typeof this.width === 'undefined') {
37
37
  const newWidth = typeof conf.width === 'undefined' ? DEFAULT_WIDTH : conf.width;
38
38
  this.width = newWidth;
39
+ } else {
40
+ this.width = conf.width ?? this.width;
39
41
  }
40
42
  if (typeof conf.minWidth !== 'undefined') {
41
43
  this.minWidth = conf.minWidth;