This commit is contained in:
Arseny Sazhin (via WeWeb) 2025-07-10 13:51:41 +03:00
parent 6b2ac65471
commit e47d3da842
53 changed files with 254 additions and 298 deletions

View File

@ -1 +1 @@
{"name":"weweb-front","version":"4.0.0","private":true,"type":"module","scripts":{"serve":"vite","build":"vite build","postbuild":"node ./postbuild.js"},"dependencies":{"@vueuse/head":"2.0.0","axios":"1.9.0","html-escaper":"3.0.3","lodash":"4.17.21","pinia":"3.0.2","short-unique-id":"5.3.2","tiny-emitter":"2.1.0","uuid":"11.1.0","vue":"3.5.13","vue-cookie-next":"1.3.0","vue-meta":"2.4.0","vue-router":"4.5.1","vuex":"4.1.0","@supabase/supabase-js":"2.43.5","dayjs":"1.11.0","qs":"^6.14.0","@vueform/multiselect":"2.6.2","@vueuse/core":"^13.0.0","lodash-es":"^4.17.21","animejs":"^3.2.2","vue-ellipse-progress":"^2.1.1","@vuepic/vue-datepicker":"3.6.8","date-fns":"4.1.0","diff":"^5.1.0","marked":"^14.1.2","medium-zoom":"^1.0.6","prismjs":"^1.23.0","@tiptap/extension-color":"2.8.0","@tiptap/extension-image":"2.8.0","@tiptap/extension-link":"2.8.0","@tiptap/extension-mention":"2.8.0","@tiptap/extension-placeholder":"2.8.0","@tiptap/extension-table":"2.8.0","@tiptap/extension-table-cell":"2.8.0","@tiptap/extension-table-header":"2.8.0","@tiptap/extension-table-row":"2.8.0","@tiptap/extension-task-item":"2.8.0","@tiptap/extension-task-list":"2.8.0","@tiptap/extension-text-align":"2.8.0","@tiptap/extension-text-style":"2.8.0","@tiptap/extension-underline":"2.8.0","@tiptap/pm":"2.8.0","@tiptap/starter-kit":"2.8.0","@tiptap/suggestion":"2.8.0","@tiptap/vue-3":"2.8.0","prosemirror-commands":"1.5.0","prosemirror-dropcursor":"1.5.0","prosemirror-gapcursor":"1.3.1","prosemirror-history":"1.3.0","prosemirror-keymap":"1.2.0","prosemirror-schema-list":"1.2.2","tiptap-markdown":"^0.8.10"},"devDependencies":{"@vitejs/plugin-vue":"5.2.4","autoprefixer":"10.4.21","handlebars":"4.7.8","sass-embedded":"1.89.0","vite":"6.3.5","vite-plugin-node-polyfills":"0.23.0"},"browserslist":["last 3 years"]}
{"name":"weweb-front","version":"4.0.0","private":true,"type":"module","scripts":{"serve":"vite","build":"vite build","postbuild":"node ./postbuild.js"},"dependencies":{"@vueuse/head":"2.0.0","axios":"1.9.0","html-escaper":"3.0.3","lodash":"4.17.21","pinia":"3.0.2","short-unique-id":"5.3.2","tiny-emitter":"2.1.0","uuid":"11.1.0","vue":"3.5.13","vue-cookie-next":"1.3.0","vue-meta":"2.4.0","vue-router":"4.5.1","vuex":"4.1.0","dayjs":"1.11.0","@supabase/supabase-js":"2.50.3","qs":"^6.14.0","@vueform/multiselect":"2.6.2","vue-ellipse-progress":"^2.1.1","@vueuse/core":"^13.0.0","@vuepic/vue-datepicker":"3.6.8","date-fns":"4.1.0","diff":"^5.1.0","animejs":"^3.2.2","marked":"^14.1.2","medium-zoom":"^1.0.6","prismjs":"^1.23.0","lodash-es":"^4.17.21","@tiptap/extension-color":"2.8.0","@tiptap/extension-image":"2.8.0","@tiptap/extension-link":"2.8.0","@tiptap/extension-mention":"2.8.0","@tiptap/extension-placeholder":"2.8.0","@tiptap/extension-table":"2.8.0","@tiptap/extension-table-cell":"2.8.0","@tiptap/extension-table-header":"2.8.0","@tiptap/extension-table-row":"2.8.0","@tiptap/extension-task-item":"2.8.0","@tiptap/extension-task-list":"2.8.0","@tiptap/extension-text-align":"2.8.0","@tiptap/extension-text-style":"2.8.0","@tiptap/extension-underline":"2.8.0","@tiptap/pm":"2.8.0","@tiptap/starter-kit":"2.8.0","@tiptap/suggestion":"2.8.0","@tiptap/vue-3":"2.8.0","prosemirror-commands":"1.5.0","prosemirror-dropcursor":"1.5.0","prosemirror-gapcursor":"1.3.1","prosemirror-history":"1.3.0","prosemirror-keymap":"1.2.0","prosemirror-schema-list":"1.2.2","tiptap-markdown":"^0.8.10"},"devDependencies":{"@vitejs/plugin-vue":"5.2.4","autoprefixer":"10.4.21","handlebars":"4.7.8","sass-embedded":"1.89.0","vite":"6.3.5","vite-plugin-node-polyfills":"0.23.0"},"browserslist":["last 3 years"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"cacheVersion":68,"page":{"id":"cf9f551f-e733-4934-a682-535575cb7c70","paths":{"en":"promo","default":"promo"},"cmsDataSetPath":null,"workflows":[]},"sections":{"4a2188f6-d98c-4150-9ba7-5918c72f3421":{"uid":"4a2188f6-d98c-4150-9ba7-5918c72f3421","linkId":"416695e7-e54e-4897-9f9a-befeb223f1b0","_state":{"style":{"default":{}}},"content":{"default":{"wwObjects":[],"_ww-layout_alignItems":"flex-start","_ww-layout_flexDirection":"column"}},"sectionBaseId":"99586bd3-2b15-4d6b-a025-6a50d07ca845","sectionTitle":"Section"}},"wwObjects":{},"collections":[],"variables":[],"workflows":[],"formulas":[],"libraryComponents":[]}
{"cacheVersion":69,"page":{"id":"cf9f551f-e733-4934-a682-535575cb7c70","paths":{"en":"promo","default":"promo"},"cmsDataSetPath":null,"workflows":[]},"sections":{"4a2188f6-d98c-4150-9ba7-5918c72f3421":{"uid":"4a2188f6-d98c-4150-9ba7-5918c72f3421","linkId":"416695e7-e54e-4897-9f9a-befeb223f1b0","_state":{"style":{"default":{}}},"content":{"default":{"wwObjects":[],"_ww-layout_alignItems":"flex-start","_ww-layout_flexDirection":"column"}},"sectionBaseId":"99586bd3-2b15-4d6b-a025-6a50d07ca845","sectionTitle":"Section"}},"wwObjects":{},"collections":[],"variables":[],"workflows":[],"formulas":[],"libraryComponents":[]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
const version = 68;
const version = 69;
self.addEventListener('install', event => {
// eslint-disable-next-line no-console
console.log(`Service worker v${version} installed`);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -378,6 +378,7 @@ export default {
},
emits: ['trigger-event', 'update:content:effect', 'update:sidepanel-content'],
setup(props, { emit }) {
const { value: variableValue, setValue } = wwLib.wwVariable.useComponentVariable({
uid: props.uid,
name: 'value',

View File

@ -1588,7 +1588,7 @@ export default {
section: 'settings',
type: 'Formula',
defaultValue: '',
bindable: true,
bindable: false,
hidden: (content, sidePanelContent) => !sidePanelContent.form?.uid || !content.customValidation,
},
},

View File

@ -52,14 +52,34 @@ export function useFormInputs({ updateInputValidity, removeInputValidity }) {
function forceValidateAllFields() {
const validityMap = {};
const invalidFields = [];
for (const [id, inputs] of Object.entries(inputsMap.value)) {
for (const [name, input] of Object.entries(inputs)) {
if ('forceValidateField' in input) {
validityMap[id + name] = input.forceValidateField();
const isValid = input.forceValidateField();
validityMap[id + name] = isValid;
if (!isValid) {
invalidFields.push({
id: id,
name: name,
value: input.value,
isValid: isValid,
error: input.error || input.validationMessage || 'Validation failed'
});
}
}
}
}
return Object.values(validityMap).every(Boolean);
const isValid = Object.values(validityMap).every(Boolean);
return {
isValid,
invalidFields,
validityMap
};
}
function resetInputs(initialValues = {}) {

View File

@ -1,15 +1,26 @@
export function useFormSubmission({ emit, forceValidateAllFields }) {
export function useFormSubmission({ emit, forceValidateAllFields, formInputs, formName }) {
const handleSubmit = async event => {
try {
const isValid = forceValidateAllFields();
if (!isValid) {
const validationResult = forceValidateAllFields();
if (!validationResult.isValid) {
const invalidFields = validationResult.invalidFields;
const fieldNames = invalidFields.map(f => f.name).join(', ');
emit('trigger-event', { name: 'submit-validation-error', event });
} else {
const formData = Object.fromEntries(
Object.entries(formInputs?.value || {}).map(([key, input]) => [key, input.value])
);
emit('trigger-event', { name: 'submit', event });
}
} catch (error) {
console.error('Form submission error', error);
} finally {
}
};

View File

@ -93,6 +93,8 @@ export default {
isValid,
updateFormData,
validationType,
formInputs,
formName,
});
function _setFormState(isSubmitting, isSubmitted) {

View File

@ -98,6 +98,7 @@ export default {
},
emits: ['trigger-event', 'add-state', 'remove-state'],
setup(props, { emit }) {
const isEditing = computed(() => {
// eslint-disable-next-line no-unreachable
return false;

View File

@ -1161,7 +1161,7 @@ export default {
section: 'settings',
type: 'Formula',
defaultValue: '',
bindable: true,
bindable: false,
hidden: (content, sidePanelContent) => {
return !sidePanelContent.form?.uid || !content.customValidation;
},

View File

@ -83,6 +83,7 @@ export default {
'update:sidepanel-content',
],
setup(props, { emit }) {
const isEditing = computed(() => {
return false;
});

View File

@ -296,7 +296,7 @@ export default {
section: 'settings',
type: 'Formula',
defaultValue: '',
bindable: true,
bindable: false,
hidden: (content, sidePanelContent) => {
return !sidePanelContent.form?.uid || !content.customValidation;
},

View File

@ -1 +1 @@
{"name":"plugin-supabase-auth","repository":{"type":"git","url":"https://github.com/weweb-assets/plugin-supabase-auth"},"version":"3.1.0","features":{"auth":true},"license":"MIT","scripts":{"build":"weweb build","serve":"weweb serve"},"dependencies":{"@supabase/supabase-js":"2.43.5"},"devDependencies":{"@vue/eslint-config-prettier":"^6.0.0","eslint":"^7.7.0","eslint-plugin-prettier":"^3.1.4","eslint-plugin-vue":"7.0.0-beta.4","prettier":"^2.1.2"}}
{"name":"plugin-supabase-auth","repository":{"type":"git","url":"https://github.com/weweb-assets/plugin-supabase-auth"},"version":"3.1.0","features":{"auth":true},"license":"MIT","scripts":{"build":"weweb build","serve":"weweb serve"},"dependencies":{"@supabase/supabase-js":"2.50.3"},"devDependencies":{"@vue/eslint-config-prettier":"^6.0.0","eslint":"^7.7.0","eslint-plugin-prettier":"^3.1.4","eslint-plugin-vue":"7.0.0-beta.4","prettier":"^2.1.2"}}

View File

@ -1,37 +1,23 @@
<template>
<wwEditorFormRow class="w-100">
<wwEditorInputRadio
v-if="isConnected"
v-model="selectMode"
:disabled="isComingUp"
:choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]"
/>
<wwEditorInputRadio v-if="isConnected" v-model="selectMode" :disabled="isComingUp" :choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]" />
</wwEditorFormRow>
<template v-if="selectMode === 'select' || !isConnected">
<div class="flex items-center" v-if="isConnected">
<wwEditorFormRow required label="Project URL" class="w-100">
<wwEditorInput
type="select"
placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl"
:options="projectsOptions"
@update:modelValue="changeProjectUrl"
class="-full"
/>
<wwEditorInput type="select" placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl" :options="projectsOptions"
@update:modelValue="changeProjectUrl" class="-full" />
</wwEditorFormRow>
<button type="button" class="ww-editor-button -primary -small -icon ml-2 mt-1" @click="refreshProjects">
<wwEditorIcon name="refresh" medium />
</button>
</div>
<button
v-if="isConnected"
@click="showSettings = !showSettings"
class="ww-editor-button -secondary -small mb-2"
type="button"
>
<button v-if="isConnected" @click="showSettings = !showSettings" class="ww-editor-button -secondary -small mb-2"
type="button">
{{ showSettings ? 'Close' : 'Open' }} settings
</button>
<template v-if="showSettings || !isConnected">
@ -42,6 +28,13 @@
:model-value="settings.publicData.projectUrl"
@update:modelValue="changeProjectUrl"
/>
<wwEditorInputRow
label="Custom Domain (optional)"
type="query"
placeholder="https://your-custom-domain.com"
:model-value="settings.publicData.customDomain"
@update:modelValue="changeCustomDomain"
/>
<wwEditorInputRow
label="Public API key"
required
@ -52,52 +45,31 @@
/>
<wwEditorFormRow label="Service role key">
<div class="flex items-center">
<wwEditorInputText
type="password"
placeholder="ey********"
large
class="w-full"
:style="{ '-webkit-text-security': 'disc' }"
:model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey"
/>
<wwEditorQuestionMark
tooltip-position="top-left"
<wwEditorInputText type="password" placeholder="ey********" large class="w-full"
:style="{ '-webkit-text-security': 'disc' }" :model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey" />
<wwEditorQuestionMark tooltip-position="top-left"
forced-content="Required if you want to manage your users and roles from the Editor or restrict access to a page for a specific role."
class="ml-2"
:class="{ 'text-yellow-500': !settings.privateData.apiKey }"
/>
class="ml-2" :class="{ 'text-yellow-500': !settings.privateData.apiKey }" />
</div>
</wwEditorFormRow>
<wwEditorInputRow
v-show="false"
label="Connection string"
type="query"
<wwEditorInputRow v-show="false" label="Connection string" type="query"
placeholder="postgres://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@aws-0-eu-west-3.pooler.supabase.com:6543/postgres"
:model-value="settings.privateData.connectionString"
@update:modelValue="changeConnectionString"
/>
:model-value="settings.privateData.connectionString" @update:modelValue="changeConnectionString" />
<wwEditorFormRow label="Database password" v-show="false">
<template #append-label>
<a
class="ww-editor-link ml-2"
<a class="ww-editor-link ml-2"
:href="`https://supabase.com/dashboard/project/${projectRef}/settings/database`"
target="_blank"
>
target="_blank">
Find it here
</a>
</template>
<div class="flex items-center">
<wwEditorInputText
type="password"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }"
large
<wwEditorInputText type="password" placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }" large
:tooltip="`Required if you want Copilot to be able to update your database.`"
:model-value="settings.privateData.databasePassword"
@update:modelValue="changeDatabasePassword"
class="w-full"
/>
:model-value="settings.privateData.databasePassword" @update:modelValue="changeDatabasePassword"
class="w-full" />
</div>
</wwEditorFormRow>
</template>
@ -108,28 +80,13 @@
<div>We're now preparing your database. Please wait a few moments, it may take up to 1 minute.</div>
</div>
<template v-else>
<wwEditorInputRow
label="Project name"
type="query"
placeholder="My new project"
required
v-model="newProject.name"
/>
<wwEditorInputRow
label="Organization"
type="select"
placeholder="Select an organization"
required
<wwEditorInputRow label="Project name" type="query" placeholder="My new project" required
v-model="newProject.name" />
<wwEditorInputRow label="Organization" type="select" placeholder="Select an organization" required
v-model="newProject.organizationId"
:options="organizations.map(org => ({ label: org.name, value: org.id }))"
/>
<wwEditorInputRow
label="Hosting region"
type="select"
placeholder="us-east-1"
required
v-model="newProject.region"
:options="[
:options="organizations.map(org => ({ label: org.name, value: org.id }))" />
<wwEditorInputRow label="Hosting region" type="select" placeholder="us-east-1" required
v-model="newProject.region" :options="[
{ label: 'us-east-1', value: 'us-east-1' },
{ label: 'us-east-2', value: 'us-east-2' },
{ label: 'us-west-1', value: 'us-west-1' },
@ -148,23 +105,15 @@
{ label: 'ca-central-1', value: 'ca-central-1' },
{ label: 'ap-south-1', value: 'ap-south-1' },
{ label: 'sa-east-1', value: 'sa-east-1' },
]"
/>
]" />
<wwEditorFormRow label="Database password" required>
<div class="flex items-center">
<wwEditorInputText
:type="showDbPass ? 'text' : 'password'"
<wwEditorInputText :type="showDbPass ? 'text' : 'password'"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }"
large
v-model="newProject.dbPass"
class="w-full"
/>
<button
type="button"
class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass"
>
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }" large
v-model="newProject.dbPass" class="w-full" />
<button type="button" class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass">
<wwEditorIcon :name="showDbPass ? '16/eye' : '16/eye-off'" medium />
</button>
</div>
@ -278,6 +227,12 @@ export default {
},
});
},
changeCustomDomain(customDomain) {
this.$emit('update:settings', {
...this.settings,
publicData: { ...this.settings.publicData, customDomain },
});
},
changePublicApiKey(apiKey) {
this.$emit('update:settings', {
...this.settings,
@ -306,8 +261,7 @@ export default {
this.isLoading = true;
try {
const { data } = await wwAxios.post(
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${
this.$store.getters['websiteData/getDesignInfo'].id
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${this.$store.getters['websiteData/getDesignInfo'].id
}/supabase/projects/list`,
{ accessToken: this.settings.privateData.accessToken }
);
@ -322,8 +276,7 @@ export default {
this.isLoading = true;
try {
const { data } = await wwAxios.get(
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${
this.$store.getters['websiteData/getDesignInfo'].id
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${this.$store.getters['websiteData/getDesignInfo'].id
}/supabase/projects/${projectId}`
);
this.isLoading = false;
@ -337,8 +290,7 @@ export default {
this.isLoading = true;
try {
const { data } = await wwAxios.get(
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${
wwLib.$store.getters['websiteData/getDesignInfo'].id
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${wwLib.$store.getters['websiteData/getDesignInfo'].id
}/supabase/organizations`
);
this.isLoading = false;
@ -362,8 +314,7 @@ export default {
},
});
const { data } = await wwAxios.post(
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${
wwLib.$store.getters['websiteData/getDesignInfo'].id
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${wwLib.$store.getters['websiteData/getDesignInfo'].id
}/supabase/projects`,
{
name: this.newProject.name,

View File

@ -4,6 +4,11 @@
<div class="mr-2 content-secondary">project</div>
<div class="text-ellipsis">{{ settings.publicData.projectUrl }}</div>
</div>
<div v-if="settings.publicData.customDomain" class="flex items-center body-2 mb-2">
<wwEditorIcon name="globe" class="mr-2" />
<div class="mr-2 content-secondary">custom domain</div>
<div class="text-ellipsis">{{ settings.publicData.customDomain }}</div>
</div>
<div class="flex items-center body-2 mb-2">
<wwEditorIcon name="key" class="mr-2" />
<div class="mr-2 content-secondary">public</div>

View File

@ -8,7 +8,7 @@ export default {
\================================================================================================*/
async _onLoad(settings) {
/* wwFront:start */
await this.load(settings.publicData.projectUrl, settings.publicData.apiKey);
await this.load(settings.publicData.customDomain || settings.publicData.projectUrl, settings.publicData.apiKey);
/* wwFront:end */
},
async _initAuth() {

View File

@ -1 +1 @@
{"name":"plugin-supabase","repository":{"type":"git","url":"https://github.com/weweb-assets/plugin-supabase"},"version":"3.1.0","license":"MIT","scripts":{"build":"weweb build","serve":"weweb serve"},"dependencies":{"@supabase/supabase-js":"2.43.5"},"devDependencies":{"@vue/eslint-config-prettier":"^6.0.0","eslint":"^7.7.0","eslint-plugin-prettier":"^3.1.4","eslint-plugin-vue":"7.0.0-beta.4","prettier":"^2.1.2"}}
{"name":"plugin-supabase","repository":{"type":"git","url":"https://github.com/weweb-assets/plugin-supabase"},"version":"3.1.0","license":"MIT","scripts":{"build":"weweb build","serve":"weweb serve"},"dependencies":{"@supabase/supabase-js":"2.50.3"},"devDependencies":{"@vue/eslint-config-prettier":"^6.0.0","eslint":"^7.7.0","eslint-plugin-prettier":"^3.1.4","eslint-plugin-vue":"7.0.0-beta.4","prettier":"^2.1.2"}}

View File

@ -1,103 +1,59 @@
<template>
<wwEditorFormRow class="w-100">
<wwEditorInputRadio
v-if="isConnected"
v-model="selectMode"
:disabled="isComingUp"
:choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]"
/>
<wwEditorInputRadio v-if="isConnected" v-model="selectMode" :disabled="isComingUp" :choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]" />
</wwEditorFormRow>
<template v-if="selectMode === 'select' || !isConnected">
<div class="flex items-center" v-if="isConnected">
<wwEditorFormRow required label="Project URL" class="w-100">
<wwEditorInput
type="select"
placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl"
:options="projectsOptions"
@update:modelValue="changeProjectUrl"
class="-full"
/>
<wwEditorInput type="select" placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl" :options="projectsOptions"
@update:modelValue="changeProjectUrl" class="-full" />
</wwEditorFormRow>
<button type="button" class="ww-editor-button -primary -small -icon ml-2 mt-1" @click="refreshProjects">
<wwEditorIcon name="refresh" medium />
</button>
</div>
<button
v-if="isConnected"
@click="showSettings = !showSettings"
class="ww-editor-button -secondary -small mb-2"
type="button"
>
<button v-if="isConnected" @click="showSettings = !showSettings" class="ww-editor-button -secondary -small mb-2"
type="button">
{{ showSettings ? 'Close' : 'Open' }} settings
</button>
<template v-if="showSettings || !isConnected">
<wwEditorInputRow
label="Project URL"
type="query"
placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl"
@update:modelValue="changeProjectUrl"
/>
<wwEditorInputRow
label="Public API key"
required
type="query"
placeholder="ey********"
:model-value="settings.publicData.apiKey"
@update:modelValue="changeApiKey"
/>
<wwEditorInputRow label="Project URL" type="query" placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl" @update:modelValue="changeProjectUrl" />
<wwEditorInputRow label="Custom Domain (optional)" type="query" placeholder="https://your-custom-domain.com"
:model-value="settings.publicData.customDomain" @update:modelValue="changeCustomDomain" />
<wwEditorInputRow label="Public API key" required type="query" placeholder="ey********"
:model-value="settings.publicData.apiKey" @update:modelValue="changeApiKey" />
<wwEditorFormRow label="Service role key">
<div class="flex items-center">
<wwEditorInputText
type="password"
placeholder="ey********"
large
class="w-full"
:style="{ '-webkit-text-security': 'disc' }"
:model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey"
/>
<wwEditorQuestionMark
tooltip-position="top-left"
<wwEditorInputText type="password" placeholder="ey********" large class="w-full"
:style="{ '-webkit-text-security': 'disc' }" :model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey" />
<wwEditorQuestionMark tooltip-position="top-left"
forced-content="Required if you want to manage your users and roles from the Editor or restrict access to a page for a specific role."
class="ml-2"
:class="{ 'text-yellow-500': !settings.privateData.apiKey }"
/>
class="ml-2" :class="{ 'text-yellow-500': !settings.privateData.apiKey }" />
</div>
</wwEditorFormRow>
<wwEditorInputRow
v-show="false"
label="Connection string"
type="query"
<wwEditorInputRow v-show="false" label="Connection string" type="query"
placeholder="postgres://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@aws-0-eu-west-3.pooler.supabase.com:6543/postgres"
:model-value="settings.privateData.connectionString"
@update:modelValue="changeConnectionString"
/>
:model-value="settings.privateData.connectionString" @update:modelValue="changeConnectionString" />
<wwEditorFormRow label="Database password" v-show="false">
<template #append-label>
<a
class="ww-editor-link ml-2"
<a class="ww-editor-link ml-2"
:href="`https://supabase.com/dashboard/project/${projectRef}/settings/database`"
target="_blank"
>
target="_blank">
Find it here
</a>
</template>
<div class="flex items-center">
<wwEditorInputText
type="password"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }"
large
<wwEditorInputText type="password" placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }" large
:tooltip="`Required if you want Copilot to be able to update your database.`"
:model-value="settings.privateData.databasePassword"
@update:modelValue="changeDatabasePassword"
class="w-full"
/>
:model-value="settings.privateData.databasePassword" @update:modelValue="changeDatabasePassword"
class="w-full" />
</div>
</wwEditorFormRow>
</template>
@ -108,28 +64,13 @@
<div>We're now preparing your database. Please wait a few moments, it may take up to 1 minute.</div>
</div>
<template v-else>
<wwEditorInputRow
label="Project name"
type="query"
placeholder="My new project"
required
v-model="newProject.name"
/>
<wwEditorInputRow
label="Organization"
type="select"
placeholder="Select an organization"
required
<wwEditorInputRow label="Project name" type="query" placeholder="My new project" required
v-model="newProject.name" />
<wwEditorInputRow label="Organization" type="select" placeholder="Select an organization" required
v-model="newProject.organizationId"
:options="organizations.map(org => ({ label: org.name, value: org.id }))"
/>
<wwEditorInputRow
label="Hosting region"
type="select"
placeholder="us-east-1"
required
v-model="newProject.region"
:options="[
:options="organizations.map(org => ({ label: org.name, value: org.id }))" />
<wwEditorInputRow label="Hosting region" type="select" placeholder="us-east-1" required
v-model="newProject.region" :options="[
{ label: 'us-east-1', value: 'us-east-1' },
{ label: 'us-east-2', value: 'us-east-2' },
{ label: 'us-west-1', value: 'us-west-1' },
@ -148,23 +89,15 @@
{ label: 'ca-central-1', value: 'ca-central-1' },
{ label: 'ap-south-1', value: 'ap-south-1' },
{ label: 'sa-east-1', value: 'sa-east-1' },
]"
/>
]" />
<wwEditorFormRow label="Database password" required>
<div class="flex items-center">
<wwEditorInputText
:type="showDbPass ? 'text' : 'password'"
<wwEditorInputText :type="showDbPass ? 'text' : 'password'"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }"
large
v-model="newProject.dbPass"
class="w-full"
/>
<button
type="button"
class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass"
>
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }" large
v-model="newProject.dbPass" class="w-full" />
<button type="button" class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass">
<wwEditorIcon :name="showDbPass ? '16/eye' : '16/eye-off'" medium />
</button>
</div>
@ -249,6 +182,7 @@ export default {
...this.settings.publicData,
apiKey: wwLib.wwPlugins.supabaseAuth.settings.publicData.apiKey,
projectUrl: wwLib.wwPlugins.supabaseAuth.settings.publicData.projectUrl,
customDomain: wwLib.wwPlugins.supabaseAuth.settings.publicData.customDomain,
},
privateData: {
...this.settings.privateData,
@ -284,6 +218,12 @@ export default {
},
});
},
changeCustomDomain(customDomain) {
this.$emit('update:settings', {
...this.settings,
publicData: { ...this.settings.publicData, customDomain },
});
},
changeApiKey(apiKey) {
this.$emit('update:settings', {
...this.settings,

View File

@ -4,6 +4,11 @@
<div class="mr-2 content-secondary">project</div>
<div class="text-ellipsis">{{ settings.publicData.projectUrl }}</div>
</div>
<div v-if="settings.publicData.customDomain" class="flex items-center body-2 mb-2">
<wwEditorIcon name="globe" class="mr-2" />
<div class="mr-2 content-secondary">custom domain</div>
<div class="text-ellipsis">{{ settings.publicData.customDomain }}</div>
</div>
<div class="flex items-center body-2 mb-2">
<wwEditorIcon name="key" class="mr-2" />
<div class="mr-2 content-secondary">public</div>

View File

@ -9,7 +9,7 @@ export default {
Plugin API
\================================================================================================*/
async _onLoad(settings) {
await this.load(settings.publicData.projectUrl, settings.publicData.apiKey);
await this.load(settings.publicData.customDomain || settings.publicData.projectUrl, settings.publicData.apiKey);
this.subscribeTables(settings.publicData.realtimeTables || {});
},
/* Called by supabase auth plugin
@ -243,8 +243,8 @@ export default {
const query = Array.isArray(queries)
? queries
: queries && typeof queries === 'object'
? Object.keys(queries).map(k => ({ key: k, value: queries[k] }))
: [];
? Object.keys(queries).map(k => ({ key: k, value: queries[k] }))
: [];
const queryString = query.length
? query.reduce((result, item) => `${result}${item.key}=${item.value}&`, '?')
: '';
@ -311,14 +311,14 @@ export default {
path,
options.transform
? {
transform: {
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
},
}
transform: {
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
},
}
: {}
);
if (error) throw new Error(error.message, { cause: error });
@ -370,12 +370,12 @@ export default {
download: options.download ? options.download.filename || true : false,
transform: options.transform
? {
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
}
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
}
: null,
});
} else {
@ -396,14 +396,14 @@ export default {
download: options.download ? options.download.filename || true : false,
...(options.transform
? {
transform: {
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
},
}
transform: {
...(options.transform.format ? { format: options.transform.format } : {}),
...(options.transform.quality ? { quality: options.transform.quality } : {}),
...(options.transform.resize ? { resize: options.transform.resize } : {}),
...(options.transform.width ? { width: options.transform.width } : {}),
...(options.transform.height ? { height: options.transform.height } : {}),
},
}
: {}),
});
if (error) throw new Error(error.message, { cause: error });
@ -572,10 +572,10 @@ const applyModifiers = (query, { select, order, limit, range, single, maybeSingl
select.mode === 'minimal'
? ''
: select.mode === 'guided'
? select?.fields.length
? select.fields.join(', ')
: '*'
: select?.fieldsAdvanced
? select?.fields.length
? select.fields.join(', ')
: '*'
: select?.fieldsAdvanced
);
}

View File

@ -2,9 +2,9 @@ import { defineStore } from 'pinia';
import { getInheritedConfiguration } from '@/_common/helpers/configuration/configuration';
/* wwFront:start */
import pluginf9ef41c31c534857855bf2f6a40b7186 from '@/components/plugins/plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186/ww-config.js';
import plugin1fa0dd685069436c9a7d3b54c340f1fa from '@/components/plugins/plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa/ww-config.js';
import plugin832d6f7a42c343f1a3ce9a678272f811 from '@/components/plugins/plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811/ww-config.js';
import plugin1fa0dd685069436c9a7d3b54c340f1fa from '@/components/plugins/plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa/ww-config.js';
import pluginf9ef41c31c534857855bf2f6a40b7186 from '@/components/plugins/plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186/ww-config.js';
import plugin2bd1c68831c5443eae2559aa5b6431fb from '@/components/plugins/plugin-2bd1c688-31c5-443e-ae25-59aa5b6431fb/ww-config.js';
import section99586bd32b154d6ba0256a50d07ca845 from '@/components/sections/section-99586bd3-2b15-4d6b-a025-6a50d07ca845/ww-config.js';
import wwobjectaeb78b9a6fb64c49931dfaedcfad67ba from '@/components/elements/element-aeb78b9a-6fb6-4c49-931d-faedcfad67ba/ww-config.js';
@ -13,10 +13,8 @@ import wwobject99ea5bf7b91e43ea8ec3dbaf2b171e34 from '@/components/elements/elem
import wwobject0d3e75d19e7744cba2728b0825fbc5da from '@/components/elements/element-0d3e75d1-9e77-44cb-a272-8b0825fbc5da/ww-config.js';
import wwobject69d0b3efb265494c8cd1874da4aa1834 from '@/components/elements/element-69d0b3ef-b265-494c-8cd1-874da4aa1834/ww-config.js';
import wwobject83d890fb84f94386b459fb4be89a8e15 from '@/components/elements/element-83d890fb-84f9-4386-b459-fb4be89a8e15/ww-config.js';
import wwobject9ecb2cfccef74be8b7363e17a3b7e9ff from '@/components/elements/element-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff/ww-config.js';
import wwobject6f8796b18273498d95fc7013b7c63214 from '@/components/elements/element-6f8796b1-8273-498d-95fc-7013b7c63214/ww-config.js';
import wwobject9256b033f4e84ab4adcedac3a940d7f5 from '@/components/elements/element-9256b033-f4e8-4ab4-adce-dac3a940d7f5/ww-config.js';
import wwobjecta823467cbdc74ceca38c71875c4c214a from '@/components/elements/element-a823467c-bdc7-4cec-a38c-71875c4c214a/ww-config.js';
import wwobjectd7904e9dfc9a4d809e32728e097879ad from '@/components/elements/element-d7904e9d-fc9a-4d80-9e32-728e097879ad/ww-config.js';
import wwobject7179ba70c5d749a59828f85704fd1efc from '@/components/elements/element-7179ba70-c5d7-49a5-9828-f85704fd1efc/ww-config.js';
import wwobject2dff59573bd846f9afa3a5c5bab91931 from '@/components/elements/element-2dff5957-3bd8-46f9-afa3-a5c5bab91931/ww-config.js';
@ -32,8 +30,10 @@ import wwobject6d692ca26cdc4805aa0c211102f335d0 from '@/components/elements/elem
import wwobject1b1e21739b7842cca8eea6167caea340 from '@/components/elements/element-1b1e2173-9b78-42cc-a8ee-a6167caea340/ww-config.js';
import wwobject6dcad2080a6743a2bd1d3b13ff5819cf from '@/components/elements/element-6dcad208-0a67-43a2-bd1d-3b13ff5819cf/ww-config.js';
import wwobject57831abf83ad49adba973bd30b035710 from '@/components/elements/element-57831abf-83ad-49ad-ba97-3bd30b035710/ww-config.js';
import wwobjectdeb10a015eef4aa190171b51c2ad6fd0 from '@/components/elements/element-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0/ww-config.js';
import wwobject59dca300db7842e4a7a60cbf22d3cc82 from '@/components/elements/element-59dca300-db78-42e4-a7a6-0cbf22d3cc82/ww-config.js';
import wwobject9ecb2cfccef74be8b7363e17a3b7e9ff from '@/components/elements/element-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff/ww-config.js';
import wwobjectdeb10a015eef4aa190171b51c2ad6fd0 from '@/components/elements/element-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0/ww-config.js';
import wwobjecta823467cbdc74ceca38c71875c4c214a from '@/components/elements/element-a823467c-bdc7-4cec-a38c-71875c4c214a/ww-config.js';
import wwobject9ae1fce82e314bfda4d20450235bdfd5 from '@/components/elements/element-9ae1fce8-2e31-4bfd-a4d2-0450235bdfd5/ww-config.js';
/* wwFront:end */
@ -41,9 +41,9 @@ export const useComponentBasesStore = defineStore('componentBases', () => {
let configurations;
/* wwFront:start */
// eslint-disable-next-line no-undef
configurations = {'plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186': getInheritedConfiguration({ ...pluginf9ef41c31c534857855bf2f6a40b7186, name: 'plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186' }),
configurations = {'plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811': getInheritedConfiguration({ ...plugin832d6f7a42c343f1a3ce9a678272f811, name: 'plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811' }),
'plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa': getInheritedConfiguration({ ...plugin1fa0dd685069436c9a7d3b54c340f1fa, name: 'plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa' }),
'plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811': getInheritedConfiguration({ ...plugin832d6f7a42c343f1a3ce9a678272f811, name: 'plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811' }),
'plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186': getInheritedConfiguration({ ...pluginf9ef41c31c534857855bf2f6a40b7186, name: 'plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186' }),
'plugin-2bd1c688-31c5-443e-ae25-59aa5b6431fb': getInheritedConfiguration({ ...plugin2bd1c68831c5443eae2559aa5b6431fb, name: 'plugin-2bd1c688-31c5-443e-ae25-59aa5b6431fb' }),
'section-99586bd3-2b15-4d6b-a025-6a50d07ca845': getInheritedConfiguration({ ...section99586bd32b154d6ba0256a50d07ca845, name: 'section-99586bd3-2b15-4d6b-a025-6a50d07ca845' }),
'wwobject-aeb78b9a-6fb6-4c49-931d-faedcfad67ba': getInheritedConfiguration({ ...wwobjectaeb78b9a6fb64c49931dfaedcfad67ba, name: 'wwobject-aeb78b9a-6fb6-4c49-931d-faedcfad67ba' }),
@ -52,10 +52,8 @@ export const useComponentBasesStore = defineStore('componentBases', () => {
'wwobject-0d3e75d1-9e77-44cb-a272-8b0825fbc5da': getInheritedConfiguration({ ...wwobject0d3e75d19e7744cba2728b0825fbc5da, name: 'wwobject-0d3e75d1-9e77-44cb-a272-8b0825fbc5da' }),
'wwobject-69d0b3ef-b265-494c-8cd1-874da4aa1834': getInheritedConfiguration({ ...wwobject69d0b3efb265494c8cd1874da4aa1834, name: 'wwobject-69d0b3ef-b265-494c-8cd1-874da4aa1834' }),
'wwobject-83d890fb-84f9-4386-b459-fb4be89a8e15': getInheritedConfiguration({ ...wwobject83d890fb84f94386b459fb4be89a8e15, name: 'wwobject-83d890fb-84f9-4386-b459-fb4be89a8e15' }),
'wwobject-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff': getInheritedConfiguration({ ...wwobject9ecb2cfccef74be8b7363e17a3b7e9ff, name: 'wwobject-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff' }),
'wwobject-6f8796b1-8273-498d-95fc-7013b7c63214': getInheritedConfiguration({ ...wwobject6f8796b18273498d95fc7013b7c63214, name: 'wwobject-6f8796b1-8273-498d-95fc-7013b7c63214' }),
'wwobject-9256b033-f4e8-4ab4-adce-dac3a940d7f5': getInheritedConfiguration({ ...wwobject9256b033f4e84ab4adcedac3a940d7f5, name: 'wwobject-9256b033-f4e8-4ab4-adce-dac3a940d7f5' }),
'wwobject-a823467c-bdc7-4cec-a38c-71875c4c214a': getInheritedConfiguration({ ...wwobjecta823467cbdc74ceca38c71875c4c214a, name: 'wwobject-a823467c-bdc7-4cec-a38c-71875c4c214a' }),
'wwobject-d7904e9d-fc9a-4d80-9e32-728e097879ad': getInheritedConfiguration({ ...wwobjectd7904e9dfc9a4d809e32728e097879ad, name: 'wwobject-d7904e9d-fc9a-4d80-9e32-728e097879ad' }),
'wwobject-7179ba70-c5d7-49a5-9828-f85704fd1efc': getInheritedConfiguration({ ...wwobject7179ba70c5d749a59828f85704fd1efc, name: 'wwobject-7179ba70-c5d7-49a5-9828-f85704fd1efc' }),
'wwobject-2dff5957-3bd8-46f9-afa3-a5c5bab91931': getInheritedConfiguration({ ...wwobject2dff59573bd846f9afa3a5c5bab91931, name: 'wwobject-2dff5957-3bd8-46f9-afa3-a5c5bab91931' }),
@ -71,8 +69,10 @@ export const useComponentBasesStore = defineStore('componentBases', () => {
'wwobject-1b1e2173-9b78-42cc-a8ee-a6167caea340': getInheritedConfiguration({ ...wwobject1b1e21739b7842cca8eea6167caea340, name: 'wwobject-1b1e2173-9b78-42cc-a8ee-a6167caea340' }),
'wwobject-6dcad208-0a67-43a2-bd1d-3b13ff5819cf': getInheritedConfiguration({ ...wwobject6dcad2080a6743a2bd1d3b13ff5819cf, name: 'wwobject-6dcad208-0a67-43a2-bd1d-3b13ff5819cf' }),
'wwobject-57831abf-83ad-49ad-ba97-3bd30b035710': getInheritedConfiguration({ ...wwobject57831abf83ad49adba973bd30b035710, name: 'wwobject-57831abf-83ad-49ad-ba97-3bd30b035710' }),
'wwobject-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0': getInheritedConfiguration({ ...wwobjectdeb10a015eef4aa190171b51c2ad6fd0, name: 'wwobject-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0' }),
'wwobject-59dca300-db78-42e4-a7a6-0cbf22d3cc82': getInheritedConfiguration({ ...wwobject59dca300db7842e4a7a60cbf22d3cc82, name: 'wwobject-59dca300-db78-42e4-a7a6-0cbf22d3cc82' }),
'wwobject-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff': getInheritedConfiguration({ ...wwobject9ecb2cfccef74be8b7363e17a3b7e9ff, name: 'wwobject-9ecb2cfc-cef7-4be8-b736-3e17a3b7e9ff' }),
'wwobject-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0': getInheritedConfiguration({ ...wwobjectdeb10a015eef4aa190171b51c2ad6fd0, name: 'wwobject-deb10a01-5eef-4aa1-9017-1b51c2ad6fd0' }),
'wwobject-a823467c-bdc7-4cec-a38c-71875c4c214a': getInheritedConfiguration({ ...wwobjecta823467cbdc74ceca38c71875c4c214a, name: 'wwobject-a823467c-bdc7-4cec-a38c-71875c4c214a' }),
'wwobject-9ae1fce8-2e31-4bfd-a4d2-0450235bdfd5': getInheritedConfiguration({ ...wwobject9ae1fce82e314bfda4d20450235bdfd5, name: 'wwobject-9ae1fce8-2e31-4bfd-a4d2-0450235bdfd5' })};
/* wwFront:end */

View File

@ -4,9 +4,9 @@ import { useIconsStore } from '@/pinia/icons';
/* wwFront:start */
// eslint-disable-next-line no-undef
import plugin_f9ef41c3_1c53_4857_855b_f2f6a40b7186 from '@/components/plugins/plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186/src/wwPlugin.js';
import plugin_1fa0dd68_5069_436c_9a7d_3b54c340f1fa from '@/components/plugins/plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa/src/wwPlugin.js';
import plugin_832d6f7a_42c3_43f1_a3ce_9a678272f811 from '@/components/plugins/plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811/src/wwPlugin.js';
import plugin_1fa0dd68_5069_436c_9a7d_3b54c340f1fa from '@/components/plugins/plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa/src/wwPlugin.js';
import plugin_f9ef41c3_1c53_4857_855b_f2f6a40b7186 from '@/components/plugins/plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186/src/wwPlugin.js';
import plugin_2bd1c688_31c5_443e_ae25_59aa5b6431fb from '@/components/plugins/plugin-2bd1c688-31c5-443e-ae25-59aa5b6431fb/src/wwPlugin.js';
/* wwFront:end */
@ -49,9 +49,9 @@ export default {
/* wwFront:start */
// eslint-disable-next-line no-undef
wwLib.wwPluginHelper.registerPlugin('plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186', plugin_f9ef41c3_1c53_4857_855b_f2f6a40b7186);
wwLib.wwPluginHelper.registerPlugin('plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811', plugin_832d6f7a_42c3_43f1_a3ce_9a678272f811);
wwLib.wwPluginHelper.registerPlugin('plugin-1fa0dd68-5069-436c-9a7d-3b54c340f1fa', plugin_1fa0dd68_5069_436c_9a7d_3b54c340f1fa);
wwLib.wwPluginHelper.registerPlugin('plugin-832d6f7a-42c3-43f1-a3ce-9a678272f811', plugin_832d6f7a_42c3_43f1_a3ce_9a678272f811);
wwLib.wwPluginHelper.registerPlugin('plugin-f9ef41c3-1c53-4857-855b-f2f6a40b7186', plugin_f9ef41c3_1c53_4857_855b_f2f6a40b7186);
wwLib.wwPluginHelper.registerPlugin('plugin-2bd1c688-31c5-443e-ae25-59aa5b6431fb', plugin_2bd1c688_31c5_443e_ae25_59aa5b6431fb);
/* wwFront:end */

View File

@ -13,12 +13,25 @@ export default {
useFormula() {
const bindingContext = inject('bindingContext', null);
const localContext = inject('_wwLocalContext', null);
const wwLayoutContext = inject('wwLayoutContext', null);
const libraryComponentContext = inject('_wwLibraryComponentContext', null);
const dropzoneContext = inject('_wwDropzoneContext', null);
const resolveMappingFormula = (formula, mappingContext = null, defaultValue = null) => {
if (!formula || !formula.code || !formula.type) return defaultValue;
const evaluate = formula.type === 'f' ? evaluateFormula : evaluateCode;
try {
const result = evaluate({ code: formula.code }, { mapping: mappingContext, item: bindingContext });
const result = evaluate(
{ code: formula.code },
{
mapping: mappingContext,
item: bindingContext || {},
layout: wwLayoutContext ? { id: wwLayoutContext.layoutId } : {},
component: libraryComponentContext?.component,
dropzone: dropzoneContext,
local: localContext?.value || {},
}
);
return result.value;
} catch (error) {
return defaultValue;
@ -30,7 +43,13 @@ export default {
const evaluate = formula.type === 'f' ? evaluateFormula : evaluateCode;
return evaluate(
{ code: formula.code },
{ item: bindingContext, local: { data: localContext.value.data } }
{
item: bindingContext || {},
layout: wwLayoutContext ? { id: wwLayoutContext.layoutId } : {},
component: libraryComponentContext?.component,
dropzone: dropzoneContext,
local: localContext?.value || {},
}
);
} catch (error) {
return defaultValue;

View File

@ -12,11 +12,11 @@
<link rel="icon" type="image/x-icon" href="favicon.ico?_wwcv={{cacheVersion}}" />
<link rel="manifest" href="manifest.json?_wwcv=68" />
<link rel="manifest" href="manifest.json?_wwcv=69" />
<meta name="theme-color" content="" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link href="/fonts/Phosphor/font.css?_wwcv=68" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link href="/fonts/Phosphor/font.css?_wwcv=69" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'">
<style>:root{ --ww-default-font-family: 'Raleway', sans-serif }</style>
<style>

File diff suppressed because one or more lines are too long