@cloudparker/moldex.js 0.0.100 → 0.0.101

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.
@@ -12,6 +12,7 @@ export declare class PeriodEnum {
12
12
  static THIS_YEAR: number;
13
13
  static LAST_YEAR: number;
14
14
  static NEXT_YEAR: number;
15
+ static DATE: number;
15
16
  }
16
17
  export type FirestoreTimestamp = {
17
18
  seconds: number;
@@ -12,6 +12,7 @@ export class PeriodEnum {
12
12
  static THIS_YEAR = 10;
13
13
  static LAST_YEAR = 11;
14
14
  static NEXT_YEAR = 12;
15
+ static DATE = 13;
15
16
  }
16
17
  export function getDateWith(yearChange) {
17
18
  const date = new Date();
@@ -60,6 +61,7 @@ export function getPeriodDates(period, currentDate = new Date()) {
60
61
  const currentDate2 = moment(currentDate);
61
62
  let startDate, endDate;
62
63
  switch (period) {
64
+ case PeriodEnum.DATE:
63
65
  case PeriodEnum.TODAY:
64
66
  startDate = currentDate1.startOf('day');
65
67
  endDate = currentDate2.endOf('day');
@@ -1,9 +1,15 @@
1
- <script lang="ts">let { input, key, hasTitle } = $props();
1
+ <script lang="ts">let { input, key, hasTitle, placeholder, emptyText = "-" } = $props();
2
2
  </script>
3
3
 
4
4
  {#if input}
5
- {#await input then res}
6
- {@const text = res && key ? res[key] : res}
7
- <span title={hasTitle ? text : ''}> {text}</span>
5
+ {#await input}
6
+ <span>{@html placeholder}</span>
7
+ {:then res}
8
+ {#if res}
9
+ {@const text = res && key ? res[key] : res}
10
+ <span title={hasTitle ? text : ''}> {text}</span>
11
+ {:else}
12
+ <span>{emptyText}</span>
13
+ {/if}
8
14
  {/await}
9
15
  {/if}
@@ -2,6 +2,8 @@ type PropsType = {
2
2
  input?: Promise<any | null> | undefined;
3
3
  key?: string;
4
4
  hasTitle?: string;
5
+ placeholder?: string;
6
+ emptyText?: string;
5
7
  };
6
8
  declare const TextAwait: import("svelte").Component<PropsType, {}, "">;
7
9
  type TextAwait = ReturnType<typeof TextAwait>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudparker/moldex.js",
3
- "version": "0.0.100",
3
+ "version": "0.0.101",
4
4
  "author": "cloudparker.com",
5
5
  "license": "MIT",
6
6
  "keywords": [