vuetify eingebunden + erster Versuch Combobox

This commit is contained in:
2019-04-17 15:58:15 +02:00
parent 24642ca1a8
commit 56f4a3f940
1846 changed files with 219701 additions and 53848 deletions
+3 -3
View File
@@ -109,10 +109,10 @@ function applyHooks(model, schema, options) {
objToDecorate[method] = function() {
const args = Array.prototype.slice.call(arguments);
const cb = utils.last(args);
const argsWithoutCallback = cb == null ? args :
args.slice(0, args.length - 1);
const argsWithoutCallback = typeof cb === 'function' ?
args.slice(0, args.length - 1) : args;
return utils.promiseOrCallback(cb, callback => {
this[`$__${method}`].apply(this,
return this[`$__${method}`].apply(this,
argsWithoutCallback.concat([callback]));
}, model.events);
};
+12 -8
View File
@@ -1,7 +1,7 @@
'use strict';
const defineKey = require('../document/compile').defineKey;
const get = require('../../helpers/get');
const get = require('../get');
const utils = require('../../utils');
const CUSTOMIZABLE_DISCRIMINATOR_OPTIONS = {
@@ -15,23 +15,27 @@ const CUSTOMIZABLE_DISCRIMINATOR_OPTIONS = {
* ignore
*/
module.exports = function discriminator(model, name, schema, tiedValue) {
module.exports = function discriminator(model, name, schema, tiedValue, applyPlugins) {
if (!(schema && schema.instanceOfSchema)) {
throw new Error('You must pass a valid discriminator Schema');
}
const applyPluginsToDiscriminators = get(model.base,
'options.applyPluginsToDiscriminators', false);
// Even if `applyPluginsToDiscriminators` isn't set, we should still apply
// global plugins to schemas embedded in the discriminator schema (gh-7370)
model.base._applyPlugins(schema, { skipTopLevel: !applyPluginsToDiscriminators });
if (model.schema.discriminatorMapping &&
!model.schema.discriminatorMapping.isRoot) {
throw new Error('Discriminator "' + name +
'" can only be a discriminator of the root model');
}
if (applyPlugins) {
const applyPluginsToDiscriminators = get(model.base,
'options.applyPluginsToDiscriminators', false);
// Even if `applyPluginsToDiscriminators` isn't set, we should still apply
// global plugins to schemas embedded in the discriminator schema (gh-7370)
model.base._applyPlugins(schema, {
skipTopLevel: !applyPluginsToDiscriminators
});
}
const key = model.schema.options.discriminatorKey;
const baseSchemaAddition = {};
+55
View File
@@ -0,0 +1,55 @@
'use strict';
module.exports = function castFilterPath(query, schematype, val) {
const ctx = query;
const any$conditionals = Object.keys(val).some(function(k) {
return k.charAt(0) === '$' && k !== '$id' && k !== '$ref';
});
if (!any$conditionals) {
return schematype.castForQueryWrapper({
val: val,
context: ctx
});
}
const ks = Object.keys(val);
let k = ks.length;
while (k--) {
const $cond = ks[k];
const nested = val[$cond];
if ($cond === '$not') {
if (nested && schematype && !schematype.caster) {
const _keys = Object.keys(nested);
if (_keys.length && _keys[0].charAt(0) === '$') {
for (const key in nested) {
nested[key] = schematype.castForQueryWrapper({
$conditional: key,
val: nested[key],
context: ctx
});
}
} else {
val[$cond] = schematype.castForQueryWrapper({
$conditional: $cond,
val: nested,
context: ctx
});
}
continue;
}
// cast(schematype.caster ? schematype.caster.schema : schema, nested, options, context);
} else {
val[$cond] = schematype.castForQueryWrapper({
$conditional: $cond,
val: nested,
context: ctx
});
}
}
return val;
};
+62
View File
@@ -0,0 +1,62 @@
'use strict';
const castFilterPath = require('../query/castFilterPath');
const modifiedPaths = require('./modifiedPaths');
module.exports = function castArrayFilters(query) {
const arrayFilters = query.options.arrayFilters;
if (!Array.isArray(arrayFilters)) {
return;
}
const update = query.getUpdate();
const schema = query.schema;
const updatedPaths = modifiedPaths(update);
const updatedPathsByFilter = Object.keys(updatedPaths).reduce((cur, path) => {
const matches = path.match(/\$\[[^\]]+\]/g);
if (matches == null) {
return cur;
}
for (const match of matches) {
const firstMatch = path.indexOf(match);
if (firstMatch !== path.lastIndexOf(match)) {
throw new Error(`Path '${path}' contains the same array filter multiple times`);
}
cur[match.substring(2, match.length - 1)] = path.substr(0, firstMatch - 1);
}
return cur;
}, {});
for (const filter of arrayFilters) {
if (filter == null) {
throw new Error(`Got null array filter in ${arrayFilters}`);
}
const firstKey = Object.keys(filter)[0];
if (filter[firstKey] == null) {
continue;
}
const dot = firstKey.indexOf('.');
let filterPath = dot === -1 ?
updatedPathsByFilter[firstKey] + '.0' :
updatedPathsByFilter[firstKey.substr(0, dot)] + '.0' + firstKey.substr(dot);
if (filterPath == null) {
throw new Error(`Filter path not found for ${firstKey}`);
}
// If there are multiple array filters in the path being updated, make sure
// to replace them so we can get the schema path.
filterPath = filterPath.replace(/\$\[[^\]]+\]/g, '0');
const schematype = schema.path(filterPath);
if (typeof filter[firstKey] === 'object') {
filter[firstKey] = castFilterPath(query, schematype, filter[firstKey]);
} else {
filter[firstKey] = schematype.castForQuery(filter[firstKey]);
}
}
};