firstly 0.1.1 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # firstly
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2348b71`](https://github.com/jycouet/firstly/commit/2348b7172d67b2357daf6cc57fbbd69d13345505)
8
+ Thanks [@jycouet](https://github.com/jycouet)! - export `withChangeLog` to chain options for
9
+ `@Entity`
10
+
11
+ - [`51cbd73`](https://github.com/jycouet/firstly/commit/51cbd7318797bf740627ae4cac8cc5074f7dab5e)
12
+ Thanks [@jycouet](https://github.com/jycouet)! - export @kitql/helper as `h`
13
+
14
+ ## 0.1.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [`e4d8b67`](https://github.com/jycouet/firstly/commit/e4d8b673787beee6d28e36aac1a404f49d690fb8)
19
+ Thanks [@jycouet](https://github.com/jycouet)! - export interface for `changeLog` Module
20
+
3
21
  ## 0.1.1
4
22
 
5
23
  ### Patch Changes
@@ -41,8 +41,11 @@ export const linkRoleToUsersFromEnv = async (o) => {
41
41
  if (!user) {
42
42
  user = repo(userEntity).create({ id: a.userId, name: nameify(providerUserId) });
43
43
  }
44
- user.roles = [...new Set([...user.roles, ...roles].sort())];
45
- await repo(userEntity).save(user);
44
+ const newRoles = [...new Set([...user.roles, ...roles].sort())];
45
+ if ((newRoles ?? []).join(',') !== (user.roles ?? []).join(',')) {
46
+ user.roles = newRoles;
47
+ await repo(userEntity).save(user);
48
+ }
46
49
  }
47
50
  }
48
51
  if (providersInfo.length > 0) {
@@ -1,4 +1,4 @@
1
- import { type FieldRef, type FieldsRef, type LifecycleEvent } from 'remult';
1
+ import { type EntityOptions, type FieldRef, type FieldsRef, type LifecycleEvent } from 'remult';
2
2
  import { Roles_ChangeLog, type change } from './changeLogEntities';
3
3
  export { Roles_ChangeLog };
4
4
  export type { change };
@@ -21,3 +21,39 @@ export declare class FieldDecider<entityType> {
21
21
  excludedValues: FieldRef<entityType>[];
22
22
  constructor(entity: entityType, options?: ColumnDeciderArgs<entityType>);
23
23
  }
24
+ export declare const withChangeLog: <entityType>(options?: EntityOptions<entityType>) => {
25
+ saved: (entity: entityType, e: LifecycleEvent<entityType>) => Promise<void>;
26
+ deleted: (entity: entityType, e: LifecycleEvent<entityType>) => Promise<void>;
27
+ caption?: string;
28
+ label?: string;
29
+ allowApiRead?: import("remult").Allowed;
30
+ allowApiUpdate?: import("remult").AllowedForInstance<entityType> | undefined;
31
+ allowApiDelete?: import("remult").AllowedForInstance<entityType> | undefined;
32
+ allowApiInsert?: import("remult").AllowedForInstance<entityType> | undefined;
33
+ allowApiCrud?: import("remult").Allowed;
34
+ apiPrefilter?: import("remult").EntityFilter<entityType> | (() => import("remult").EntityFilter<entityType> | Promise<import("remult").EntityFilter<entityType>>) | undefined;
35
+ apiPreprocessFilter?: ((filter: import("remult").EntityFilter<entityType>, event: import("remult").PreprocessFilterEvent<entityType>) => import("remult").EntityFilter<entityType> | Promise<import("remult").EntityFilter<entityType>>) | undefined;
36
+ backendPreprocessFilter?: ((filter: import("remult").EntityFilter<entityType>, event: import("remult").PreprocessFilterEvent<entityType>) => import("remult").EntityFilter<entityType> | Promise<import("remult").EntityFilter<entityType>>) | undefined;
37
+ backendPrefilter?: import("remult").EntityFilter<entityType> | (() => import("remult").EntityFilter<entityType> | Promise<import("remult").EntityFilter<entityType>>) | undefined;
38
+ defaultOrderBy?: import("remult").EntityOrderBy<entityType> | undefined;
39
+ saving?: ((entity: entityType, event: LifecycleEvent<entityType>) => Promise<any> | any) | undefined;
40
+ deleting?: ((entity: entityType, e: LifecycleEvent<entityType>) => Promise<any> | any) | undefined;
41
+ validation?: ((entity: entityType, ref: LifecycleEvent<entityType>) => Promise<any> | any) | undefined;
42
+ dbName?: string;
43
+ sqlExpression?: string | ((entity: import("remult").EntityMetadata<entityType>) => string | Promise<string>) | undefined;
44
+ id?: keyof import("remult").MembersOnly<entityType> | (keyof import("remult").MembersOnly<entityType>)[] | import("remult").EntityIdFields<entityType> | ((entity: import("remult").FieldsMetadata<entityType>) => import("remult").FieldMetadata | import("remult").FieldMetadata[]) | undefined;
45
+ entityRefInit?: ((ref: import("remult").EntityRef<entityType>, row: entityType) => void) | undefined;
46
+ apiRequireId?: import("remult").Allowed;
47
+ dataProvider?: ((defaultDataProvider: import("remult").DataProvider) => import("remult").DataProvider | Promise<import("remult").DataProvider> | undefined | null) | undefined;
48
+ ui?: {
49
+ getLayout?: import("../svelte/customField").getLayout<entityType> | undefined;
50
+ } | undefined;
51
+ searchableFind?: ((str: string) => import("remult").FindOptionsBase<entityType>) | undefined;
52
+ displayValue?: ((item: entityType) => import("../internals").BaseItem) | undefined;
53
+ permissionApiCrud?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
54
+ permissionApiDelete?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
55
+ permissionApiInsert?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
56
+ permissionApiRead?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
57
+ permissionApiUpdate?: import("../internals").BaseEnum[] | import("../internals").BaseEnum;
58
+ changeLog?: false | ColumnDeciderArgs<entityType> | undefined;
59
+ };
@@ -95,3 +95,31 @@ export class FieldDecider {
95
95
  this.fields = meta.fields.toArray().filter((f) => !this.excludedFields.includes(f));
96
96
  }
97
97
  }
98
+ export const withChangeLog = (options) => {
99
+ return {
100
+ ...options,
101
+ // changesLogs
102
+ saved: async (entity, e) => {
103
+ await options?.saved?.(entity, e);
104
+ if (options?.changeLog === false) {
105
+ // Don't log changes
106
+ }
107
+ else {
108
+ if (isBackend()) {
109
+ await recordSaved(entity, e, options?.changeLog);
110
+ }
111
+ }
112
+ },
113
+ deleted: async (entity, e) => {
114
+ await options?.deleted?.(entity, e);
115
+ if (options?.changeLog === false) {
116
+ // Don't log changes
117
+ }
118
+ else {
119
+ if (isBackend()) {
120
+ await recordDeleted(entity, e, options?.changeLog);
121
+ }
122
+ }
123
+ },
124
+ };
125
+ };
@@ -1,14 +1,33 @@
1
1
  import { Module } from 'remult/server';
2
+ import type { ColumnDeciderArgs } from '..';
3
+ declare module 'remult' {
4
+ interface EntityOptions<entityType> {
5
+ changeLog?: false | ColumnDeciderArgs<entityType>;
6
+ }
7
+ }
2
8
  /**
3
- * We suggest you to create your own `@APP_Entity` decorator and use it instead of `@Entity`.
4
- * Like this you opt-in to the change log feature Entity by Entity.
9
+ * ## Option 1
10
+ * Use the `withChangeLog` function to wrap your entity options.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { withChangeLog } from '..'
15
+ *
16
+ * \@Entity('users', withChangeLog({
17
+ * // ...
18
+ * }))
19
+ * class User { }
20
+ * ```
21
+ * ## Option 2
22
+ * Create your own `@APP_Entity` decorator and use it instead of `@Entity`.
23
+ * Inside, it uses the `withChangeLog` function to wrap your entity options.
5
24
  *
