adrema-form/src/main.js

40 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-02-03 20:41:28 +01:00
import {defineCustomElement} from 'vue';
import classes from './style.css?inline';
import carousel from 'vue3-carousel/dist/carousel.css?inline';
import carouselStyle from './carousel.css?inline';
2024-02-08 02:38:09 +01:00
import 'vue3-toastify/dist/index.css';
import EventIndex from './EventIndex.ce.vue';
import EventForm from './EventForm.ce.vue';
2024-02-04 01:11:33 +01:00
import EventDescription from './EventDescription.ce.vue';
2024-02-03 20:41:28 +01:00
import axios from 'axios';
2024-02-04 01:11:33 +01:00
2023-12-31 14:20:32 +01:00
window.axios = axios;
2024-02-03 20:41:28 +01:00
axios.defaults.baseURL = window.document.querySelector('[name="adrema_base_url"]').content;
2023-12-31 14:20:32 +01:00
2023-12-24 22:25:17 +01:00
window.hasKeys = function (object, expected) {
2024-02-19 03:27:46 +01:00
if (typeof object !== 'object') {
return false;
}
var givenKeys = JSON.stringify(Object.keys(object).sort());
var expectedKeys = JSON.stringify(expected.sort());
if (givenKeys !== expectedKeys) {
console.log('Fields ' + givenKeys + ' dont match ' + expectedKeys);
return false;
}
return true;
};
window.globalFieldRules = function () {
return ['default', 'nami_type', 'for_members', 'key', 'columns', 'name', 'type'];
2023-12-24 22:25:17 +01:00
};
EventForm.styles = [classes, carousel, carouselStyle];
EventIndex.styles = [classes];
2024-02-04 01:11:33 +01:00
EventDescription.styles = [classes];
2023-12-24 02:24:48 +01:00
customElements.define('event-form', defineCustomElement(EventForm));
customElements.define('event-index', defineCustomElement(EventIndex));
2024-02-04 01:11:33 +01:00
customElements.define('event-description', defineCustomElement(EventDescription));