normalized field settings argument name and multiple required tooltip

This commit is contained in:
Gani Georgiev
2026-06-08 09:50:49 +03:00
parent bff6b4c3ab
commit 77639f94ce
23 changed files with 232 additions and 233 deletions
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{n as e,t as n}from"./index-vnblSM5A.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.newEmail||!a.collectionId){app.toasts.error(`Invalid or expired email change token.`),window.location.hash=`#/`;return}app.store.title=`Confirm email change`;let o=store({password:``,isSubmitting:!1,isSuccess:!1,showPassword:!1});async function s(){if(o.isSubmitting)return;o.isSubmitting=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmEmailChange(i,o.password),o.isSuccess=!0}catch(e){app.checkApiError(e),o.isSuccess=!1}o.isSubmitting=!1}return t.div({pbEvent:`pageConfirmEmailChange`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isSuccess?t.div({pbEvent:`confirmEmailChangeAlert`,className:`alert success txt-center`},t.p(null,`The email was successfully changed.`),t.p(null,`You can go back and sign in with your new email address.`)):t.form({pbEvent:`confirmEmailChangeForm`,className:`grid confirm-email-change-form`,onsubmit:e=>{e.preventDefault(),s()}},t.div({className:`col-12`},t.div({className:`content txt-center m-b-sm`},`Type your password to confirm changing your email address to `,t.strong(null,a.newEmail),`:`),t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`password_confirm`},`Password`),t.input({id:`password_confirm`,name:`password`,required:!0,autofocus:!0,type:()=>o.showPassword?`text`:`password`,value:()=>o.password,oninput:e=>o.password=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showPassword?`Hide password`:`Show password`),onclick:()=>o.showPassword=!o.showPassword},t.i({className:()=>o.showPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg block ${o.isSubmitting?`loading`:``}`,disabled:()=>o.isSubmitting},t.span({className:`txt`},`Confirm new email`)))))}export{r as pageConfirmEmailChange}; import{n as e,t as n}from"./index-DgPYXC7i.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.newEmail||!a.collectionId){app.toasts.error(`Invalid or expired email change token.`),window.location.hash=`#/`;return}app.store.title=`Confirm email change`;let o=store({password:``,isSubmitting:!1,isSuccess:!1,showPassword:!1});async function s(){if(o.isSubmitting)return;o.isSubmitting=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmEmailChange(i,o.password),o.isSuccess=!0}catch(e){app.checkApiError(e),o.isSuccess=!1}o.isSubmitting=!1}return t.div({pbEvent:`pageConfirmEmailChange`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isSuccess?t.div({pbEvent:`confirmEmailChangeAlert`,className:`alert success txt-center`},t.p(null,`The email was successfully changed.`),t.p(null,`You can go back and sign in with your new email address.`)):t.form({pbEvent:`confirmEmailChangeForm`,className:`grid confirm-email-change-form`,onsubmit:e=>{e.preventDefault(),s()}},t.div({className:`col-12`},t.div({className:`content txt-center m-b-sm`},`Type your password to confirm changing your email address to `,t.strong(null,a.newEmail),`:`),t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`password_confirm`},`Password`),t.input({id:`password_confirm`,name:`password`,required:!0,autofocus:!0,type:()=>o.showPassword?`text`:`password`,value:()=>o.password,oninput:e=>o.password=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showPassword?`Hide password`:`Show password`),onclick:()=>o.showPassword=!o.showPassword},t.i({className:()=>o.showPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg block ${o.isSubmitting?`loading`:``}`,disabled:()=>o.isSubmitting},t.span({className:`txt`},`Confirm new email`)))))}export{r as pageConfirmEmailChange};
@@ -1 +1 @@
import{n as e,t as n}from"./index-vnblSM5A.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.email||!a.collectionId){app.toasts.error(`Invalid or expired password reset token.`),window.location.hash=`#/`;return}app.store.title=`Confirm password reset`;let o=store({newPassword:``,newPasswordConfirm:``,showNewPassword:!1,showNewPasswordConfirm:!1,isSubmitting:!1,isSuccess:!1});async function s(){if(o.isSubmitting)return;o.isSubmitting=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmPasswordReset(i,o.newPassword,o.newPasswordConfirm),o.isSuccess=!0}catch(e){app.checkApiError(e)}o.isSubmitting=!1}return t.div({pbEvent:`pageConfirmPasswordReset`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isSuccess?t.div({pbEvent:`confirmPasswordResetAlert`,className:`alert success txt-center`},t.p(null,`The password was successfully changed.`),t.p(null,`You can go back to sign in with your new password.`)):t.form({pbEvent:`confirmPasswordResetForm`,className:`grid confirm-password-reset-form`,onsubmit:e=>{e.preventDefault(),s()}},t.div({className:`col-12`},t.div({className:`content txt-center m-b-sm`},`Type your new password for `,t.strong(null,a.email),`:`),t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`newPassword`},`New password`),t.input({id:`newPassword`,name:`password`,required:!0,autofocus:!0,autocomplete:`new-password`,type:()=>o.showNewPassword?`text`:`password`,value:()=>o.newPassword,oninput:e=>o.newPassword=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showNewPassword?`Hide password`:`Show password`),onclick:()=>o.showNewPassword=!o.showNewPassword},t.i({className:()=>o.showNewPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`newPasswordConfirm`},`New password confirm`),t.input({id:`newPasswordConfirm`,name:`passwordConfirm`,required:!0,autocomplete:`new-password`,type:()=>o.showNewPasswordConfirm?`text`:`password`,value:()=>o.newPasswordConfirm,oninput:e=>o.newPasswordConfirm=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showNewPasswordConfirm?`Hide password`:`Show password`),onclick:()=>o.showNewPasswordConfirm=!o.showNewPasswordConfirm},t.i({className:()=>o.showNewPasswordConfirm?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg block ${o.isSubmitting?`loading`:``}`,disabled:()=>o.isSubmitting},t.span({className:`txt`},`Set new password`)))))}export{r as pageConfirmPasswordReset}; import{n as e,t as n}from"./index-DgPYXC7i.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.email||!a.collectionId){app.toasts.error(`Invalid or expired password reset token.`),window.location.hash=`#/`;return}app.store.title=`Confirm password reset`;let o=store({newPassword:``,newPasswordConfirm:``,showNewPassword:!1,showNewPasswordConfirm:!1,isSubmitting:!1,isSuccess:!1});async function s(){if(o.isSubmitting)return;o.isSubmitting=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmPasswordReset(i,o.newPassword,o.newPasswordConfirm),o.isSuccess=!0}catch(e){app.checkApiError(e)}o.isSubmitting=!1}return t.div({pbEvent:`pageConfirmPasswordReset`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isSuccess?t.div({pbEvent:`confirmPasswordResetAlert`,className:`alert success txt-center`},t.p(null,`The password was successfully changed.`),t.p(null,`You can go back to sign in with your new password.`)):t.form({pbEvent:`confirmPasswordResetForm`,className:`grid confirm-password-reset-form`,onsubmit:e=>{e.preventDefault(),s()}},t.div({className:`col-12`},t.div({className:`content txt-center m-b-sm`},`Type your new password for `,t.strong(null,a.email),`:`),t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`newPassword`},`New password`),t.input({id:`newPassword`,name:`password`,required:!0,autofocus:!0,autocomplete:`new-password`,type:()=>o.showNewPassword?`text`:`password`,value:()=>o.newPassword,oninput:e=>o.newPassword=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showNewPassword?`Hide password`:`Show password`),onclick:()=>o.showNewPassword=!o.showNewPassword},t.i({className:()=>o.showNewPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`newPasswordConfirm`},`New password confirm`),t.input({id:`newPasswordConfirm`,name:`passwordConfirm`,required:!0,autocomplete:`new-password`,type:()=>o.showNewPasswordConfirm?`text`:`password`,value:()=>o.newPasswordConfirm,oninput:e=>o.newPasswordConfirm=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>o.showNewPasswordConfirm?`Hide password`:`Show password`),onclick:()=>o.showNewPasswordConfirm=!o.showNewPasswordConfirm},t.i({className:()=>o.showNewPasswordConfirm?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg block ${o.isSubmitting?`loading`:``}`,disabled:()=>o.isSubmitting},t.span({className:`txt`},`Set new password`)))))}export{r as pageConfirmPasswordReset};
@@ -1 +1 @@
import{n as e,t as n}from"./index-vnblSM5A.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.email||!a.collectionId){app.toasts.error(`Invalid or expired verification token.`),window.location.hash=`#/`;return}app.store.title=`Confirm verification`;let o=store({isConfirming:!1,isConfirmSuccess:!1,isResending:!1,isResendSuccess:!1});s();async function s(){if(o.isConfirming)return;o.isConfirming=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmVerification(i),o.isConfirmSuccess=!0}catch{o.isConfirmSuccess=!1}o.isConfirming=!1}async function c(){if(o.isResending)return;o.isResending=!0;let e=new n(`../`);try{await e.collection(a.collectionId).requestVerification(a.email),o.isResendSuccess=!0}catch(e){app.checkApiError(e),o.isResendSuccess=!1}o.isResending=!1}return t.div({pbEvent:`pageConfirmVerification`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isConfirming?t.div({className:`block txt-center`},t.span({className:`loader`},`Please wait...`)):o.isConfirmSuccess?t.div({pbEvent:`confirmVerificationSuccessAlert`,className:`alert success txt-center`},t.p(null,`Successfully verified `,t.strong(null,a.email),`.`)):o.isResendSuccess?t.div({pbEvent:`confirmVerificationResendAlert`,className:`alert success txt-center`},t.p(null,`Please check your email for the new verification link.`)):[t.div({pbEvent:`confirmVerificationErrorAlert`,className:`alert danger txt-center m-b-base`},t.p(null,`Invalid or expired verification token.`)),t.button({type:`button`,className:()=>`btn transparent lg block ${o.isResending?`loading`:``}`,disabled:()=>o.isResending,onclick:()=>c()},t.span({className:`txt`},`Resend`))])}export{r as pageConfirmVerification}; import{n as e,t as n}from"./index-DgPYXC7i.js";function r(r){let i=r.params?.token||``,a=e(i);if(!a.email||!a.collectionId){app.toasts.error(`Invalid or expired verification token.`),window.location.hash=`#/`;return}app.store.title=`Confirm verification`;let o=store({isConfirming:!1,isConfirmSuccess:!1,isResending:!1,isResendSuccess:!1});s();async function s(){if(o.isConfirming)return;o.isConfirming=!0;let e=new n(app.pb.baseURL);try{await e.collection(a.collectionId).confirmVerification(i),o.isConfirmSuccess=!0}catch{o.isConfirmSuccess=!1}o.isConfirming=!1}async function c(){if(o.isResending)return;o.isResending=!0;let e=new n(`../`);try{await e.collection(a.collectionId).requestVerification(a.email),o.isResendSuccess=!0}catch(e){app.checkApiError(e),o.isResendSuccess=!1}o.isResending=!1}return t.div({pbEvent:`pageConfirmVerification`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),()=>o.isConfirming?t.div({className:`block txt-center`},t.span({className:`loader`},`Please wait...`)):o.isConfirmSuccess?t.div({pbEvent:`confirmVerificationSuccessAlert`,className:`alert success txt-center`},t.p(null,`Successfully verified `,t.strong(null,a.email),`.`)):o.isResendSuccess?t.div({pbEvent:`confirmVerificationResendAlert`,className:`alert success txt-center`},t.p(null,`Please check your email for the new verification link.`)):[t.div({pbEvent:`confirmVerificationErrorAlert`,className:`alert danger txt-center m-b-base`},t.p(null,`Invalid or expired verification token.`)),t.button({type:`button`,className:()=>`btn transparent lg block ${o.isResending?`loading`:``}`,disabled:()=>o.isResending,onclick:()=>c()},t.span({className:`txt`},`Resend`))])}export{r as pageConfirmVerification};
@@ -1 +1 @@
import{n as e,r as n}from"./index-vnblSM5A.js";function r(r){let i=r.params?.token||``;if(e(i).type!=`auth`||n(i)){app.toasts.error(`The installer token is invalid or has expired.`),window.location.hash=`#/`;return}app.store.title=`Setup your PocketBase instance`;let a=store({email:``,password:``,passwordConfirm:``,showPassword:!1,showPasswordConfirm:!1,isSubmitting:!1,isUploading:!1,get isBusy(){return a.isSubmitting||a.isUploading}});async function o(){if(!a.isBusy){a.isSubmitting=!0;try{await app.pb.collection(`_superusers`).create({email:a.email,password:a.password,passwordConfirm:a.passwordConfirm},{headers:{Authorization:i}}),await app.pb.collection(`_superusers`).authWithPassword(a.email,a.password),window.location.hash=`#/`}catch(e){app.checkApiError(e)}a.isSubmitting=!1}}let s=`backupFileInput`;function c(){let e=document.getElementById(s);e&&(e.value=``)}function l(e){e&&app.modals.confirm(t.h6(null,`Note that we don't perform validations for the uploaded backup files. Proceed with caution and only if you trust the file source.\n\nDo you really want to upload and initialize "${e.name}"?`),()=>{u(e)},()=>{c()})}async function u(e){if(!(!e||a.isBusy)){a.isUploading=!0;try{await app.pb.backups.upload({file:e},{headers:{Authorization:i}}),await app.pb.backups.restore(e.name,{headers:{Authorization:i}}),app.toasts.info(`Please wait while extracting the uploaded archive!`),await new Promise(e=>setTimeout(e,3e3)),window.location.href=`#/`}catch(e){app.checkApiError(e)}c(),a.isUploading=!1}}return t.div({pbEvent:`pageInstaller`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),t.form({pbEvent:`installerForm`,className:`grid installer-form`,onsubmit:e=>{e.preventDefault(),o(a)}},t.div({className:`col-12 txt-center`},`Create your first superuser account in order to continue:`),t.div({className:`col-12`},t.div({className:`field`},t.label({htmlFor:`superuser_email`},`Email`),t.input({id:`superuser_email`,name:`email`,type:`email`,required:!0,autofocus:!0,autocomplete:`off`,disabled:()=>a.isBusy,value:()=>a.email,oninput:e=>a.email=e.target.value}))),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`superuser_password`},`Password`),t.input({id:`superuser_password`,name:`password`,min:10,required:!0,disabled:()=>a.isBusy,type:()=>a.showPassword?`text`:`password`,value:()=>a.password,oninput:e=>a.password=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>a.showPassword?`Hide password`:`Show password`),onclick:()=>a.showPassword=!a.showPassword},t.i({className:()=>a.showPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0})))),t.div({className:`field-help`},`Recommended at least 10 characters.`)),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`superuser_password_confirm`},`Password confirm`),t.input({id:`superuser_password_confirm`,name:`passwordConfirm`,required:!0,disabled:()=>a.isBusy,type:()=>a.showPasswordConfirm?`text`:`password`,value:()=>a.passwordConfirm,oninput:e=>a.passwordConfirm=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>a.showPasswordConfirm?`Hide password`:`Show password`),onclick:()=>a.showPasswordConfirm=!a.showPasswordConfirm},t.i({className:()=>a.showPasswordConfirm?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg next block ${a.isSubmitting?`loading`:``}`,disabled:()=>a.isBusy},t.span({className:`txt`},`Create superuser and login`),t.i({className:`ri-arrow-right-line`,ariaHidden:!0})))),t.hr(),t.label({htmlFor:s,className:()=>`btn secondary transparent lg block ${a.isBusy?`disabled`:``} ${a.isUploading?`loading`:``}`},t.i({className:`ri-upload-cloud-line`,ariaHidden:!0}),t.span({className:`txt`},`Or initialize from backup`)),t.input({id:s,type:`file`,className:`hidden`,accept:`.zip`,onchange:e=>{l(e.target?.files?.[0])}}))}export{r as pageInstaller}; import{n as e,r as n}from"./index-DgPYXC7i.js";function r(r){let i=r.params?.token||``;if(e(i).type!=`auth`||n(i)){app.toasts.error(`The installer token is invalid or has expired.`),window.location.hash=`#/`;return}app.store.title=`Setup your PocketBase instance`;let a=store({email:``,password:``,passwordConfirm:``,showPassword:!1,showPasswordConfirm:!1,isSubmitting:!1,isUploading:!1,get isBusy(){return a.isSubmitting||a.isUploading}});async function o(){if(!a.isBusy){a.isSubmitting=!0;try{await app.pb.collection(`_superusers`).create({email:a.email,password:a.password,passwordConfirm:a.passwordConfirm},{headers:{Authorization:i}}),await app.pb.collection(`_superusers`).authWithPassword(a.email,a.password),window.location.hash=`#/`}catch(e){app.checkApiError(e)}a.isSubmitting=!1}}let s=`backupFileInput`;function c(){let e=document.getElementById(s);e&&(e.value=``)}function l(e){e&&app.modals.confirm(t.h6(null,`Note that we don't perform validations for the uploaded backup files. Proceed with caution and only if you trust the file source.\n\nDo you really want to upload and initialize "${e.name}"?`),()=>{u(e)},()=>{c()})}async function u(e){if(!(!e||a.isBusy)){a.isUploading=!0;try{await app.pb.backups.upload({file:e},{headers:{Authorization:i}}),await app.pb.backups.restore(e.name,{headers:{Authorization:i}}),app.toasts.info(`Please wait while extracting the uploaded archive!`),await new Promise(e=>setTimeout(e,3e3)),window.location.href=`#/`}catch(e){app.checkApiError(e)}c(),a.isUploading=!1}}return t.div({pbEvent:`pageInstaller`,className:`wrapper sm m-auto p-b-base`},t.header({className:`txt-center m-b-base`},t.img({className:`main-logo`,src:()=>app.store.mainLogo,ariaHidden:!0,alt:`App logo`}),t.h5({className:`m-t-10`},()=>app.store.title)),t.form({pbEvent:`installerForm`,className:`grid installer-form`,onsubmit:e=>{e.preventDefault(),o(a)}},t.div({className:`col-12 txt-center`},`Create your first superuser account in order to continue:`),t.div({className:`col-12`},t.div({className:`field`},t.label({htmlFor:`superuser_email`},`Email`),t.input({id:`superuser_email`,name:`email`,type:`email`,required:!0,autofocus:!0,autocomplete:`off`,disabled:()=>a.isBusy,value:()=>a.email,oninput:e=>a.email=e.target.value}))),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`superuser_password`},`Password`),t.input({id:`superuser_password`,name:`password`,min:10,required:!0,disabled:()=>a.isBusy,type:()=>a.showPassword?`text`:`password`,value:()=>a.password,oninput:e=>a.password=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>a.showPassword?`Hide password`:`Show password`),onclick:()=>a.showPassword=!a.showPassword},t.i({className:()=>a.showPassword?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0})))),t.div({className:`field-help`},`Recommended at least 10 characters.`)),t.div({className:`col-12`},t.div({className:`fields`},t.div({className:`field`},t.label({htmlFor:`superuser_password_confirm`},`Password confirm`),t.input({id:`superuser_password_confirm`,name:`passwordConfirm`,required:!0,disabled:()=>a.isBusy,type:()=>a.showPasswordConfirm?`text`:`password`,value:()=>a.passwordConfirm,oninput:e=>a.passwordConfirm=e.target.value})),t.div({className:`field addon`},t.button({type:`button`,tabIndex:-1,className:`btn sm transparent secondary circle tooltip-right`,ariaLabel:app.attrs.tooltip(()=>a.showPasswordConfirm?`Hide password`:`Show password`),onclick:()=>a.showPasswordConfirm=!a.showPasswordConfirm},t.i({className:()=>a.showPasswordConfirm?`ri-eye-off-line`:`ri-eye-line`,ariaHidden:!0}))))),t.div({className:`col-12`},t.button({className:()=>`btn lg next block ${a.isSubmitting?`loading`:``}`,disabled:()=>a.isBusy},t.span({className:`txt`},`Create superuser and login`),t.i({className:`ri-arrow-right-line`,ariaHidden:!0})))),t.hr(),t.label({htmlFor:s,className:()=>`btn secondary transparent lg block ${a.isBusy?`disabled`:``} ${a.isUploading?`loading`:``}`},t.i({className:`ri-upload-cloud-line`,ariaHidden:!0}),t.span({className:`txt`},`Or initialize from backup`)),t.input({id:s,type:`file`,className:`hidden`,accept:`.zip`,onchange:e=>{l(e.target?.files?.[0])}}))}export{r as pageInstaller};
+1 -1
View File
@@ -13,7 +13,7 @@
<!-- prism --> <!-- prism -->
<script src="./libs/prism/prism.js" data-manual></script> <script src="./libs/prism/prism.js" data-manual></script>
<script type="module" crossorigin src="./assets/index-vnblSM5A.js"></script> <script type="module" crossorigin src="./assets/index-DgPYXC7i.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BkwjA9HK.css"> <link rel="stylesheet" crossorigin href="./assets/index-BkwjA9HK.css">
</head> </head>
<body> <body>
+8 -8
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -20,9 +20,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -34,9 +34,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+14 -14
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -21,10 +21,10 @@ export function settings(data) {
type: "datetime-local", type: "datetime-local",
id: uniqueId + ".min", id: uniqueId + ".min",
step: 1, step: 1,
name: () => `fields.${data.fieldIndex}.min`, name: () => `fields.${props.fieldIndex}.min`,
value: () => app.utils.toDatetimeLocalInputValue(data.field.min), value: () => app.utils.toDatetimeLocalInputValue(props.field.min),
onchange: (e) => { onchange: (e) => {
data.field.min = app.utils.toRFC3339Datetime(e.target.value); props.field.min = app.utils.toRFC3339Datetime(e.target.value);
}, },
}), }),
), ),
@@ -38,10 +38,10 @@ export function settings(data) {
type: "datetime-local", type: "datetime-local",
id: uniqueId + ".max", id: uniqueId + ".max",
step: 1, step: 1,
name: () => `fields.${data.fieldIndex}.max`, name: () => `fields.${props.fieldIndex}.max`,
value: () => app.utils.toDatetimeLocalInputValue(data.field.max), value: () => app.utils.toDatetimeLocalInputValue(props.field.max),
onchange: (e) => { onchange: (e) => {
data.field.max = app.utils.toRFC3339Datetime(e.target.value); props.field.max = app.utils.toRFC3339Datetime(e.target.value);
}, },
}), }),
), ),
@@ -54,9 +54,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -68,9 +68,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+3 -3
View File
@@ -7,7 +7,7 @@
export function input(props) { export function input(props) {
const uniqueId = "editor_" + app.utils.randomString(); const uniqueId = "editor_" + app.utils.randomString();
const data = store({ const local = store({
lazyEditor: "", lazyEditor: "",
}); });
@@ -18,7 +18,7 @@ export function input(props) {
className: "record-field-input field-type-editor large-modal", className: "record-field-input field-type-editor large-modal",
onmount: () => { onmount: () => {
lazyEditorTimeoutId = setTimeout(() => { lazyEditorTimeoutId = setTimeout(() => {
data.lazyEditor = app.components.tinymce({ local.lazyEditor = app.components.tinymce({
id: uniqueId, id: uniqueId,
name: () => props.field.name, name: () => props.field.name,
required: () => props.field.required, required: () => props.field.required,
@@ -41,7 +41,7 @@ export function input(props) {
t.i({ className: app.fieldTypes.editor.icon, ariaHidden: true }), t.i({ className: app.fieldTypes.editor.icon, ariaHidden: true }),
t.span({ className: "txt" }, () => props.field.name), t.span({ className: "txt" }, () => props.field.name),
), ),
() => data.lazyEditor, () => local.lazyEditor,
), ),
() => { () => {
if (props.field.help) { if (props.field.help) {
+14 -14
View File
@@ -5,14 +5,14 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
const local = store({ const local = store({
showInfo: false, showInfo: false,
}); });
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -28,14 +28,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".maxSize", id: uniqueId + ".maxSize",
name: () => `fields.${data.fieldIndex}.maxSize`, name: () => `fields.${props.fieldIndex}.maxSize`,
min: 0, min: 0,
step: 1, step: 1,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
placeholder: "Default to max ~5MB", placeholder: "Default to max ~5MB",
value: () => data.field.maxSize || "", value: () => props.field.maxSize || "",
oninput: (e) => { oninput: (e) => {
data.field.maxSize = parseInt(e.target.value, 10); props.field.maxSize = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -48,9 +48,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -62,9 +62,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
@@ -81,9 +81,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".convertURLs", id: uniqueId + ".convertURLs",
name: () => `fields.${data.fieldIndex}.convertURLs`, name: () => `fields.${props.fieldIndex}.convertURLs`,
checked: () => !!data.field.convertURLs, checked: () => !!props.field.convertURLs,
onchange: (e) => (data.field.convertURLs = e.target.checked), onchange: (e) => (props.field.convertURLs = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".convertURLs" }, { htmlFor: uniqueId + ".convertURLs" },
+16 -16
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -29,12 +29,12 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".exceptDomains", id: uniqueId + ".exceptDomains",
disabled: () => !app.utils.isEmpty(data.field.onlyDomains), disabled: () => !app.utils.isEmpty(props.field.onlyDomains),
name: () => `fields.${data.fieldIndex}.exceptDomains`, name: () => `fields.${props.fieldIndex}.exceptDomains`,
value: () => app.utils.joinNonEmpty(data.field.exceptDomains), value: () => app.utils.joinNonEmpty(props.field.exceptDomains),
onchange: ( onchange: (
e, e,
) => (data.field.exceptDomains = app.utils.splitNonEmpty(e.target.value, ",")), ) => (props.field.exceptDomains = app.utils.splitNonEmpty(e.target.value, ",")),
}), }),
), ),
t.div({ className: "field-help" }, "Use comma as separator."), t.div({ className: "field-help" }, "Use comma as separator."),
@@ -56,10 +56,10 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".onlyDomains", id: uniqueId + ".onlyDomains",
disabled: () => !app.utils.isEmpty(data.field.exceptDomains), disabled: () => !app.utils.isEmpty(props.field.exceptDomains),
name: () => `fields.${data.fieldIndex}.onlyDomains`, name: () => `fields.${props.fieldIndex}.onlyDomains`,
value: () => app.utils.joinNonEmpty(data.field.onlyDomains), value: () => app.utils.joinNonEmpty(props.field.onlyDomains),
onchange: (e) => (data.field.onlyDomains = app.utils.splitNonEmpty(e.target.value, ",")), onchange: (e) => (props.field.onlyDomains = app.utils.splitNonEmpty(e.target.value, ",")),
}), }),
), ),
t.div({ className: "field-help" }, "Use comma as separator."), t.div({ className: "field-help" }, "Use comma as separator."),
@@ -72,9 +72,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -86,9 +86,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+38 -36
View File
@@ -5,7 +5,7 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
const isMultipleOptions = [ const isMultipleOptions = [
@@ -13,7 +13,7 @@ export function settings(data) {
{ label: "Multiple", value: true }, { label: "Multiple", value: true },
]; ];
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
header: [ header: [
t.div( t.div(
{ {
@@ -23,15 +23,15 @@ export function settings(data) {
required: true, required: true,
options: isMultipleOptions, options: isMultipleOptions,
value: () => { value: () => {
return data.field.maxSelect > 1; return props.field.maxSelect > 1;
}, },
onchange: (opts) => { onchange: (opts) => {
if (opts?.[0]?.value) { if (opts?.[0]?.value) {
if (!data.field.maxSelect || data.field.maxSelect < 2) { if (!props.field.maxSelect || props.field.maxSelect < 2) {
data.field.maxSelect = 10; props.field.maxSelect = 10;
} }
} else { } else {
data.field.maxSelect = 1; props.field.maxSelect = 1;
} }
}, },
}), }),
@@ -68,9 +68,9 @@ export function settings(data) {
), ),
}; };
}), }),
name: () => `fields.${data.fieldIndex}.mimeTypes`, name: () => `fields.${props.fieldIndex}.mimeTypes`,
value: () => app.utils.toArray(data.field.mimeTypes), value: () => app.utils.toArray(props.field.mimeTypes),
onchange: (opts) => (data.field.mimeTypes = opts.map((opt) => opt.value)), onchange: (opts) => (props.field.mimeTypes = opts.map((opt) => opt.value)),
}), }),
), ),
t.div( t.div(
@@ -95,7 +95,7 @@ export function settings(data) {
className: "dropdown-item", className: "dropdown-item",
role: "menuitem", role: "menuitem",
onclick: (e) => { onclick: (e) => {
data.field.mimeTypes = [ props.field.mimeTypes = [
"image/jpeg", "image/jpeg",
"image/png", "image/png",
"image/svg+xml", "image/svg+xml",
@@ -112,7 +112,7 @@ export function settings(data) {
className: "dropdown-item", className: "dropdown-item",
role: "menuitem", role: "menuitem",
onclick: (e) => { onclick: (e) => {
data.field.mimeTypes = [ props.field.mimeTypes = [
"application/pdf", "application/pdf",
"application/msword", "application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
@@ -129,7 +129,7 @@ export function settings(data) {
className: "dropdown-item", className: "dropdown-item",
role: "menuitem", role: "menuitem",
onclick: (e) => { onclick: (e) => {
data.field.mimeTypes = [ props.field.mimeTypes = [
"video/mp4", "video/mp4",
"video/mpeg", "video/mpeg",
"video/x-msvideo", "video/x-msvideo",
@@ -146,7 +146,7 @@ export function settings(data) {
className: "dropdown-item", className: "dropdown-item",
role: "menuitem", role: "menuitem",
onclick: (e) => { onclick: (e) => {
data.field.mimeTypes = [ props.field.mimeTypes = [
"application/zip", "application/zip",
"application/x-7z-compressed", "application/x-7z-compressed",
"application/x-rar-compressed", "application/x-rar-compressed",
@@ -160,7 +160,7 @@ export function settings(data) {
), ),
), ),
t.div( t.div(
{ className: () => (data.field.maxSelect > 1 ? "col-sm-6" : "col-sm-9") }, { className: () => (props.field.maxSelect > 1 ? "col-sm-6" : "col-sm-9") },
t.div( t.div(
{ className: "field" }, { className: "field" },
t.label( t.label(
@@ -179,9 +179,9 @@ export function settings(data) {
type: "text", type: "text",
id: uniqueId + ".thumbs", id: uniqueId + ".thumbs",
placeholder: "e.g. 50x50, 480x720", placeholder: "e.g. 50x50, 480x720",
name: () => `fields.${data.fieldIndex}.thumbs`, name: () => `fields.${props.fieldIndex}.thumbs`,
value: () => app.utils.joinNonEmpty(data.field.thumbs), value: () => app.utils.joinNonEmpty(props.field.thumbs),
onchange: (e) => (data.field.thumbs = app.utils.splitNonEmpty(e.target.value, ",")), onchange: (e) => (props.field.thumbs = app.utils.splitNonEmpty(e.target.value, ",")),
}), }),
), ),
t.div( t.div(
@@ -250,15 +250,15 @@ export function settings(data) {
min: 0, min: 0,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
placeholder: "~5MB default", placeholder: "~5MB default",
name: () => `fields.${data.fieldIndex}.maxSize`, name: () => `fields.${props.fieldIndex}.maxSize`,
value: () => data.field.maxSize || "", value: () => props.field.maxSize || "",
oninput: (e) => (data.field.maxSize = parseInt(e.target.value, 10)), oninput: (e) => (props.field.maxSize = parseInt(e.target.value, 10)),
}), }),
), ),
t.div({ className: "field-help" }, "In bytes."), t.div({ className: "field-help" }, "In bytes."),
), ),
() => { () => {
if (data.field.maxSelect > 1) { if (props.field.maxSelect > 1) {
return t.div( return t.div(
{ className: "col-sm-3" }, { className: "col-sm-3" },
t.div( t.div(
@@ -272,14 +272,14 @@ export function settings(data) {
min: 2, min: 2,
required: true, required: true,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
name: () => `fields.${data.fieldIndex}.maxSelect`, name: () => `fields.${props.fieldIndex}.maxSelect`,
value: () => data.field.maxSelect || "", value: () => props.field.maxSelect || "",
onchange: (e) => { onchange: (e) => {
const maxSelect = parseInt(e.target.value, 10); const maxSelect = parseInt(e.target.value, 10);
if (maxSelect > 1) { if (maxSelect > 1) {
data.field.maxSelect = maxSelect; props.field.maxSelect = maxSelect;
} else { } else {
data.field.maxSelect = 1; props.field.maxSelect = 1;
} }
}, },
}), }),
@@ -295,9 +295,9 @@ export function settings(data) {
className: "switch", className: "switch",
type: "checkbox", type: "checkbox",
id: uniqueId + ".protected", id: uniqueId + ".protected",
name: () => `fields.${data.fieldIndex}.protected`, name: () => `fields.${props.fieldIndex}.protected`,
checked: () => !!data.field.protected, checked: () => !!props.field.protected,
onchange: (e) => (data.field.protected = e.target.checked), onchange: (e) => (props.field.protected = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".protected" }, { htmlFor: uniqueId + ".protected" },
@@ -324,9 +324,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -338,17 +338,19 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
t.span({ className: "txt" }, "Required"), t.span({ className: "txt" }, "Required"),
t.small({ className: "txt-hint" }, "(!='')"), t.small({ className: "txt-hint" }, () => props.field.maxSelect > 1 ? "(!=[])" : "(!='')"),
t.i({ t.i({
className: "ri-information-line link-hint", className: "ri-information-line link-hint",
ariaDescription: app.attrs.tooltip("Requires the field value to be nonempty string"), ariaDescription: app.attrs.tooltip(() =>
`Requires the field value to be nonempty ${props.field.maxSelect > 1 ? "array" : "string"}`
),
}), }),
), ),
), ),
+17 -17
View File
@@ -4,7 +4,7 @@
// get record: undefined, // get record: undefined,
// get field: undefined, // get field: undefined,
// } // }
export function input(data) { export function input(props) {
const uniqueId = "geo_" + app.utils.randomString(); const uniqueId = "geo_" + app.utils.randomString();
const local = store({ const local = store({
@@ -14,11 +14,11 @@ export function input(data) {
return t.div( return t.div(
{ className: "record-field-input field-type-geoPoint" }, { className: "record-field-input field-type-geoPoint" },
t.div( t.div(
{ className: () => `field-list ${data.field.required ? "required" : ""}` }, { className: () => `field-list ${props.field.required ? "required" : ""}` },
t.label( t.label(
{ htmlFor: uniqueId }, { htmlFor: uniqueId },
t.i({ className: app.fieldTypes.geoPoint.icon, ariaHidden: true }), t.i({ className: app.fieldTypes.geoPoint.icon, ariaHidden: true }),
t.span({ className: "txt" }, () => data.field.name), t.span({ className: "txt" }, () => props.field.name),
), ),
t.div( t.div(
{ className: "field-list-content" }, { className: "field-list-content" },
@@ -36,12 +36,12 @@ export function input(data) {
min: -180, min: -180,
max: 180, max: 180,
placeholder: 0, placeholder: 0,
name: () => data.field.name, name: () => props.field.name,
required: () => data.field.required, required: () => props.field.required,
value: () => data.record[data.field.name]?.lon || "", value: () => props.record[props.field.name]?.lon || "",
onchange: (e) => { onchange: (e) => {
data.record[data.field.name] = data.record[data.field.name] || {}; props.record[props.field.name] = props.record[props.field.name] || {};
data.record[data.field.name].lon = Number(e.target.value); props.record[props.field.name].lon = Number(e.target.value);
}, },
}), }),
), ),
@@ -56,12 +56,12 @@ export function input(data) {
min: -90, min: -90,
max: 90, max: 90,
placeholder: 0, placeholder: 0,
name: () => data.field.name, name: () => props.field.name,
required: () => data.field.required, required: () => props.field.required,
value: () => data.record[data.field.name]?.lat || "", value: () => props.record[props.field.name]?.lat || "",
onchange: (e) => { onchange: (e) => {
data.record[data.field.name] = data.record[data.field.name] || {}; props.record[props.field.name] = props.record[props.field.name] || {};
data.record[data.field.name].lat = Number(e.target.value); props.record[props.field.name].lat = Number(e.target.value);
}, },
}), }),
), ),
@@ -87,9 +87,9 @@ export function input(data) {
return t.div( return t.div(
{ className: "field-list-item p-0", style: "height: 250px" }, { className: "field-list-item p-0", style: "height: 250px" },
app.components.leaflet({ app.components.leaflet({
point: () => data.record[data.field.name] || { lat: 0, lon: 0 }, point: () => props.record[props.field.name] || { lat: 0, lon: 0 },
onchange: (newPoint) => { onchange: (newPoint) => {
data.record[data.field.name] = structuredClone(newPoint); props.record[props.field.name] = structuredClone(newPoint);
}, },
}), }),
); );
@@ -97,8 +97,8 @@ export function input(data) {
), ),
), ),
() => { () => {
if (data.field.help) { if (props.field.help) {
return t.div({ className: "field-help" }, data.field.help); return t.div({ className: "field-help" }, props.field.help);
} }
}, },
); );
+8 -8
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -20,9 +20,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -34,9 +34,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+2 -2
View File
@@ -3,11 +3,11 @@
// field: undefined, // field: undefined,
// short: false, // short: false,
// } // }
export function view(data) { export function view(props) {
return t.div( return t.div(
{ className: "record-field-view field-type-geoPoint" }, { className: "record-field-view field-type-geoPoint" },
t.span({ className: "label" }, () => { t.span({ className: "label" }, () => {
const coords = data.record[data.field.name]; const coords = props.record[props.field.name];
return `${coords?.lon || 0}, ${coords?.lat || 0}`; return `${coords?.lon || 0}, ${coords?.lat || 0}`;
}), }),
); );
+11 -11
View File
@@ -5,14 +5,14 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
const local = store({ const local = store({
showInfo: false, showInfo: false,
}); });
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -28,14 +28,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".maxSize", id: uniqueId + ".maxSize",
name: () => `fields.${data.fieldIndex}.maxSize`, name: () => `fields.${props.fieldIndex}.maxSize`,
min: 0, min: 0,
step: 1, step: 1,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
placeholder: "Default to max ~1MB", placeholder: "Default to max ~1MB",
value: () => data.field.maxSize || "", value: () => props.field.maxSize || "",
oninput: (e) => { oninput: (e) => {
data.field.maxSize = parseInt(e.target.value, 10); props.field.maxSize = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -48,9 +48,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -114,9 +114,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+20 -20
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -20,13 +20,13 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".min", id: uniqueId + ".min",
name: () => `fields.${data.fieldIndex}.min`, name: () => `fields.${props.fieldIndex}.min`,
value: () => typeof data.field.min == "number" ? data.field.min : "", value: () => typeof props.field.min == "number" ? props.field.min : "",
oninput: (e) => { oninput: (e) => {
if (!e.target.value) { if (!e.target.value) {
data.field.min = null; props.field.min = null;
} else { } else {
data.field.min = Number(e.target.value); props.field.min = Number(e.target.value);
} }
}, },
}), }),
@@ -40,14 +40,14 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".max", id: uniqueId + ".max",
min: () => data.field.min, min: () => props.field.min,
name: () => `fields.${data.fieldIndex}.max`, name: () => `fields.${props.fieldIndex}.max`,
value: () => typeof data.field.max == "number" ? data.field.max : "", value: () => typeof props.field.max == "number" ? props.field.max : "",
oninput: (e) => { oninput: (e) => {
if (!e.target.value) { if (!e.target.value) {
data.field.max = null; props.field.max = null;
} else { } else {
data.field.max = Number(e.target.value); props.field.max = Number(e.target.value);
} }
}, },
}), }),
@@ -61,9 +61,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -75,9 +75,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
@@ -95,9 +95,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".onlyInt", id: uniqueId + ".onlyInt",
name: () => `fields.${data.fieldIndex}.onlyInt`, name: () => `fields.${props.fieldIndex}.onlyInt`,
checked: () => !!data.field.onlyInt, checked: () => !!props.field.onlyInt,
onchange: (e) => (data.field.onlyInt = e.target.checked), onchange: (e) => (props.field.onlyInt = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".onlyInt" }, { htmlFor: uniqueId + ".onlyInt" },
+22 -22
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
showHidden: false, showHidden: false,
showPresentable: false, showPresentable: false,
showDuplicate: false, showDuplicate: false,
@@ -29,14 +29,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".min", id: uniqueId + ".min",
name: () => `fields.${data.fieldIndex}.min`, name: () => `fields.${props.fieldIndex}.min`,
step: 1, step: 1,
min: 0, min: 0,
max: 71, max: 71,
placeholder: "No min limit", placeholder: "No min limit",
value: () => data.field.min || "", value: () => props.field.min || "",
oninput: (e) => { oninput: (e) => {
data.field.min = parseInt(e.target.value, 10); props.field.min = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -58,14 +58,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".max", id: uniqueId + ".max",
name: () => `fields.${data.fieldIndex}.max`, name: () => `fields.${props.fieldIndex}.max`,
step: 1, step: 1,
min: () => data.field.min || 0, min: () => props.field.min || 0,
max: 71, max: 71,
placeholder: "Up to 71 chars", placeholder: "Up to 71 chars",
value: () => data.field.max || "", value: () => props.field.max || "",
oninput: (e) => { oninput: (e) => {
data.field.max = parseInt(e.target.value, 10); props.field.max = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -87,15 +87,15 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".cost", id: uniqueId + ".cost",
name: () => `fields.${data.fieldIndex}.cost`, name: () => `fields.${props.fieldIndex}.cost`,
step: 1, step: 1,
// https://pkg.go.dev/golang.org/x/crypto/bcrypt#pkg-constants // https://pkg.go.dev/golang.org/x/crypto/bcrypt#pkg-constants
min: 4, min: 4,
max: 31, max: 31,
placeholder: "Default to 10", placeholder: "Default to 10",
value: () => data.field.cost || "", value: () => props.field.cost || "",
oninput: (e) => { oninput: (e) => {
data.field.cost = parseInt(e.target.value, 10); props.field.cost = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -112,9 +112,9 @@ export function settings(data) {
type: "text", type: "text",
id: uniqueId + ".pattern", id: uniqueId + ".pattern",
placeholder: "ex. ^\\w+$", placeholder: "ex. ^\\w+$",
name: () => `fields.${data.fieldIndex}.pattern`, name: () => `fields.${props.fieldIndex}.pattern`,
value: () => data.field.pattern || "", value: () => props.field.pattern || "",
oninput: (e) => (data.field.pattern = e.target.value), oninput: (e) => (props.field.pattern = e.target.value),
}), }),
), ),
), ),
@@ -126,16 +126,16 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
), ),
footer: () => { footer: () => {
// the system password auth field is always required // the system password auth field is always required
if (data.collection?.type == "auth" && data.field.name == "password") { if (props.collection?.type == "auth" && props.field.name == "password") {
return; return;
} }
@@ -146,9 +146,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+4 -2
View File
@@ -192,10 +192,12 @@ export function settings(props) {
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
t.span({ className: "txt" }, "Required"), t.span({ className: "txt" }, "Required"),
t.small({ className: "txt-hint" }, "(!='')"), t.small({ className: "txt-hint" }, () => props.field.maxSelect > 1 ? "(!=[])" : "(!='')"),
t.i({ t.i({
className: "ri-information-line link-hint", className: "ri-information-line link-hint",
ariaDescription: app.attrs.tooltip("Requires the field value to be nonempty string"), ariaDescription: app.attrs.tooltip(() =>
`Requires the field value to be nonempty ${props.field.maxSelect > 1 ? "array" : "string"}`
),
}), }),
), ),
), ),
+4 -9
View File
@@ -170,17 +170,12 @@ export function settings(props) {
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
t.span({ className: "txt" }, "Required"), t.span({ className: "txt" }, "Required"),
t.small({ t.small({ className: "txt-hint" }, () => props.field.maxSelect > 1 ? "(!=[])" : "(!='')"),
className: "txt-hint",
textContent: () => (props.field.maxSelect > 1 ? "(!=[])" : "(!='')"),
}),
t.i({ t.i({
className: "ri-information-line link-hint", className: "ri-information-line link-hint",
ariaDescription: app.attrs.tooltip(() => { ariaDescription: app.attrs.tooltip(() =>
return `Requires the field value to be nonempty ${ `Requires the field value to be nonempty ${props.field.maxSelect > 1 ? "array" : "string"}`
props.field.maxSelect > 1 ? "array" : "string" ),
}.`;
}),
}), }),
), ),
), ),
+5 -5
View File
@@ -7,7 +7,7 @@
export function input(props) { export function input(props) {
const uniqueId = "text_" + app.utils.randomString(); const uniqueId = "text_" + app.utils.randomString();
const data = store({ const local = store({
get hasAutogenerate() { get hasAutogenerate() {
return !app.utils.isEmpty(props.field.autogeneratePattern) && app.utils.isEmpty(props.originalRecord?.id); return !app.utils.isEmpty(props.field.autogeneratePattern) && app.utils.isEmpty(props.originalRecord?.id);
}, },
@@ -15,7 +15,7 @@ export function input(props) {
return !app.utils.isEmpty(props.originalRecord?.id) && props.field.primaryKey; return !app.utils.isEmpty(props.originalRecord?.id) && props.field.primaryKey;
}, },
get isRequired() { get isRequired() {
return props.field.required && !data.hasAutogenerate && !data.isDisabled; return props.field.required && !local.hasAutogenerate && !local.isDisabled;
}, },
}); });
@@ -46,9 +46,9 @@ export function input(props) {
// className: "autoexpand", // className: "autoexpand",
rows: 1, rows: 1,
name: () => props.field.name, name: () => props.field.name,
required: () => data.isRequired, required: () => local.isRequired,
disabled: () => data.isDisabled, disabled: () => local.isDisabled,
placeholder: () => (data.hasAutogenerate ? "Leave empty to autogenerate..." : ""), placeholder: () => (local.hasAutogenerate ? "Leave empty to autogenerate..." : ""),
value: () => props.record[props.field.name] || "", value: () => props.record[props.field.name] || "",
oninput: (e) => (props.record[props.field.name] = e.target.value || ""), oninput: (e) => (props.record[props.field.name] = e.target.value || ""),
}), }),
+22 -22
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -27,14 +27,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".min", id: uniqueId + ".min",
name: () => `fields.${data.fieldIndex}.min`, name: () => `fields.${props.fieldIndex}.min`,
step: 1, step: 1,
min: 0, min: 0,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
placeholder: "No min limit", placeholder: "No min limit",
value: () => data.field.min || "", value: () => props.field.min || "",
oninput: (e) => { oninput: (e) => {
data.field.min = parseInt(e.target.value, 10); props.field.min = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -56,14 +56,14 @@ export function settings(data) {
t.input({ t.input({
type: "number", type: "number",
id: uniqueId + ".max", id: uniqueId + ".max",
name: () => `fields.${data.fieldIndex}.max`, name: () => `fields.${props.fieldIndex}.max`,
step: 1, step: 1,
min: () => data.field.min || 0, min: () => props.field.min || 0,
max: Number.MAX_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER,
placeholder: "Default to max 5000 characters", placeholder: "Default to max 5000 characters",
value: () => data.field.max || "", value: () => props.field.max || "",
oninput: (e) => { oninput: (e) => {
data.field.max = parseInt(e.target.value, 10); props.field.max = parseInt(e.target.value, 10);
}, },
}), }),
), ),
@@ -76,7 +76,7 @@ export function settings(data) {
{ htmlFor: uniqueId + ".pattern" }, { htmlFor: uniqueId + ".pattern" },
t.span({ className: "txt" }, "Validation pattern"), t.span({ className: "txt" }, "Validation pattern"),
() => { () => {
if (data.field.primaryKey) { if (props.field.primaryKey) {
return t.i({ return t.i({
className: "ri-information-line link-hint", className: "ri-information-line link-hint",
ariaDescription: app.attrs.tooltip( ariaDescription: app.attrs.tooltip(
@@ -89,9 +89,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".pattern", id: uniqueId + ".pattern",
name: () => `fields.${data.fieldIndex}.pattern`, name: () => `fields.${props.fieldIndex}.pattern`,
value: () => data.field.pattern || "", value: () => props.field.pattern || "",
oninput: (e) => (data.field.pattern = e.target.value), oninput: (e) => (props.field.pattern = e.target.value),
}), }),
), ),
t.div({ className: "field-help" }, "Ex. ", t.code(null, "^[a-z0-9]+$")), t.div({ className: "field-help" }, "Ex. ", t.code(null, "^[a-z0-9]+$")),
@@ -113,9 +113,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".autogeneratePattern", id: uniqueId + ".autogeneratePattern",
name: () => `fields.${data.fieldIndex}.autogeneratePattern`, name: () => `fields.${props.fieldIndex}.autogeneratePattern`,
value: () => data.field.autogeneratePattern || "", value: () => props.field.autogeneratePattern || "",
oninput: (e) => (data.field.autogeneratePattern = e.target.value), oninput: (e) => (props.field.autogeneratePattern = e.target.value),
}), }),
), ),
t.div({ className: "field-help" }, "Ex. ", t.code(null, "[a-z0-9]{30}")), t.div({ className: "field-help" }, "Ex. ", t.code(null, "[a-z0-9]{30}")),
@@ -128,9 +128,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -142,9 +142,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },
+16 -16
View File
@@ -5,10 +5,10 @@
// get fieldIndex: int/-1, // get fieldIndex: int/-1,
// get originalField: undefined // get originalField: undefined
// } // }
export function settings(data) { export function settings(props) {
const uniqueId = "f_" + app.utils.randomString(); const uniqueId = "f_" + app.utils.randomString();
return app.components.fieldSettings(data, { return app.components.fieldSettings(props, {
content: () => content: () =>
t.div( t.div(
{ className: "grid sm" }, { className: "grid sm" },
@@ -29,12 +29,12 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".exceptDomains", id: uniqueId + ".exceptDomains",
disabled: () => !app.utils.isEmpty(data.field.onlyDomains), disabled: () => !app.utils.isEmpty(props.field.onlyDomains),
name: () => `fields.${data.fieldIndex}.exceptDomains`, name: () => `fields.${props.fieldIndex}.exceptDomains`,
value: () => app.utils.joinNonEmpty(data.field.exceptDomains), value: () => app.utils.joinNonEmpty(props.field.exceptDomains),
onchange: ( onchange: (
e, e,
) => (data.field.exceptDomains = app.utils.splitNonEmpty(e.target.value, ",")), ) => (props.field.exceptDomains = app.utils.splitNonEmpty(e.target.value, ",")),
}), }),
), ),
t.div({ className: "field-help" }, "Use comma as separator."), t.div({ className: "field-help" }, "Use comma as separator."),
@@ -56,10 +56,10 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".onlyDomains", id: uniqueId + ".onlyDomains",
disabled: () => !app.utils.isEmpty(data.field.exceptDomains), disabled: () => !app.utils.isEmpty(props.field.exceptDomains),
name: () => `fields.${data.fieldIndex}.onlyDomains`, name: () => `fields.${props.fieldIndex}.onlyDomains`,
value: () => app.utils.joinNonEmpty(data.field.onlyDomains), value: () => app.utils.joinNonEmpty(props.field.onlyDomains),
onchange: (e) => (data.field.onlyDomains = app.utils.splitNonEmpty(e.target.value, ",")), onchange: (e) => (props.field.onlyDomains = app.utils.splitNonEmpty(e.target.value, ",")),
}), }),
), ),
t.div({ className: "field-help" }, "Use comma as separator."), t.div({ className: "field-help" }, "Use comma as separator."),
@@ -72,9 +72,9 @@ export function settings(data) {
t.input({ t.input({
type: "text", type: "text",
id: uniqueId + ".help", id: uniqueId + ".help",
name: () => `fields.${data.fieldIndex}.help`, name: () => `fields.${props.fieldIndex}.help`,
value: () => data.field.help || "", value: () => props.field.help || "",
oninput: (e) => (data.field.help = e.target.value), oninput: (e) => (props.field.help = e.target.value),
}), }),
), ),
), ),
@@ -86,9 +86,9 @@ export function settings(data) {
className: "sm", className: "sm",
type: "checkbox", type: "checkbox",
id: uniqueId + ".required", id: uniqueId + ".required",
name: () => `fields.${data.fieldIndex}.required`, name: () => `fields.${props.fieldIndex}.required`,
checked: () => !!data.field.required, checked: () => !!props.field.required,
onchange: (e) => (data.field.required = e.target.checked), onchange: (e) => (props.field.required = e.target.checked),
}), }),
t.label( t.label(
{ htmlFor: uniqueId + ".required" }, { htmlFor: uniqueId + ".required" },