How to use the uikit.util function in uikit

To help you get started, we’ve selected a few uikit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unite-cms / unite-cms / src / Bundle / StorageBundle / Resources / webpack / vue / field / File.vue View on Github external
function match(pattern, path) {
                    return path.match(new RegExp(`^${pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')}$`, 'i'));
                }

                if (uiKitUpload.allow && !match(uiKitUpload.allow, file.name)) {
                    uiKitUpload.fail(uiKitUpload.msgInvalidName.replace('%s', uiKitUpload.allow));
                    return;
                }

                let data = new FormData();
                data.append('pre_sign_form[filename]', file.name);
                data.append('pre_sign_form[field]', this.fieldPath);
                data.append('pre_sign_form[_token]', this.uploadSignCsrfToken);

                UIkit.util.ajax(this.uploadSignUrl, {
                    method: 'POST',
                    data: data,
                    headers: { "Authentication-Fallback": true }
                }).then((result) => {
                    // Temporary save the parameter of this file. If upload is successful, we save them to the component.
                    let preSignedUrl = JSON.parse(result.responseText);
                    uiKitUpload.url = preSignedUrl.pre_signed_url;
                    this.tmpId = preSignedUrl.uuid;
                    this.tmpFileSize = file.size;
                    this.tmpFileType = file.type;
                    this.tmpFileName = preSignedUrl.filename;
                    this.tmpChecksum = preSignedUrl.checksum;

                    let headers = {};

                    if (this.acl) {
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / GridContent.vue View on Github external
moved(event) {
                if(this.isSortable) {
                    this.$emit('updateRow', {
                        id: event.detail[1].dataset.id,
                        data: {
                            position: UIkit.util.index(event.detail[1])
                        }
                    });
                }
            },
            renderField(field, identifier, meta = false) {
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / TableContent.vue View on Github external
moved(event) {
                if(this.isSortable) {
                    let data = {};
                    data[this.sort.field] = UIkit.util.index(event.detail[1]);

                    this.$emit('updateRow', {
                        id: event.detail[1].dataset.id,
                        data: data
                    });
                }
            }
        },
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / TableContent.vue View on Github external
moved(event) {
                if(this.isSortable) {
                    let data = {};
                    data[this.sort.field] = UIkit.util.index(event.detail[1]);

                    this.$emit('updateRow', {
                        id: event.detail[1].dataset.id,
                        data: data
                    });
                }
            }
        },
github unite-cms / unite-cms / src / Bundle / AdminBundle / Resources / assets / vue / components / Modal.vue View on Github external
mounted() {
            UIkit.modal(this.$refs.modal).show();
            UIkit.util.on(this.$refs.modal, 'hide', (e) => {
                if(e.target === this.$refs.modal) {
                    this.$emit('hide');
                }
            });
        },
        beforeDestroy() {
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / TableContent.vue View on Github external
mounted() {
            if(this.isSortable && this.updateable) {
                UIkit.sortable(this.$el.querySelector('.unite-div-table-tbody'), {
                    handle: '.uk-sortable-handle',
                    nestable: true
                });
                UIkit.util.on(this.$el, 'moved', this.moved);
            }
        },
        updated() {
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / Table.vue View on Github external
mounted: function(){
        let findModal = (element) => {
            if(element.hasAttribute('uk-modal')) {
                return element;
            }

            if(!element.parentElement) {
                return null;
            }

            return findModal(element.parentElement);
        };
        let modal = findModal(this.$el);
        if(modal) {
            UIkit.util.on(modal, 'beforeshow', () => {
                this.selected = [];
            });
        }
    },
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / Fields / TreeViewChildren.vue View on Github external
setTimeout(() => {
                        UIkit.sortable(this.$el, {
                            handle: '.uk-sortable-handle',
                            nestableContainerClass: 'unite-div-table-tbody',
                            nestable: true
                        });
                        UIkit.util.on(this.$el, 'moved', this.moved);
                        UIkit.util.on(this.$el, 'added', this.nest);
                    }, 100);
                });
github unite-cms / unite-cms / src / Bundle / StorageBundle / Resources / webpack / vue / field / File.vue View on Github external
['loadStart', 'load', 'loadEnd', 'abort'].forEach(type =>
                                UIkit.util.on(xhr, type.toLowerCase(), uiKitUpload[type])
                            );
github unite-cms / unite-cms / src / Bundle / CoreBundle / Resources / webpack / vue / views / Base / SelectRowField.vue View on Github external
mounted: function(){
            let findModal = (element) => {
                if(element.hasAttribute('uk-modal')) {
                    return element;
                }
                if(!element.parentElement) {
                    return null;
                }
                return findModal(element.parentElement);
            };
            let modal = findModal(this.$el);
            if(modal) {
                UIkit.util.on(modal, 'beforeshow', () => {
                    this.checked = false;
                });
            }
        },
        methods: {