"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    SqlCollectionTemplate: ()=>SqlCollectionTemplate
});
const CollectionTemplate_js_namespaceObject = require("../../data-source/collection-template/CollectionTemplate.js");
const index_js_namespaceObject = require("../../i18n/index.js");
const sql_collection_index_js_namespaceObject = require("./components/sql-collection/index.js");
const external_properties_index_js_namespaceObject = require("./properties/index.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class SqlCollectionTemplate extends CollectionTemplate_js_namespaceObject.CollectionTemplate {
    constructor(...args){
        super(...args), _define_property(this, "name", 'sql'), _define_property(this, "title", '{{t("SQL collection")}}'), _define_property(this, "order", 4), _define_property(this, "color", 'yellow'), _define_property(this, "default", {
            fields: []
        }), _define_property(this, "configurableProperties", {
            title: {
                type: 'string',
                title: '{{ t("Collection display name") }}',
                required: true,
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            },
            name: {
                type: 'string',
                title: '{{t("Collection name")}}',
                required: true,
                'x-disabled': '{{ !createOnly }}',
                'x-decorator': 'FormItem',
                'x-component': 'Input',
                'x-validator': 'uid',
                description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
            },
            config: {
                type: 'void',
                'x-decorator': sql_collection_index_js_namespaceObject.SQLRequestProvider,
                properties: {
                    sql: {
                        type: 'string',
                        title: '{{t("SQL")}}',
                        'x-decorator': 'FormItem',
                        'x-component': sql_collection_index_js_namespaceObject.SQLInput,
                        required: true,
                        'x-validator': (value, rules, param)=>{
                            let { form } = param;
                            const field = form.query('sql').take();
                            if (!field.componentProps.disabled) return index_js_namespaceObject.i18n.t('Please confirm the SQL statement first');
                            return '';
                        }
                    },
                    sources: {
                        type: 'array',
                        title: '{{t("Source collections")}}',
                        'x-decorator': 'FormItem',
                        'x-component': 'Select',
                        'x-component-props': {
                            multiple: true
                        },
                        'x-reactions': [
                            '{{useAsyncDataSource(loadCollections)}}'
                        ]
                    },
                    fields: {
                        type: 'array',
                        title: '{{t("Fields")}}',
                        'x-decorator': 'FormItem',
                        'x-component': sql_collection_index_js_namespaceObject.FieldsConfigure,
                        required: true
                    },
                    table: {
                        type: 'void',
                        title: '{{t("Preview")}}',
                        'x-decorator': 'FormItem',
                        'x-component': sql_collection_index_js_namespaceObject.PreviewTable
                    }
                }
            },
            ...(0, external_properties_index_js_namespaceObject.getConfigurableProperties)('category')
        });
    }
}
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
