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

View File

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