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
+34 -9
View File
@@ -128,6 +128,17 @@ function SchemaArray(key, cast, options, schemaOptions) {
*/
SchemaArray.schemaName = 'Array';
/**
* Options for all arrays.
*
* - `castNonArrays`: `true` by default. If `false`, Mongoose will throw a CastError when a value isn't an array. If `true`, Mongoose will wrap the provided value in an array before casting.
*
* @static options
* @api public
*/
SchemaArray.options = { castNonArrays: true };
/*!
* Inherits from SchemaType.
*/
@@ -217,12 +228,17 @@ SchemaArray.prototype.cast = function(value, doc, init) {
return value;
}
// gh-2442: if we're loading this from the db and its not an array, mark
// the whole array as modified.
if (!!doc && !!init) {
doc.markModified(this.path);
if (init || SchemaArray.options.castNonArrays) {
// gh-2442: if we're loading this from the db and its not an array, mark
// the whole array as modified.
if (!!doc && !!init) {
doc.markModified(this.path);
}
return this.cast([value], doc, init);
}
return this.cast([value], doc, init);
throw new CastError('Array', util.inspect(value), this.path);
};
/*!
@@ -336,16 +352,25 @@ function cast$all(val) {
function cast$elemMatch(val) {
const keys = Object.keys(val);
const numKeys = keys.length;
let key;
let value;
for (let i = 0; i < numKeys; ++i) {
key = keys[i];
value = val[key];
const key = keys[i];
const value = val[key];
if (key.indexOf('$') === 0 && value) {
val[key] = this.castForQuery(key, value);
}
}
// Is this an embedded discriminator and is the discriminator key set?
// If so, use the discriminator schema. See gh-7449
const discriminatorKey = get(this,
'casterConstructor.schema.options.discriminatorKey');
const discriminators = get(this, 'casterConstructor.schema.discriminators', {});
if (discriminatorKey != null &&
val[discriminatorKey] != null &&
discriminators[val[discriminatorKey]] != null) {
return cast(discriminators[val[discriminatorKey]], val);
}
return cast(this.casterConstructor.schema, val);
}
+14
View File
@@ -61,6 +61,17 @@ function DocumentArray(key, schema, options, schemaOptions) {
*/
DocumentArray.schemaName = 'DocumentArray';
/**
* Options for all document arrays.
*
* - `castNonArrays`: `true` by default. If `false`, Mongoose will throw a CastError when a value isn't an array. If `true`, Mongoose will wrap the provided value in an array before casting.
*
* @static options
* @api public
*/
DocumentArray.options = { castNonArrays: true };
/*!
* Inherits from ArrayType.
*/
@@ -310,6 +321,9 @@ DocumentArray.prototype.cast = function(value, doc, init, prev, options) {
const _opts = { transform: false, virtuals: false };
if (!Array.isArray(value)) {
if (!init && !DocumentArray.options.castNonArrays) {
throw new CastError('DocumentArray', util.inspect(value), this.path);
}
// gh-2442 mark whole array as modified if we're initializing a doc from
// the db and the path isn't an array in the document
if (!!doc && init) {