6
25
  * @example
7
26
  * ```ts
8
27
  * // APP_Entity.ts example
9
28
  * import { Entity, isBackend, type EntityOptions } from 'remult'
10
29
  *
11
- * import { recordDeleted, recordSaved } from '..'
30
+ * import { withChangeLog } from '..'
12
31
  *
13
32
  * export function APP_Entity<entityType>(
14
33
  * key: string,
@@ -16,31 +35,7 @@ import { Module } from 'remult/server';
16
35
  * entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType
17
36
  * >,
18
37
  * ) {
19
- * return Entity(key, {
20
- * ...options,
21
- *
22
- * // changesLogs
23
- * saved: async (entity, e) => {
24
- * await options?.saved?.(entity, e)
25
- * if (options?.changeLog === false) {
26
- * // Don't log changes
27
- * } else {
28
- * if (isBackend()) {
29
- * await recordSaved(entity, e, options?.changeLog)
30
- * }
31
- * }
32
- * },
33
- * deleted: async (entity, e) => {
34
- * await options?.deleted?.(entity, e)
35
- * if (options?.changeLog === false) {
36
- * // Don't log changes
37
- * } else {
38
- * if (isBackend()) {
39
- * await recordDeleted(entity, e, options?.changeLog)
40
- * }
41
- * }
42
- * },
43
- * })
38
+ * return Entity(key, withChangeLog(options))
44
39
  * }
45
40
  * ```
