not-bulma 1.0.73 → 1.0.74

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-bulma",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "description": "not-* family UI components on Bulma CSS Framework",
5
5
  "main": "src/index.js",
6
6
  "svelte": "src/index.js",
@@ -65,18 +65,24 @@ export default class UICommon {
65
65
  return `${this.MONEY_SIGN}${major}.${minor}`;
66
66
  }
67
67
 
68
- static formatLocaleDatetime(dt) {
68
+ static formatLocaleDatetime(dt, opts = { date: true, time: true }) {
69
69
  const date = dt.toLocaleDateString(window.navigator.language);
70
70
  const time = dt.toLocaleTimeString(window.navigator.language);
71
- return `${date} ${time}`;
71
+ if (opts.date && opts.time) {
72
+ return `${date} ${time}`;
73
+ } else if (opts.date && !opts.time) {
74
+ return date;
75
+ } else {
76
+ return time;
77
+ }
72
78
  }
73
79
 
74
- static tryFormatLocaleDateTime(value) {
75
- if (typeof value == "string") {
80
+ static tryFormatLocaleDateTime(value, opts = { date: true, time: true }) {
81
+ if (typeof value == "string" || typeof value == "number") {
76
82
  const dt = new Date(value);
77
- return UICommon.formatLocaleDatetime(dt);
83
+ return UICommon.formatLocaleDatetime(dt, opts);
78
84
  } else if (typeof value == "object") {
79
- return UICommon.formatLocaleDatetime(value);
85
+ return UICommon.formatLocaleDatetime(value, opts);
80
86
  } else {
81
87
  return "";
82
88
  }
@@ -63,13 +63,21 @@
63
63
  }}
64
64
  >
65
65
  {#if titleComponent}
66
- <svelte:component
67
- this={titleComponent}
68
- {title}
69
- {...titleComponentProps}
70
- />
66
+ {#if typeof title === "string"}
67
+ <svelte:component
68
+ this={titleComponent}
69
+ {title}
70
+ {...titleComponentProps}
71
+ />
72
+ {:else}
73
+ <svelte:component
74
+ this={titleComponent}
75
+ {...title}
76
+ {...titleComponentProps}
77
+ />
78
+ {/if}
71
79
  {:else}
72
- {description}
80
+ {title}
73
81
  {/if}
74
82
  </div>
75
83
  {/if}
@@ -5,13 +5,11 @@
5
5
  export let id = "taggedValueId";
6
6
  export let title; //UITag props
7
7
  export let value; //UITag props
8
+ export let classes = "";
8
9
  </script>
9
10
 
10
- <div class="tags has-addons" {id}>
11
+ <div class="tags has-addons {classes}" {id}>
11
12
  {#if title}
12
- <UITag {...title} />
13
- {/if}
14
- {#if value}
15
- <UITag {...value} />
13
+ <UITag {...title} />{/if}{#if value}<UITag {...value} />
16
14
  {/if}
17
15
  </div>