1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-02-03 09:57:24 +02:00

fixed popup hide

This commit is contained in:
Gani Georgiev 2022-08-06 18:59:28 +03:00
parent 5fb45a1864
commit 51d635bc12
2 changed files with 12 additions and 8 deletions

View File

@ -45,20 +45,21 @@ type CollectionUpsertConfig struct {
// If you want to submit the form as part of another transaction, use
// [NewCollectionUpsertWithConfig] with Dao configured to your txDao.
func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert {
form := NewCollectionUpsertWithConfig(CollectionUpsertConfig{
return NewCollectionUpsertWithConfig(CollectionUpsertConfig{
Dao: app.Dao(),
}, collection)
return form
}
// NewCollectionUpsertWithConfig creates a new [CollectionUpsert] form
// with the provided config and [models.Collection] instance or panics on invalid configuration
// (for create you could pass a pointer to an empty Collection instance - `&models.Collection{}`).
func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert {
form := &CollectionUpsert{config: config}
form := &CollectionUpsert{
config: config,
collection: collection,
}
if form.config.Dao == nil || collection == nil {
if form.config.Dao == nil || form.collection == nil {
panic("Invalid initializer config or nil upsert model.")
}

View File

@ -118,9 +118,9 @@
ApiClient.errorResponseHandler(err);
}
hide();
isImporting = false;
hide();
}
</script>
@ -128,6 +128,8 @@
bind:this={panel}
class="full-width-popup import-popup"
overlayClose={false}
escClose={!isImporting}
beforeHide={() => !isImporting}
popup
on:show
on:hide
@ -172,11 +174,12 @@
</div>
<svelte:fragment slot="footer">
<button type="button" class="btn btn-secondary" on:click={hide}>Close</button>
<button type="button" class="btn btn-secondary" on:click={hide} disabled={isImporting}>Close</button>
<button
type="button"
class="btn btn-expanded"
class:btn-loading={isImporting}
disabled={isImporting}
on:click={() => submitImport()}
>
<span class="txt">Confirm and import</span>