46
41
  */
@@ -1,15 +1,28 @@
1
1
  import { Module } from 'remult/server';
2
2
  import { ChangeLog } from '../changeLogEntities';
3
3
  /**
4
- * We suggest you to create your own `@APP_Entity` decorator and use it instead of `@Entity`.
5
- * Like this you opt-in to the change log feature Entity by Entity.
4
+ * ## Option 1
5
+ * Use the `withChangeLog` function to wrap your entity options.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { withChangeLog } from '..'
10
+ *
11
+ * \@Entity('users', withChangeLog({
12
+ * // ...
13
+ * }))
14
+ * class User { }
15
+ * ```
16
+ * ## Option 2
17
+ * Create your own `@APP_Entity` decorator and use it instead of `@Entity`.
18
+ * Inside, it uses the `withChangeLog` function to wrap your entity options.
6
19
  *
7
20
  * @example
8
21
  * ```ts
9
22
  * // APP_Entity.ts example
10
23
  * import { Entity, isBackend, type EntityOptions } from 'remult'
11
24
  *
12
- * import { recordDeleted, recordSaved } from '..'
25
+ * import { withChangeLog } from '..'
13
26
  *
14
27
  * export function APP_Entity<entityType>(
15
28
  * key: string,
@@ -17,31 +30,7 @@ import { ChangeLog } from '../changeLogEntities';
17
30
  * entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType
18
31
  * >,
19
32
  * ) {
20
- * return Entity(key, {
21
- * ...options,
22
- *
23
- * // changesLogs
24
- * saved: async (entity, e) => {
25
- * await options?.saved?.(entity, e)
26
- * if (options?.changeLog === false) {
27
- * // Don't log changes
28
- * } else {
29
- * if (isBackend()) {
30
- * await recordSaved(entity, e, options?.changeLog)
31
- * }
32
- * }
33
- * },
34
- * deleted: async (entity, e) => {
35
- * await options?.deleted?.(entity, e)
36
- * if (options?.changeLog === false) {
37
- * // Don't log changes
38
- * } else {
39
- * if (isBackend()) {
40
- * await recordDeleted(entity, e, options?.changeLog)
41
- * }
42
- * }
43
- * },
44
- * })
33
+ * return Entity(key, withChangeLog(options))
45
34
  * }
46
35
  * ```
47
36
  */
