feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+59
-134
@@ -25,7 +25,6 @@ var defaults = {
|
||||
parseArrays: true,
|
||||
plainObjects: false,
|
||||
strictDepth: false,
|
||||
strictMerge: true,
|
||||
strictNullHandling: false,
|
||||
throwOnLimitExceeded: false
|
||||
};
|
||||
@@ -64,13 +63,13 @@ var parseValues = function parseQueryStringValues(str, options) {
|
||||
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
||||
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
||||
|
||||
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
||||
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
||||
var parts = cleanStr.split(
|
||||
options.delimiter,
|
||||
options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
|
||||
options.throwOnLimitExceeded ? limit + 1 : limit
|
||||
);
|
||||
|
||||
if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
|
||||
if (options.throwOnLimitExceeded && parts.length > limit) {
|
||||
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
||||
}
|
||||
|
||||
@@ -109,18 +108,16 @@ var parseValues = function parseQueryStringValues(str, options) {
|
||||
} else {
|
||||
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
||||
|
||||
if (key !== null) {
|
||||
val = utils.maybeMap(
|
||||
parseArrayValue(
|
||||
part.slice(pos + 1),
|
||||
options,
|
||||
isArray(obj[key]) ? obj[key].length : 0
|
||||
),
|
||||
function (encodedVal) {
|
||||
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
||||
}
|
||||
);
|
||||
}
|
||||
val = utils.maybeMap(
|
||||
parseArrayValue(
|
||||
part.slice(pos + 1),
|
||||
options,
|
||||
isArray(obj[key]) ? obj[key].length : 0
|
||||
),
|
||||
function (encodedVal) {
|
||||
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
||||
@@ -131,25 +128,11 @@ var parseValues = function parseQueryStringValues(str, options) {
|
||||
val = isArray(val) ? [val] : val;
|
||||
}
|
||||
|
||||
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
||||
if (options.throwOnLimitExceeded) {
|
||||
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
||||
}
|
||||
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
||||
}
|
||||
|
||||
if (key !== null) {
|
||||
var existing = has.call(obj, key);
|
||||
if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
|
||||
obj[key] = utils.combine(
|
||||
obj[key],
|
||||
val,
|
||||
options.arrayLimit,
|
||||
options.plainObjects
|
||||
);
|
||||
} else if (!existing || options.duplicates === 'last') {
|
||||
obj[key] = val;
|
||||
}
|
||||
var existing = has.call(obj, key);
|
||||
if (existing && options.duplicates === 'combine') {
|
||||
obj[key] = utils.combine(obj[key], val);
|
||||
} else if (!existing || options.duplicates === 'last') {
|
||||
obj[key] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,39 +153,25 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
||||
var root = chain[i];
|
||||
|
||||
if (root === '[]' && options.parseArrays) {
|
||||
if (utils.isOverflow(leaf)) {
|
||||
// leaf is already an overflow object, preserve it
|
||||
obj = leaf;
|
||||
} else {
|
||||
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
||||
? []
|
||||
: utils.combine(
|
||||
[],
|
||||
leaf,
|
||||
options.arrayLimit,
|
||||
options.plainObjects
|
||||
);
|
||||
}
|
||||
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
||||
? []
|
||||
: utils.combine([], leaf);
|
||||
} else {
|
||||
obj = options.plainObjects ? { __proto__: null } : {};
|
||||
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
||||
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
||||
var index = parseInt(decodedRoot, 10);
|
||||
var isValidArrayIndex = !isNaN(index)
|
||||
if (!options.parseArrays && decodedRoot === '') {
|
||||
obj = { 0: leaf };
|
||||
} else if (
|
||||
!isNaN(index)
|
||||
&& root !== decodedRoot
|
||||
&& String(index) === decodedRoot
|
||||
&& index >= 0
|
||||
&& options.parseArrays;
|
||||
if (!options.parseArrays && decodedRoot === '') {
|
||||
obj = { 0: leaf };
|
||||
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
||||
&& (options.parseArrays && index <= options.arrayLimit)
|
||||
) {
|
||||
obj = [];
|
||||
obj[index] = leaf;
|
||||
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
||||
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
||||
} else if (isValidArrayIndex) {
|
||||
obj[index] = leaf;
|
||||
utils.markOverflow(obj, index);
|
||||
} else if (decodedRoot !== '__proto__') {
|
||||
obj[decodedRoot] = leaf;
|
||||
}
|
||||
@@ -214,101 +183,58 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
||||
return leaf;
|
||||
};
|
||||
|
||||
// Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
|
||||
// qs parse semantics for depth/prototype guards.
|
||||
var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
|
||||
var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
|
||||
|
||||
// depth <= 0 keeps the whole key as one segment
|
||||
if (options.depth <= 0) {
|
||||
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
||||
if (!options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return [key];
|
||||
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
||||
if (!givenKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var segments = [];
|
||||
// Transform dot notation to bracket notation
|
||||
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
||||
|
||||
// parent before the first '[' (may be empty if key starts with '[')
|
||||
var first = key.indexOf('[');
|
||||
var parent = first >= 0 ? key.slice(0, first) : key;
|
||||
// The regex chunks
|
||||
|
||||
var brackets = /(\[[^[\]]*])/;
|
||||
var child = /(\[[^[\]]*])/g;
|
||||
|
||||
// Get the parent
|
||||
|
||||
var segment = options.depth > 0 && brackets.exec(key);
|
||||
var parent = segment ? key.slice(0, segment.index) : key;
|
||||
|
||||
// Stash the parent if it exists
|
||||
|
||||
var keys = [];
|
||||
if (parent) {
|
||||
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
||||
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
||||
if (!options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
segments[segments.length] = parent;
|
||||
keys.push(parent);
|
||||
}
|
||||
|
||||
var n = key.length;
|
||||
var open = first;
|
||||
var collected = 0;
|
||||
// Loop through children appending to the array until we hit depth
|
||||
|
||||
while (open >= 0 && collected < options.depth) {
|
||||
var level = 1;
|
||||
var i = open + 1;
|
||||
var close = -1;
|
||||
|
||||
// balance nested '[' and ']' inside this bracket group using a nesting level counter
|
||||
while (i < n && close < 0) {
|
||||
var cu = key.charCodeAt(i);
|
||||
if (cu === 0x5B) { // '['
|
||||
level += 1;
|
||||
} else if (cu === 0x5D) { // ']'
|
||||
level -= 1;
|
||||
if (level === 0) {
|
||||
close = i; // found matching close; loop will exit by condition
|
||||
}
|
||||
var i = 0;
|
||||
while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
|
||||
i += 1;
|
||||
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
||||
if (!options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if (close < 0) {
|
||||
// Unterminated group: wrap the raw remainder in one bracket pair so it stays
|
||||
// a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
|
||||
segments[segments.length] = '[' + key.slice(open) + ']';
|
||||
return segments;
|
||||
}
|
||||
|
||||
var seg = key.slice(open, close + 1);
|
||||
// prototype guard for the content of this group
|
||||
var content = seg.slice(1, -1);
|
||||
if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
|
||||
return;
|
||||
}
|
||||
|
||||
segments[segments.length] = seg;
|
||||
collected += 1;
|
||||
|
||||
// find the next '[' after this balanced group
|
||||
open = key.indexOf('[', close + 1);
|
||||
keys.push(segment[1]);
|
||||
}
|
||||
|
||||
if (open >= 0) {
|
||||
// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
||||
|
||||
if (segment) {
|
||||
if (options.strictDepth === true) {
|
||||
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
||||
}
|
||||
|
||||
segments[segments.length] = '[' + key.slice(open) + ']';
|
||||
}
|
||||
|
||||
return segments;
|
||||
};
|
||||
|
||||
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
||||
if (!givenKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keys = splitKeyIntoSegments(givenKey, options);
|
||||
|
||||
if (!keys) {
|
||||
return;
|
||||
keys.push('[' + key.slice(segment.index) + ']');
|
||||
}
|
||||
|
||||
return parseObject(keys, val, options, valuesParsed);
|
||||
@@ -370,7 +296,6 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
|
||||
parseArrays: opts.parseArrays !== false,
|
||||
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
||||
strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
|
||||
strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults.strictMerge,
|
||||
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
|
||||
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
|
||||
};
|
||||
|
||||
+4
-11
@@ -118,7 +118,7 @@ var stringify = function stringify(
|
||||
|
||||
if (obj === null) {
|
||||
if (strictNullHandling) {
|
||||
return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix);
|
||||
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
|
||||
}
|
||||
|
||||
obj = '';
|
||||
@@ -142,9 +142,7 @@ var stringify = function stringify(
|
||||
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
||||
// we need to join elements in
|
||||
if (encodeValuesOnly && encoder) {
|
||||
obj = utils.maybeMap(obj, function (v) {
|
||||
return v == null ? v : encoder(v);
|
||||
});
|
||||
obj = utils.maybeMap(obj, encoder);
|
||||
}
|
||||
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
||||
} else if (isArray(filter)) {
|
||||
@@ -314,11 +312,6 @@ module.exports = function (object, opts) {
|
||||
var sideChannel = getSideChannel();
|
||||
for (var i = 0; i < objKeys.length; ++i) {
|
||||
var key = objKeys[i];
|
||||
|
||||
if (typeof key === 'undefined' || key === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var value = obj[key];
|
||||
|
||||
if (options.skipNulls && value === null) {
|
||||
@@ -352,10 +345,10 @@ module.exports = function (object, opts) {
|
||||
if (options.charsetSentinel) {
|
||||
if (options.charset === 'iso-8859-1') {
|
||||
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
||||
prefix += 'utf8=%26%2310003%3B' + options.delimiter;
|
||||
prefix += 'utf8=%26%2310003%3B&';
|
||||
} else {
|
||||
// encodeURIComponent('✓')
|
||||
prefix += 'utf8=%E2%9C%93' + options.delimiter;
|
||||
prefix += 'utf8=%E2%9C%93&';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-85
@@ -1,36 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var formats = require('./formats');
|
||||
var getSideChannel = require('side-channel');
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
var isArray = Array.isArray;
|
||||
|
||||
// Track objects created from arrayLimit overflow using side-channel
|
||||
// Stores the current max numeric index for O(1) lookup
|
||||
var overflowChannel = getSideChannel();
|
||||
|
||||
var markOverflow = function markOverflow(obj, maxIndex) {
|
||||
overflowChannel.set(obj, maxIndex);
|
||||
return obj;
|
||||
};
|
||||
|
||||
var isOverflow = function isOverflow(obj) {
|
||||
return overflowChannel.has(obj);
|
||||
};
|
||||
|
||||
var getMaxIndex = function getMaxIndex(obj) {
|
||||
return overflowChannel.get(obj);
|
||||
};
|
||||
|
||||
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
||||
overflowChannel.set(obj, maxIndex);
|
||||
};
|
||||
|
||||
var hexTable = (function () {
|
||||
var array = [];
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
|
||||
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
||||
}
|
||||
|
||||
return array;
|
||||
@@ -46,7 +24,7 @@ var compactQueue = function compactQueue(queue) {
|
||||
|
||||
for (var j = 0; j < obj.length; ++j) {
|
||||
if (typeof obj[j] !== 'undefined') {
|
||||
compacted[compacted.length] = obj[j];
|
||||
compacted.push(obj[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,20 +52,9 @@ var merge = function merge(target, source, options) {
|
||||
|
||||
if (typeof source !== 'object' && typeof source !== 'function') {
|
||||
if (isArray(target)) {
|
||||
var nextIndex = target.length;
|
||||
if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
|
||||
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
||||
}
|
||||
target[nextIndex] = source;
|
||||
target.push(source);
|
||||
} else if (target && typeof target === 'object') {
|
||||
if (isOverflow(target)) {
|
||||
// Add at next numeric index for overflow objects
|
||||
var newIndex = getMaxIndex(target) + 1;
|
||||
target[newIndex] = source;
|
||||
setMaxIndex(target, newIndex);
|
||||
} else if (options && options.strictMerge) {
|
||||
return [target, source];
|
||||
} else if (
|
||||
if (
|
||||
(options && (options.plainObjects || options.allowPrototypes))
|
||||
|| !has.call(Object.prototype, source)
|
||||
) {
|
||||
@@ -101,23 +68,7 @@ var merge = function merge(target, source, options) {
|
||||
}
|
||||
|
||||
if (!target || typeof target !== 'object') {
|
||||
if (isOverflow(source)) {
|
||||
// Create new object with target at 0, source values shifted by 1
|
||||
var sourceKeys = Object.keys(source);
|
||||
var result = options && options.plainObjects
|
||||
? { __proto__: null, 0: target }
|
||||
: { 0: target };
|
||||
for (var m = 0; m < sourceKeys.length; m++) {
|
||||
var oldKey = parseInt(sourceKeys[m], 10);
|
||||
result[oldKey + 1] = source[sourceKeys[m]];
|
||||
}
|
||||
return markOverflow(result, getMaxIndex(source) + 1);
|
||||
}
|
||||
var combined = [target].concat(source);
|
||||
if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
|
||||
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
||||
}
|
||||
return combined;
|
||||
return [target].concat(source);
|
||||
}
|
||||
|
||||
var mergeTarget = target;
|
||||
@@ -132,7 +83,7 @@ var merge = function merge(target, source, options) {
|
||||
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
||||
target[i] = merge(targetItem, item, options);
|
||||
} else {
|
||||
target[target.length] = item;
|
||||
target.push(item);
|
||||
}
|
||||
} else {
|
||||
target[i] = item;
|
||||
@@ -149,17 +100,6 @@ var merge = function merge(target, source, options) {
|
||||
} else {
|
||||
acc[key] = value;
|
||||
}
|
||||
|
||||
if (isOverflow(source) && !isOverflow(acc)) {
|
||||
markOverflow(acc, getMaxIndex(source));
|
||||
}
|
||||
if (isOverflow(acc)) {
|
||||
var keyNum = parseInt(key, 10);
|
||||
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
||||
setMaxIndex(acc, keyNum);
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, mergeTarget);
|
||||
};
|
||||
@@ -276,8 +216,8 @@ var compact = function compact(value) {
|
||||
var key = keys[j];
|
||||
var val = obj[key];
|
||||
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
||||
queue[queue.length] = { obj: obj, prop: key };
|
||||
refs[refs.length] = val;
|
||||
queue.push({ obj: obj, prop: key });
|
||||
refs.push(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,27 +239,15 @@ var isBuffer = function isBuffer(obj) {
|
||||
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
||||
};
|
||||
|
||||
var combine = function combine(a, b, arrayLimit, plainObjects) {
|
||||
// If 'a' is already an overflow object, add to it
|
||||
if (isOverflow(a)) {
|
||||
var newIndex = getMaxIndex(a) + 1;
|
||||
a[newIndex] = b;
|
||||
setMaxIndex(a, newIndex);
|
||||
return a;
|
||||
}
|
||||
|
||||
var result = [].concat(a, b);
|
||||
if (result.length > arrayLimit) {
|
||||
return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
|
||||
}
|
||||
return result;
|
||||
var combine = function combine(a, b) {
|
||||
return [].concat(a, b);
|
||||
};
|
||||
|
||||
var maybeMap = function maybeMap(val, fn) {
|
||||
if (isArray(val)) {
|
||||
var mapped = [];
|
||||
for (var i = 0; i < val.length; i += 1) {
|
||||
mapped[mapped.length] = fn(val[i]);
|
||||
mapped.push(fn(val[i]));
|
||||
}
|
||||
return mapped;
|
||||
}
|
||||
@@ -334,9 +262,7 @@ module.exports = {
|
||||
decode: decode,
|
||||
encode: encode,
|
||||
isBuffer: isBuffer,
|
||||
isOverflow: isOverflow,
|
||||
isRegExp: isRegExp,
|
||||
markOverflow: markOverflow,
|
||||
maybeMap: maybeMap,
|
||||
merge: merge
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user