package/esm/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- import * as log from '@kitql/helpers';
2
- export { log };
3
- export declare const ff_Log: log.Log;
1
+ import * as h from '@kitql/helpers';
2
+ export {
3
+ /** alias for @kitql/helpers */
4
+ h, };
5
+ export declare const ff_Log: h.Log;
package/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
- import * as log from '@kitql/helpers';
2
- export { log };
3
- export const ff_Log = new log.Log('firstly');
1
+ import * as h from '@kitql/helpers';
2
+ export {
3
+ /** alias for @kitql/helpers */
4
+ h, };
5
+ export const ff_Log = new h.Log('firstly');
@@ -1,5 +1,5 @@
1
- import { Entity, isBackend } from 'remult';
2
- import { recordDeleted, recordSaved } from '../changeLog';
1
+ import { Entity } from 'remult';
2
+ import { withChangeLog } from '../changeLog';
3
3
  const toAllow = (permission) => {
4
4
  if (permission) {
5
5
  if (Array.isArray(permission)) {
@@ -10,35 +10,12 @@ const toAllow = (permission) => {
10
10
  return undefined;
11
11
  };
12
12
  export function FF_Entity(key, options) {
13
- return Entity(key, {
13
+ return Entity(key, withChangeLog({
14
14
  ...options,
15
15
  allowApiCrud: options?.allowApiCrud ?? toAllow(options?.permissionApiCrud),
16
16
  allowApiDelete: options?.allowApiDelete ?? toAllow(options?.permissionApiDelete),
17
17
  allowApiInsert: options?.allowApiInsert ?? toAllow(options?.permissionApiInsert),
18
18
  allowApiRead: options?.allowApiRead ?? toAllow(options?.permissionApiRead),
19
19
  allowApiUpdate: options?.allowApiUpdate ?? toAllow(options?.permissionApiUpdate),
20
- // changesLogs
21
- saved: async (entity, e) => {
22
- await options?.saved?.(entity, e);
23
- if (options?.changeLog === false) {
24
- // Don't log changes
25
- }
26
- else {
27
- if (isBackend()) {
28
- await recordSaved(entity, e, options?.changeLog);
29
- }
30
- }
31
- },
32
- deleted: async (entity, e) => {
33
- await options?.deleted?.(entity, e);
34
- if (options?.changeLog === false) {
35
- // Don't log changes
36
- }
37
- else {
38
- if (isBackend()) {
39
- await recordDeleted(entity, e, options?.changeLog);
40
- }
41
- }
42
- },
43
- });
20
+ }));
44
21
  }
@@ -7,6 +7,11 @@ import type SMTPTransport from 'nodemailer/lib/smtp-transport';
7
7
  import type StreamTransport from 'nodemailer/lib/stream-transport';
8
8
  import { Module } from 'remult/server';
9
9
  import { type MailStyle } from './formatMailHelper';
10
+ declare module 'remult' {
11
+ interface RemultContext {
12
+ sendMail?: SendMail;
13
+ }
14
+ }
10
15
  export type TransportTypes = SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | SMTPTransport | SMTPTransport.Options | string;
11
16
  export type DefaultOptions = typeNodemailer.SendMailOptions;
12
17
  type GlobalEasyOptions = {
@@ -25,11 +30,6 @@ export type MailOptions = GlobalEasyOptions & {
25
30
  };
26
31
  };
27
32
  declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
28
- declare module 'remult' {
29
- interface RemultContext {
30
- sendMail?: SendMail;
31
- }
32
- }
33
33
  export type SendMail = typeof sendMail;
34
34
  export declare const sendMail: (
35
35
  /** usefull for logs, it has NO impact on the mail itself */
@@ -15,6 +15,7 @@
15
15
  class?: string
16
16
  }
17
17
 
18
+ // eslint-disable-next-line svelte/no-unused-props
18
19
  let props: Props<valueType, entityType> = $props()
19
20
 
20
21
  // let classes = $derived(getClasses('field', props.classes))
@@ -6,7 +6,7 @@
6
6
  import { dialog, FF_Display, FF_Repo, getClasses, type GridTheme } from './'
7
7
 
8
8
  interface Props<entityType> {
9
- uid?: string
9
+ // uid?: string
10
10
  r: FF_Repo<entityType>
11
11
  fields?: FieldMetadata<unknown, entityType>[]
12
12
  showCreate?: boolean
@@ -1,7 +1,6 @@
1
1
  import { type FieldMetadata } from 'remult';
2
2
  import { FF_Repo, type GridTheme } from './';
3
3
  interface Props<entityType> {
4
- uid?: string;
5
4
  r: FF_Repo<entityType>;
6
5
  fields?: FieldMetadata<unknown, entityType>[];
7
6
  showCreate?: boolean;
@@ -81,7 +81,6 @@
81
81
 
82
82
  <button
83
83
  {...$trigger}
84
- use:trigger
85
84
  use:isAllowed={{ permission }}
86
85
  on:click
87
86
  {...$$restProps}
@@ -100,11 +99,10 @@
100
99
  {#if $open && (disabledWhy || $$slots.tooltip)}
101
100
  <div
102
101
  {...$content}
103
- use:content
104
102
  transition:fade={{ duration: 100 }}
105
103
  class="z-30 rounded-lg bg-base-300 ring-1 ring-black"
106
104
  >
107
- <div {...$arrow} use:arrow></div>
105
+ <div {...$arrow}></div>
108
106
  <div class="px-4 py-1">
109
107
  {#if $$slots.tooltip}
110
108
  <slot name="tooltip" />
@@ -22,6 +22,7 @@
22
22
  import SelectMelt from './internals/select/SelectMelt.svelte'
23
23
  import SelectRadio from './internals/select/SelectRadio.svelte'
24
24
  import Textarea from './internals/Textarea.svelte'
25
+ import { LibIcon_Eye, LibIcon_EyeOff } from './LibIcon'
25
26
  import LinkPlus from './link/LinkPlus.svelte'
26
27
 
27
28
  export let cell: Cell<T>
@@ -188,6 +189,8 @@
188
189
 
189
190
  return ''
190
191
  }
192
+
193
+ let textpsdVisible = false
191
194
  </script>
192
195
 
193
196
  <FieldContainer
@@ -296,7 +299,7 @@
296
299
  }}
297
300
  />
298
301
  </div>
299
- {:else if metaType.subKind === 'text' || metaType.subKind === 'email' || metaType.subKind === 'password' || metaType.subKind === 'dateOnly' || metaType.subKind === 'number'}
302
+ {:else if metaType.subKind === 'text' || metaType.subKind === 'email' || metaType.subKind === 'password' || metaType.subKind === 'dateOnly' || metaType.subKind === 'number' || metaType.subKind === 'textpsd'}
300
303
  <div class="input input-bordered inline-flex w-full items-center pl-2">
301
304
  <Input
302
305
  {focus}
@@ -306,7 +309,10 @@
306
309
  `join-item w-full bg-transparent placeholder:text-base-content/30`,
307
310
  metaType.subKind === 'number' && 'text-end',
308
311
  )}
309
- type={metaType.subKind.replaceAll('dateOnly', 'date')}
312
+ style={cell.field?.inputType === 'textpsd' && textpsdVisible === false
313
+ ? 'filter: blur(0.2rem)'
314
+ : ''}
315
+ type={metaType.subKind.replaceAll('dateOnly', 'date').replaceAll('textpsd', 'text')}
310
316
  value={toInput(cell.field, value)}
311
317
  {withDedounce}
312
318
  on:input={(e) => {
@@ -317,6 +323,17 @@
317
323
  {...$$restProps}
318
324
  />
319
325
  {calcSuffix(value)}
326
+ {#if cell.field?.inputType === 'textpsd'}
327
+ <button
328
+ on:click={(e) => {
329
+ e.preventDefault()
330
+ textpsdVisible = !textpsdVisible
331
+ }}
332
+ class="btn-ghost btn-sm"
333
+ >
334
+ <Icon data={textpsdVisible ? LibIcon_Eye : LibIcon_EyeOff} />
335
+ </button>
336
+ {/if}
320
337
  </div>
321
338
  {:else if metaType.subKind === 'textarea'}
322
339
  <Textarea
@@ -8,6 +8,8 @@ export declare const LibIcon_Search: string;
8
8
  export declare const LibIcon_Check: string;
9
9
  export declare const LibIcon_MultiCheck: string;
10
10
  export declare const LibIcon_Add: string;
11
+ export declare const LibIcon_Eye: string;
12
+ export declare const LibIcon_EyeOff: string;
11
13
  export declare const LibIcon_MultiAdd: string;
12
14
  export declare const LibIcon_Edit: string;
13
15
  export declare const LibIcon_Delete: string;
package/esm/ui/LibIcon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Lib Icons
2
2
  // https://icones.js.org/ and https://pictogrammers.com/library/mdi/
3
- import { mdiAccountTie, mdiAccountTieWoman, mdiCancel, mdiCheck, mdiCheckAll, mdiChevronDown, mdiChevronLeft, mdiChevronRight, mdiChevronUp, mdiCloseCircleOutline, mdiCogOutline, mdiContentSaveEdit, mdiDelete, mdiLoading, mdiMagnify, mdiPencil, mdiPlusBoxMultiple, mdiPlusCircle, mdiSend, mdiSort, mdiSortReverseVariant, mdiSortVariant, } from '@mdi/js';
3
+ import { mdiAccountTie, mdiAccountTieWoman, mdiCancel, mdiCheck, mdiCheckAll, mdiChevronDown, mdiChevronLeft, mdiChevronRight, mdiChevronUp, mdiCloseCircleOutline, mdiCogOutline, mdiContentSaveEdit, mdiDelete, mdiEye, mdiEyeOff, mdiLoading, mdiMagnify, mdiPencil, mdiPlusBoxMultiple, mdiPlusCircle, mdiSend, mdiSort, mdiSortReverseVariant, mdiSortVariant, } from '@mdi/js';
4
4
  export const LibIcon_Empty = ``;
5
5
  export const LibIcon_Forbidden = mdiCancel;
6
6
  export const LibIcon_ChevronDown = mdiChevronDown;
@@ -11,6 +11,8 @@ export const LibIcon_Search = mdiMagnify;
11
11
  export const LibIcon_Check = mdiCheck;
12
12
  export const LibIcon_MultiCheck = mdiCheckAll;
13
13
  export const LibIcon_Add = mdiPlusCircle;
14
+ export const LibIcon_Eye = mdiEye;
15
+ export const LibIcon_EyeOff = mdiEyeOff;
14
16
  export const LibIcon_MultiAdd = mdiPlusBoxMultiple;
15
17
  export const LibIcon_Edit = mdiPencil;
16
18
  export const LibIcon_Delete = mdiDelete;
@@ -22,18 +22,17 @@
22
22
  })
23
23
  </script>
24
24
 
25
- <button type="button" class="trigger" {...$trigger} use:trigger aria-label="Add">
25
+ <button type="button" class="trigger" {...$trigger} aria-label="Add">
26
26
  <slot />
27
27
  </button>
28
28
  <!-- {hideTooltip} -->
29
29
  {#if $open && !hideTooltip && (text || $$slots.tooltip)}
30
30
  <div
31
31
  {...$content}
32
- use:content
33
32
  transition:fade={{ duration: 100 }}
34
33
  class="z-30 rounded-lg bg-base-300 ring-1 ring-black"
35
34
  >
36
- <div {...$arrow} use:arrow></div>
35
+ <div {...$arrow}></div>
37
36
  <div class="px-4 py-1">
38
37
  {#if $$slots.tooltip}
39
38
  <slot name="tooltip" />
@@ -239,31 +239,28 @@
239
239
  </li>
240
240
  {:else}
241
241
  {#if createOptionWhenNoResult}
242
- <div class="p-4">
243
- <Button
244
- class="w-full"
245
- on:click={async () => {
246
- await createRequest?.({ input: $inputValue, id })
247
- // const newValue = await createRequest?.({ input: $inputValue, id })
248
- // if (newValue) {
249
- // items.push(newValue)
250
- // filteredItems.push(newValue)
251
- // sync.selected(toOption(newValue))
252
- // $open = false
253
- // }
254
- $open = false
255
- }}
256
- >
257
- <div class="flex items-center gap-2">
258
- <Icon data={LibIcon_Add}></Icon>
259
- {#if $inputValue}
260
- Créer "{$inputValue}"
261
- {:else}
262
- Créer
263
- {/if}
264
- </div>
265
- </Button>
266
- </div>
242
+ {#if $inputValue}
243
+ <div class="p-4">
244
+ <Button
245
+ class="w-full"
246
+ on:click={async () => {
247
+ createRequest?.({ input: $inputValue, id })
248
+ $open = false
249
+ }}
250
+ >
251
+ <div class="flex items-center gap-2">
252
+ <Icon data={LibIcon_Add}></Icon>
253
+ {#if $inputValue}
254
+ Créer "{$inputValue}"
255
+ {/if}
256
+ </div>
257
+ </Button>
258
+ </div>
259
+ {:else}
260
+ <li class="relative cursor-pointer rounded-md py-1 pl-8 pr-4 text-sm">
261
+ Il faut tenter de rechercher avant de créer un nouvel élément
262
+ </li>
263
+ {/if}
267
264
  {:else}
268
265
  <li class="relative cursor-pointer rounded-md py-1 pl-8 pr-4">Aucun résultat</li>
269
266
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firstly",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Firstly, an opinionated Remult setup!",
6
6
  "funding": "https://github.com/sponsors/jycouet",