@appius-fr/apx 2.5.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/APX.mjs +121 -118
- package/README.md +55 -22
- package/dist/APX.dev.mjs +765 -119
- package/dist/APX.mjs +1 -1
- package/dist/APX.prod.mjs +1 -1
- package/dist/APX.standalone.js +732 -36
- package/dist/APX.standalone.js.map +1 -1
- package/modules/listen/README.md +235 -0
- package/modules/tools/README.md +165 -0
- package/modules/tools/exports.mjs +16 -0
- package/modules/tools/form-packer/README.md +315 -0
- package/modules/tools/form-packer/augment-apx.mjs +30 -0
- package/modules/tools/form-packer/packToJson.mjs +549 -0
- package/package.json +1 -1
package/dist/APX.standalone.js
CHANGED
|
@@ -2728,6 +2728,698 @@ Object.assign(toast, {
|
|
|
2728
2728
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toast);
|
|
2729
2729
|
|
|
2730
2730
|
|
|
2731
|
+
/***/ }),
|
|
2732
|
+
|
|
2733
|
+
/***/ "./modules/tools/exports.mjs":
|
|
2734
|
+
/*!***********************************!*\
|
|
2735
|
+
!*** ./modules/tools/exports.mjs ***!
|
|
2736
|
+
\***********************************/
|
|
2737
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
2738
|
+
|
|
2739
|
+
"use strict";
|
|
2740
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2741
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2742
|
+
/* harmony export */ augmentWithPack: () => (/* reexport safe */ _form_packer_augment_apx_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
2743
|
+
/* harmony export */ packFormToJSON: () => (/* reexport safe */ _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__.packFormToJSON),
|
|
2744
|
+
/* harmony export */ tools: () => (/* binding */ tools)
|
|
2745
|
+
/* harmony export */ });
|
|
2746
|
+
/* harmony import */ var _form_packer_augment_apx_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-packer/augment-apx.mjs */ "./modules/tools/form-packer/augment-apx.mjs");
|
|
2747
|
+
/* harmony import */ var _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./form-packer/packToJson.mjs */ "./modules/tools/form-packer/packToJson.mjs");
|
|
2748
|
+
// Import des fonctions et modules des sous-modules
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
// Export de la fonction d'augmentation
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
// Export des fonctions utilitaires
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
// Export d'un objet tools pour faciliter l'utilisation
|
|
2759
|
+
var tools = {
|
|
2760
|
+
packFormToJSON: _form_packer_packToJson_mjs__WEBPACK_IMPORTED_MODULE_1__.packFormToJSON
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
/***/ }),
|
|
2764
|
+
|
|
2765
|
+
/***/ "./modules/tools/form-packer/augment-apx.mjs":
|
|
2766
|
+
/*!***************************************************!*\
|
|
2767
|
+
!*** ./modules/tools/form-packer/augment-apx.mjs ***!
|
|
2768
|
+
\***************************************************/
|
|
2769
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
2770
|
+
|
|
2771
|
+
"use strict";
|
|
2772
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2773
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2774
|
+
/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
|
|
2775
|
+
/* harmony export */ });
|
|
2776
|
+
/* harmony import */ var _packToJson_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./packToJson.mjs */ "./modules/tools/form-packer/packToJson.mjs");
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
/**
|
|
2780
|
+
* Ajoute la méthode pack() aux objets APX pour convertir les formulaires en JSON
|
|
2781
|
+
* @param {Object} apx - L'objet APX à augmenter
|
|
2782
|
+
* @returns {Object} L'objet APX augmenté
|
|
2783
|
+
*/
|
|
2784
|
+
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(apx) {
|
|
2785
|
+
/**
|
|
2786
|
+
* Convertit le premier formulaire sélectionné en objet JSON
|
|
2787
|
+
* @returns {Object} L'objet JSON résultant
|
|
2788
|
+
* @throws {Error} Si aucun formulaire n'est trouvé ou si le premier élément n'est pas un formulaire
|
|
2789
|
+
* @example
|
|
2790
|
+
* const data = APX('form.myformclass').pack();
|
|
2791
|
+
*/
|
|
2792
|
+
apx.pack = function () {
|
|
2793
|
+
var firstElement = this.first();
|
|
2794
|
+
if (!firstElement) {
|
|
2795
|
+
throw new Error('No element found');
|
|
2796
|
+
}
|
|
2797
|
+
if (firstElement.tagName !== 'FORM') {
|
|
2798
|
+
throw new Error('Element is not a form');
|
|
2799
|
+
}
|
|
2800
|
+
return (0,_packToJson_mjs__WEBPACK_IMPORTED_MODULE_0__.packFormToJSON)(firstElement);
|
|
2801
|
+
};
|
|
2802
|
+
return apx;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
/***/ }),
|
|
2806
|
+
|
|
2807
|
+
/***/ "./modules/tools/form-packer/packToJson.mjs":
|
|
2808
|
+
/*!**************************************************!*\
|
|
2809
|
+
!*** ./modules/tools/form-packer/packToJson.mjs ***!
|
|
2810
|
+
\**************************************************/
|
|
2811
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
2812
|
+
|
|
2813
|
+
"use strict";
|
|
2814
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2815
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2816
|
+
/* harmony export */ packFormToJSON: () => (/* binding */ packFormToJSON)
|
|
2817
|
+
/* harmony export */ });
|
|
2818
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2819
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2820
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2821
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
2822
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2823
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
2824
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2825
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2826
|
+
/**
|
|
2827
|
+
* Convertit un formulaire HTML en objet JSON
|
|
2828
|
+
* @param {HTMLFormElement} form - Le formulaire à convertir
|
|
2829
|
+
* @returns {Object} L'objet JSON résultant
|
|
2830
|
+
* @throws {TypeError} Si form n'est pas un HTMLFormElement
|
|
2831
|
+
*/
|
|
2832
|
+
var packFormToJSON = function packFormToJSON(form) {
|
|
2833
|
+
// Validation de l'entrée
|
|
2834
|
+
if (!form || !(form instanceof HTMLFormElement)) {
|
|
2835
|
+
throw new TypeError('packFormToJSON expects an HTMLFormElement');
|
|
2836
|
+
}
|
|
2837
|
+
var formData = new FormData(form);
|
|
2838
|
+
var jsonData = {};
|
|
2839
|
+
|
|
2840
|
+
/**
|
|
2841
|
+
* Construit une représentation string du chemin pour les messages d'erreur
|
|
2842
|
+
* @param {Array} parts - Les parties du chemin
|
|
2843
|
+
* @returns {string} Le chemin formaté
|
|
2844
|
+
*/
|
|
2845
|
+
var buildPathString = function buildPathString(parts) {
|
|
2846
|
+
return parts.reduce(function (path, part) {
|
|
2847
|
+
if (part.type === 'key') {
|
|
2848
|
+
return path ? "".concat(path, "[").concat(part.name, "]") : part.name;
|
|
2849
|
+
}
|
|
2850
|
+
if (part.type === 'numeric') {
|
|
2851
|
+
return "".concat(path, "[").concat(part.index, "]");
|
|
2852
|
+
}
|
|
2853
|
+
if (part.type === 'array') {
|
|
2854
|
+
return "".concat(path, "[]");
|
|
2855
|
+
}
|
|
2856
|
+
return path;
|
|
2857
|
+
}, '');
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
// ============================================================================
|
|
2861
|
+
// PHASE 1 : ANALYSE ET DÉTECTION DES CONFLITS
|
|
2862
|
+
// ============================================================================
|
|
2863
|
+
|
|
2864
|
+
/**
|
|
2865
|
+
* Structure pour stocker l'utilisation d'un chemin
|
|
2866
|
+
* @typedef {Object} PathUsage
|
|
2867
|
+
* @property {boolean} isFinal - Le chemin est utilisé comme valeur finale
|
|
2868
|
+
* @property {boolean} isIntermediate - Le chemin est utilisé comme chemin intermédiaire
|
|
2869
|
+
* @property {boolean} hasArraySuffix - Le chemin se termine par [] (crée des valeurs primitives)
|
|
2870
|
+
* @property {string} key - La clé du formulaire qui utilise ce chemin
|
|
2871
|
+
*/
|
|
2872
|
+
|
|
2873
|
+
var pathUsage = new Map(); // Map<pathString, PathUsage>
|
|
2874
|
+
var keyAnalysis = new Map(); // Map<basePath, {hasNumeric: boolean, hasString: boolean}>
|
|
2875
|
+
var allEntries = [];
|
|
2876
|
+
|
|
2877
|
+
/**
|
|
2878
|
+
* Enregistre l'utilisation d'un chemin dans pathUsage
|
|
2879
|
+
* @param {string} currentPath - Le chemin à enregistrer
|
|
2880
|
+
* @param {boolean} isFinal - Si c'est une valeur finale
|
|
2881
|
+
* @param {boolean} isArraySuffix - Si le chemin se termine par []
|
|
2882
|
+
* @param {string} key - La clé du formulaire
|
|
2883
|
+
*/
|
|
2884
|
+
var recordPathUsage = function recordPathUsage(currentPath, isFinal, isArraySuffix, key) {
|
|
2885
|
+
var _pathUsage$get;
|
|
2886
|
+
var usage = (_pathUsage$get = pathUsage.get(currentPath)) !== null && _pathUsage$get !== void 0 ? _pathUsage$get : {
|
|
2887
|
+
isFinal: false,
|
|
2888
|
+
isIntermediate: false,
|
|
2889
|
+
hasArraySuffix: false,
|
|
2890
|
+
key: key
|
|
2891
|
+
};
|
|
2892
|
+
if (!pathUsage.has(currentPath)) {
|
|
2893
|
+
pathUsage.set(currentPath, usage);
|
|
2894
|
+
}
|
|
2895
|
+
if (isFinal) {
|
|
2896
|
+
usage.isFinal = true;
|
|
2897
|
+
usage.key = key;
|
|
2898
|
+
if (isArraySuffix) {
|
|
2899
|
+
usage.hasArraySuffix = true;
|
|
2900
|
+
}
|
|
2901
|
+
} else {
|
|
2902
|
+
var _usage$key;
|
|
2903
|
+
usage.isIntermediate = true;
|
|
2904
|
+
(_usage$key = usage.key) !== null && _usage$key !== void 0 ? _usage$key : usage.key = key;
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2908
|
+
// Première passe : analyser toutes les clés et enregistrer les chemins
|
|
2909
|
+
var _iterator = _createForOfIteratorHelper(formData.entries()),
|
|
2910
|
+
_step;
|
|
2911
|
+
try {
|
|
2912
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2913
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
2914
|
+
_key = _step$value[0],
|
|
2915
|
+
_value = _step$value[1];
|
|
2916
|
+
if (!_key) continue;
|
|
2917
|
+
allEntries.push({
|
|
2918
|
+
key: _key,
|
|
2919
|
+
value: _value
|
|
2920
|
+
});
|
|
2921
|
+
var _parts = parseKey(_key);
|
|
2922
|
+
|
|
2923
|
+
// Construire tous les chemins intermédiaires et le chemin final
|
|
2924
|
+
var currentPath = '';
|
|
2925
|
+
for (var _i4 = 0; _i4 < _parts.length; _i4++) {
|
|
2926
|
+
var _part = _parts[_i4];
|
|
2927
|
+
var _isLast = _i4 === _parts.length - 1;
|
|
2928
|
+
var isArraySuffix = _part.type === 'array';
|
|
2929
|
+
|
|
2930
|
+
// Construire le chemin jusqu'à ce niveau
|
|
2931
|
+
if (_part.type === 'key') {
|
|
2932
|
+
currentPath = currentPath ? "".concat(currentPath, "[").concat(_part.name, "]") : _part.name;
|
|
2933
|
+
} else if (_part.type === 'numeric') {
|
|
2934
|
+
currentPath = "".concat(currentPath, "[").concat(_part.index, "]");
|
|
2935
|
+
} else if (_part.type === 'array') {
|
|
2936
|
+
currentPath = "".concat(currentPath, "[]");
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
// Enregistrer l'utilisation du chemin
|
|
2940
|
+
recordPathUsage(currentPath, _isLast, isArraySuffix && _isLast, _key);
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
// Analyser chaque niveau de la hiérarchie pour détecter les conflits (indices numériques vs clés de chaîne)
|
|
2944
|
+
for (var _i5 = 0; _i5 < _parts.length - 1; _i5++) {
|
|
2945
|
+
var _part2 = _parts[_i5];
|
|
2946
|
+
var _nextPart = _parts[_i5 + 1];
|
|
2947
|
+
|
|
2948
|
+
// Analyser seulement les clés (pas les indices numériques)
|
|
2949
|
+
if (_part2.type === 'key') {
|
|
2950
|
+
var _keyAnalysis$get;
|
|
2951
|
+
var _basePath = _part2.name; // Le nom de la première clé dans le chemin
|
|
2952
|
+
|
|
2953
|
+
var analysis = (_keyAnalysis$get = keyAnalysis.get(_basePath)) !== null && _keyAnalysis$get !== void 0 ? _keyAnalysis$get : {
|
|
2954
|
+
hasNumeric: false,
|
|
2955
|
+
hasString: false
|
|
2956
|
+
};
|
|
2957
|
+
if (!keyAnalysis.has(_basePath)) {
|
|
2958
|
+
keyAnalysis.set(_basePath, analysis);
|
|
2959
|
+
}
|
|
2960
|
+
if (_nextPart) {
|
|
2961
|
+
if (_nextPart.type === 'numeric') {
|
|
2962
|
+
analysis.hasNumeric = true;
|
|
2963
|
+
} else if (_nextPart.type === 'key' || _nextPart.type === 'array') {
|
|
2964
|
+
analysis.hasString = true;
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
/**
|
|
2972
|
+
* Détecte et lève une exception pour tous les conflits de chemins
|
|
2973
|
+
*
|
|
2974
|
+
* Principe simple : pour chaque chemin final (valeur primitive), vérifier si un chemin
|
|
2975
|
+
* intermédiaire commence par ce chemin suivi de '['. Si c'est le cas, c'est un conflit.
|
|
2976
|
+
*
|
|
2977
|
+
* Cette approche unifiée couvre tous les cas :
|
|
2978
|
+
* - items[] (final) vs items[0][name] (intermédiaire)
|
|
2979
|
+
* - array[3] (final) vs array[3][nested] (intermédiaire)
|
|
2980
|
+
* - data[key] (final) vs data[key][sub] (intermédiaire)
|
|
2981
|
+
*/
|
|
2982
|
+
} catch (err) {
|
|
2983
|
+
_iterator.e(err);
|
|
2984
|
+
} finally {
|
|
2985
|
+
_iterator.f();
|
|
2986
|
+
}
|
|
2987
|
+
var detectPathConflicts = function detectPathConflicts() {
|
|
2988
|
+
// 1. Collecter tous les chemins finaux (valeurs primitives)
|
|
2989
|
+
var finalPaths = new Set();
|
|
2990
|
+
var finalPathKeys = new Map(); // Pour les messages d'erreur
|
|
2991
|
+
var _iterator2 = _createForOfIteratorHelper(pathUsage.entries()),
|
|
2992
|
+
_step2;
|
|
2993
|
+
try {
|
|
2994
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2995
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
2996
|
+
path = _step2$value[0],
|
|
2997
|
+
usage = _step2$value[1];
|
|
2998
|
+
if (usage.isFinal) {
|
|
2999
|
+
finalPaths.add(path);
|
|
3000
|
+
finalPathKeys.set(path, usage.key);
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
// 2. Pour chaque chemin intermédiaire, vérifier s'il commence par un chemin final
|
|
3005
|
+
} catch (err) {
|
|
3006
|
+
_iterator2.e(err);
|
|
3007
|
+
} finally {
|
|
3008
|
+
_iterator2.f();
|
|
3009
|
+
}
|
|
3010
|
+
var _iterator3 = _createForOfIteratorHelper(pathUsage.entries()),
|
|
3011
|
+
_step3;
|
|
3012
|
+
try {
|
|
3013
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
3014
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
3015
|
+
_path = _step3$value[0],
|
|
3016
|
+
_usage = _step3$value[1];
|
|
3017
|
+
if (_usage.isIntermediate) {
|
|
3018
|
+
var _iterator4 = _createForOfIteratorHelper(finalPaths),
|
|
3019
|
+
_step4;
|
|
3020
|
+
try {
|
|
3021
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
3022
|
+
var finalPath = _step4.value;
|
|
3023
|
+
// Vérifier si ce chemin intermédiaire commence par un chemin final suivi de '['
|
|
3024
|
+
// Exemple: finalPath = "array[3]", path = "array[3][nested]" → conflit
|
|
3025
|
+
if (_path.startsWith("".concat(finalPath, "["))) {
|
|
3026
|
+
throw new Error("Path conflict: \"".concat(finalPath, "\" is used as a final value (in field \"").concat(finalPathKeys.get(finalPath), "\"), ") + "but \"".concat(_path, "\" tries to use it as an intermediate path (in field \"").concat(_usage.key, "\"). ") + "This creates incompatible data structures. " + "You cannot use \"".concat(finalPath, "\" as a primitive value and then access it as an object."));
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
} catch (err) {
|
|
3030
|
+
_iterator4.e(err);
|
|
3031
|
+
} finally {
|
|
3032
|
+
_iterator4.f();
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
} catch (err) {
|
|
3037
|
+
_iterator3.e(err);
|
|
3038
|
+
} finally {
|
|
3039
|
+
_iterator3.f();
|
|
3040
|
+
}
|
|
3041
|
+
};
|
|
3042
|
+
|
|
3043
|
+
// Exécuter la détection des conflits
|
|
3044
|
+
detectPathConflicts();
|
|
3045
|
+
|
|
3046
|
+
/**
|
|
3047
|
+
* Vérifie si un chemin de base a un conflit (indices numériques ET clés de chaîne)
|
|
3048
|
+
* @param {string} basePath - Le chemin de base à vérifier
|
|
3049
|
+
* @returns {boolean}
|
|
3050
|
+
*/
|
|
3051
|
+
var hasConflict = function hasConflict(basePath) {
|
|
3052
|
+
if (!basePath) return false;
|
|
3053
|
+
var analysis = keyAnalysis.get(basePath);
|
|
3054
|
+
return (analysis === null || analysis === void 0 ? void 0 : analysis.hasNumeric) && (analysis === null || analysis === void 0 ? void 0 : analysis.hasString);
|
|
3055
|
+
};
|
|
3056
|
+
|
|
3057
|
+
/**
|
|
3058
|
+
* Convertit un tableau en objet en préservant les indices numériques comme propriétés
|
|
3059
|
+
* @param {Array} arr - Le tableau à convertir
|
|
3060
|
+
* @returns {Object} L'objet résultant
|
|
3061
|
+
*/
|
|
3062
|
+
var arrayToObject = function arrayToObject(arr) {
|
|
3063
|
+
var obj = {};
|
|
3064
|
+
// Copier les indices numériques
|
|
3065
|
+
for (var idx = 0; idx < arr.length; idx++) {
|
|
3066
|
+
obj[idx] = arr[idx];
|
|
3067
|
+
}
|
|
3068
|
+
// Copier les propriétés non-numériques
|
|
3069
|
+
for (var _i = 0, _Object$entries = Object.entries(arr); _i < _Object$entries.length; _i++) {
|
|
3070
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
3071
|
+
k = _Object$entries$_i[0],
|
|
3072
|
+
v = _Object$entries$_i[1];
|
|
3073
|
+
var numKey = Number.parseInt(k, 10);
|
|
3074
|
+
if (Number.isNaN(numKey) || k !== String(numKey)) {
|
|
3075
|
+
obj[k] = v;
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
return obj;
|
|
3079
|
+
};
|
|
3080
|
+
|
|
3081
|
+
/**
|
|
3082
|
+
* Convertit un objet en tableau en préservant les indices numériques
|
|
3083
|
+
* @param {Object} obj - L'objet à convertir
|
|
3084
|
+
* @returns {Array} Le tableau résultant
|
|
3085
|
+
*/
|
|
3086
|
+
var objectToArray = function objectToArray(obj) {
|
|
3087
|
+
if (Array.isArray(obj)) return obj;
|
|
3088
|
+
var arr = [];
|
|
3089
|
+
if (_typeof(obj) === 'object' && obj !== null) {
|
|
3090
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(obj); _i2 < _Object$entries2.length; _i2++) {
|
|
3091
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
3092
|
+
k = _Object$entries2$_i[0],
|
|
3093
|
+
v = _Object$entries2$_i[1];
|
|
3094
|
+
var numKey = Number.parseInt(k, 10);
|
|
3095
|
+
if (!Number.isNaN(numKey)) {
|
|
3096
|
+
arr[numKey] = v;
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
return arr;
|
|
3101
|
+
};
|
|
3102
|
+
|
|
3103
|
+
/**
|
|
3104
|
+
* Assure qu'un conteneur est un objet, en convertissant si nécessaire
|
|
3105
|
+
* @param {*} container - Le conteneur à vérifier
|
|
3106
|
+
* @param {string|null} key - La clé dans le conteneur parent
|
|
3107
|
+
* @param {Object|null} parent - Le conteneur parent
|
|
3108
|
+
* @param {boolean} forceObject - Forcer la conversion en objet même s'il n'y a pas de conflit
|
|
3109
|
+
* @returns {Object} Le conteneur (converti en objet si nécessaire)
|
|
3110
|
+
*/
|
|
3111
|
+
var ensureObject = function ensureObject(container, key, parent) {
|
|
3112
|
+
var forceObject = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
3113
|
+
if (Array.isArray(container)) {
|
|
3114
|
+
var obj = arrayToObject(container);
|
|
3115
|
+
if (parent && key !== null) {
|
|
3116
|
+
parent[key] = obj;
|
|
3117
|
+
}
|
|
3118
|
+
return obj;
|
|
3119
|
+
}
|
|
3120
|
+
if (_typeof(container) !== 'object' || container === null) {
|
|
3121
|
+
var _obj = {};
|
|
3122
|
+
if (parent && key !== null) {
|
|
3123
|
+
parent[key] = _obj;
|
|
3124
|
+
}
|
|
3125
|
+
return _obj;
|
|
3126
|
+
}
|
|
3127
|
+
return container;
|
|
3128
|
+
};
|
|
3129
|
+
|
|
3130
|
+
/**
|
|
3131
|
+
* Assure qu'un conteneur est un tableau, en convertissant si nécessaire
|
|
3132
|
+
* @param {*} container - Le conteneur à vérifier
|
|
3133
|
+
* @param {string|null} key - La clé dans le conteneur parent
|
|
3134
|
+
* @param {Object|null} parent - Le conteneur parent
|
|
3135
|
+
* @returns {Array} Le conteneur (converti en tableau si nécessaire)
|
|
3136
|
+
*/
|
|
3137
|
+
var ensureArray = function ensureArray(container, key, parent) {
|
|
3138
|
+
if (!Array.isArray(container)) {
|
|
3139
|
+
var arr = objectToArray(container);
|
|
3140
|
+
if (parent && key !== null) {
|
|
3141
|
+
parent[key] = arr;
|
|
3142
|
+
}
|
|
3143
|
+
return arr;
|
|
3144
|
+
}
|
|
3145
|
+
return container;
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
// ============================================================================
|
|
3149
|
+
// PHASE 2 : TRAITEMENT DES VALEURS
|
|
3150
|
+
// ============================================================================
|
|
3151
|
+
|
|
3152
|
+
/**
|
|
3153
|
+
* Traite une valeur finale (dernière partie du chemin)
|
|
3154
|
+
* @param {*} container - Le conteneur actuel
|
|
3155
|
+
* @param {Object} part - La partie à traiter
|
|
3156
|
+
* @param {*} value - La valeur à assigner
|
|
3157
|
+
* @param {Object} parent - Le conteneur parent
|
|
3158
|
+
* @param {string} basePath - Le chemin de base pour la détection de conflit
|
|
3159
|
+
*/
|
|
3160
|
+
var processFinalValue = function processFinalValue(container, part, value, parent, basePath) {
|
|
3161
|
+
if (part.type === 'array') {
|
|
3162
|
+
var _container, _part$name, _container$_part$name;
|
|
3163
|
+
// Tableau explicite avec []
|
|
3164
|
+
(_container$_part$name = (_container = container)[_part$name = part.name]) !== null && _container$_part$name !== void 0 ? _container$_part$name : _container[_part$name] = [];
|
|
3165
|
+
if (Array.isArray(container[part.name])) {
|
|
3166
|
+
container[part.name].push(value);
|
|
3167
|
+
} else {
|
|
3168
|
+
container[part.name] = [container[part.name], value];
|
|
3169
|
+
}
|
|
3170
|
+
} else if (part.type === 'numeric') {
|
|
3171
|
+
// Indice numérique final
|
|
3172
|
+
var index = part.index;
|
|
3173
|
+
container = ensureArray(container, parent.key, parent.container);
|
|
3174
|
+
while (container.length <= index) {
|
|
3175
|
+
container.push(undefined);
|
|
3176
|
+
}
|
|
3177
|
+
container[index] = value;
|
|
3178
|
+
} else {
|
|
3179
|
+
// Clé simple finale
|
|
3180
|
+
var conflict = hasConflict(basePath);
|
|
3181
|
+
if (conflict) {
|
|
3182
|
+
container = ensureObject(container, parent.key, parent.container, true);
|
|
3183
|
+
if (Array.isArray(container[part.name])) {
|
|
3184
|
+
container[part.name] = arrayToObject(container[part.name]);
|
|
3185
|
+
}
|
|
3186
|
+
if (container[part.name] !== undefined && (_typeof(container[part.name]) !== 'object' || container[part.name] === null)) {
|
|
3187
|
+
container[part.name] = value;
|
|
3188
|
+
} else if (container[part.name] === undefined) {
|
|
3189
|
+
container[part.name] = value;
|
|
3190
|
+
} else if (Array.isArray(container[part.name])) {
|
|
3191
|
+
container[part.name].push(value);
|
|
3192
|
+
} else {
|
|
3193
|
+
container[part.name] = [container[part.name], value];
|
|
3194
|
+
}
|
|
3195
|
+
} else {
|
|
3196
|
+
if (container[part.name] === undefined) {
|
|
3197
|
+
container[part.name] = value;
|
|
3198
|
+
} else if (Array.isArray(container[part.name])) {
|
|
3199
|
+
container[part.name].push(value);
|
|
3200
|
+
} else {
|
|
3201
|
+
container[part.name] = [container[part.name], value];
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
/**
|
|
3208
|
+
* Traite une partie intermédiaire (crée la structure)
|
|
3209
|
+
* @param {*} container - Le conteneur actuel
|
|
3210
|
+
* @param {Object} part - La partie à traiter
|
|
3211
|
+
* @param {Object|null} nextPart - La partie suivante (peut être null)
|
|
3212
|
+
* @param {Object} parent - Le conteneur parent
|
|
3213
|
+
* @param {string} basePath - Le chemin de base pour la détection de conflit
|
|
3214
|
+
* @param {Array} parts - Toutes les parties du chemin (pour construire le chemin complet dans les erreurs)
|
|
3215
|
+
* @param {number} i - L'index de la partie actuelle (pour construire le chemin complet dans les erreurs)
|
|
3216
|
+
* @param {string} key - La clé du formulaire (pour les messages d'erreur)
|
|
3217
|
+
* @returns {*} Le nouveau conteneur après traitement
|
|
3218
|
+
*/
|
|
3219
|
+
var processIntermediatePart = function processIntermediatePart(container, part, nextPart, parent, basePath, parts, i, key) {
|
|
3220
|
+
if (part.type === 'numeric') {
|
|
3221
|
+
// Indice numérique : le container doit être un tableau ou un objet (selon conflit)
|
|
3222
|
+
var index = part.index;
|
|
3223
|
+
var _conflict = hasConflict(basePath);
|
|
3224
|
+
if (_conflict) {
|
|
3225
|
+
var _container2, _container2$index;
|
|
3226
|
+
// Conflit : utiliser un objet (les indices seront des propriétés)
|
|
3227
|
+
container = ensureObject(container, parent.key, parent.container, true);
|
|
3228
|
+
(_container2$index = (_container2 = container)[index]) !== null && _container2$index !== void 0 ? _container2$index : _container2[index] = {};
|
|
3229
|
+
if (_typeof(container[index]) !== 'object' || container[index] === null) {
|
|
3230
|
+
// Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
|
|
3231
|
+
var pathParts = parts.slice(0, i + 1);
|
|
3232
|
+
var currentPath = buildPathString(pathParts);
|
|
3233
|
+
throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(currentPath, "\" but it is already a ").concat(_typeof(container[index]), " value: ").concat(JSON.stringify(container[index]), ". ") + "This should have been detected during conflict detection phase.");
|
|
3234
|
+
}
|
|
3235
|
+
} else {
|
|
3236
|
+
var _container3, _container3$index;
|
|
3237
|
+
// Pas de conflit : utiliser un tableau
|
|
3238
|
+
container = ensureArray(container, parent.key, parent.container);
|
|
3239
|
+
while (container.length <= index) {
|
|
3240
|
+
container.push(undefined);
|
|
3241
|
+
}
|
|
3242
|
+
(_container3$index = (_container3 = container)[index]) !== null && _container3$index !== void 0 ? _container3$index : _container3[index] = {};
|
|
3243
|
+
if (_typeof(container[index]) !== 'object' || container[index] === null) {
|
|
3244
|
+
// Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
|
|
3245
|
+
var _pathParts = parts.slice(0, i + 1);
|
|
3246
|
+
var _currentPath = buildPathString(_pathParts);
|
|
3247
|
+
throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath, "\" but it is already a ").concat(_typeof(container[index]), " value: ").concat(JSON.stringify(container[index]), ". ") + "This should have been detected during conflict detection phase.");
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
return container[index];
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
// Clé normale : créer objet ou tableau selon la partie suivante
|
|
3254
|
+
var nextIsNumeric = (nextPart === null || nextPart === void 0 ? void 0 : nextPart.type) === 'numeric';
|
|
3255
|
+
var conflict = hasConflict(basePath);
|
|
3256
|
+
if (conflict) {
|
|
3257
|
+
var _container4, _part$name2, _container4$_part$nam;
|
|
3258
|
+
// Conflit : toujours utiliser un objet
|
|
3259
|
+
container = ensureObject(container, parent.key, parent.container, true);
|
|
3260
|
+
(_container4$_part$nam = (_container4 = container)[_part$name2 = part.name]) !== null && _container4$_part$nam !== void 0 ? _container4$_part$nam : _container4[_part$name2] = {};
|
|
3261
|
+
if (Array.isArray(container[part.name])) {
|
|
3262
|
+
container[part.name] = arrayToObject(container[part.name]);
|
|
3263
|
+
} else if (_typeof(container[part.name]) !== 'object' || container[part.name] === null) {
|
|
3264
|
+
// Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
|
|
3265
|
+
var _pathParts2 = parts.slice(0, i + 1);
|
|
3266
|
+
var _currentPath2 = buildPathString(_pathParts2);
|
|
3267
|
+
throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath2, "\" but it is already a ").concat(_typeof(container[part.name]), " value: ").concat(JSON.stringify(container[part.name]), ". ") + "This should have been detected during conflict detection phase.");
|
|
3268
|
+
}
|
|
3269
|
+
} else if (container[part.name] === undefined) {
|
|
3270
|
+
// Pas de conflit, créer selon la partie suivante
|
|
3271
|
+
container[part.name] = nextIsNumeric ? [] : {};
|
|
3272
|
+
} else if (nextIsNumeric && !Array.isArray(container[part.name])) {
|
|
3273
|
+
// On a besoin d'un tableau mais c'est un objet
|
|
3274
|
+
var hasStringKeys = Object.keys(container[part.name]).some(function (k) {
|
|
3275
|
+
var numKey = Number.parseInt(k, 10);
|
|
3276
|
+
return Number.isNaN(numKey) || k !== String(numKey);
|
|
3277
|
+
});
|
|
3278
|
+
if (!hasStringKeys) {
|
|
3279
|
+
container[part.name] = objectToArray(container[part.name]);
|
|
3280
|
+
}
|
|
3281
|
+
} else if (!nextIsNumeric && !isPlainObject(container[part.name])) {
|
|
3282
|
+
// On a besoin d'un objet mais c'est un tableau
|
|
3283
|
+
if (Array.isArray(container[part.name])) {
|
|
3284
|
+
container[part.name] = arrayToObject(container[part.name]);
|
|
3285
|
+
} else {
|
|
3286
|
+
container[part.name] = {};
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
// S'assurer que container[part.name] est bien un objet après toutes les conversions
|
|
3291
|
+
if (container[part.name] !== undefined && (_typeof(container[part.name]) !== 'object' || container[part.name] === null)) {
|
|
3292
|
+
// Cette erreur ne devrait jamais se produire si la détection fonctionne correctement
|
|
3293
|
+
var _pathParts3 = parts.slice(0, i + 1);
|
|
3294
|
+
var _currentPath3 = buildPathString(_pathParts3);
|
|
3295
|
+
throw new Error("Cannot access property on primitive value. " + "Key \"".concat(key, "\" tries to access \"").concat(_currentPath3, "\" but it is already a ").concat(_typeof(container[part.name]), " value: ").concat(JSON.stringify(container[part.name]), ". ") + "This should have been detected during conflict detection phase.");
|
|
3296
|
+
}
|
|
3297
|
+
return container[part.name];
|
|
3298
|
+
};
|
|
3299
|
+
|
|
3300
|
+
// Traiter toutes les entrées
|
|
3301
|
+
for (var _i3 = 0, _allEntries = allEntries; _i3 < _allEntries.length; _i3++) {
|
|
3302
|
+
var _parts$;
|
|
3303
|
+
var _allEntries$_i = _allEntries[_i3],
|
|
3304
|
+
value = _allEntries$_i.value,
|
|
3305
|
+
key = _allEntries$_i.key;
|
|
3306
|
+
if (!key) continue;
|
|
3307
|
+
var parts = parseKey(key);
|
|
3308
|
+
var path = [{
|
|
3309
|
+
container: jsonData,
|
|
3310
|
+
key: null
|
|
3311
|
+
}];
|
|
3312
|
+
var container = jsonData;
|
|
3313
|
+
var basePath = ((_parts$ = parts[0]) === null || _parts$ === void 0 ? void 0 : _parts$.type) === 'key' ? parts[0].name : '';
|
|
3314
|
+
for (var i = 0; i < parts.length; i++) {
|
|
3315
|
+
var part = parts[i];
|
|
3316
|
+
var isLast = i === parts.length - 1;
|
|
3317
|
+
var nextPart = i + 1 < parts.length ? parts[i + 1] : null;
|
|
3318
|
+
var parent = path[path.length - 1];
|
|
3319
|
+
if (isLast) {
|
|
3320
|
+
// Dernière partie : assigner la valeur
|
|
3321
|
+
processFinalValue(container, part, value, parent, basePath);
|
|
3322
|
+
} else {
|
|
3323
|
+
// Partie intermédiaire : créer la structure
|
|
3324
|
+
var newContainer = processIntermediatePart(container, part, nextPart, parent, basePath, parts, i, key);
|
|
3325
|
+
path.push({
|
|
3326
|
+
container: container,
|
|
3327
|
+
key: part.type === 'numeric' ? part.index : part.name
|
|
3328
|
+
});
|
|
3329
|
+
container = newContainer;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
return jsonData;
|
|
3334
|
+
};
|
|
3335
|
+
|
|
3336
|
+
/**
|
|
3337
|
+
* Parse une clé de formulaire pour extraire les parties (nom, indices, etc.)
|
|
3338
|
+
* @param {string} key - La clé à parser (ex: "user[email]", "tags[]", "items[0][name]")
|
|
3339
|
+
* @returns {Array<{name: string, type: string, index?: number}>} Tableau des parties parsées
|
|
3340
|
+
* @private
|
|
3341
|
+
*/
|
|
3342
|
+
var parseKey = function parseKey(key) {
|
|
3343
|
+
var parts = [];
|
|
3344
|
+
var current = '';
|
|
3345
|
+
var i = 0;
|
|
3346
|
+
var len = key.length;
|
|
3347
|
+
while (i < len) {
|
|
3348
|
+
var _char = key[i];
|
|
3349
|
+
if (_char === '[') {
|
|
3350
|
+
// Sauvegarder la partie précédente si elle existe
|
|
3351
|
+
if (current) {
|
|
3352
|
+
parts.push({
|
|
3353
|
+
name: current,
|
|
3354
|
+
type: 'key'
|
|
3355
|
+
});
|
|
3356
|
+
current = '';
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
// Trouver la fin du crochet
|
|
3360
|
+
i++;
|
|
3361
|
+
var bracketContent = '';
|
|
3362
|
+
while (i < len && key[i] !== ']') {
|
|
3363
|
+
bracketContent += key[i];
|
|
3364
|
+
i++;
|
|
3365
|
+
}
|
|
3366
|
+
if (bracketContent === '') {
|
|
3367
|
+
// [] vide = tableau
|
|
3368
|
+
var lastPart = parts[parts.length - 1];
|
|
3369
|
+
if (lastPart) {
|
|
3370
|
+
lastPart.type = 'array';
|
|
3371
|
+
} else {
|
|
3372
|
+
// [] au début, créer une partie spéciale
|
|
3373
|
+
parts.push({
|
|
3374
|
+
name: '',
|
|
3375
|
+
type: 'array'
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
} else {
|
|
3379
|
+
// Contenu dans les crochets
|
|
3380
|
+
var numIndex = Number.parseInt(bracketContent, 10);
|
|
3381
|
+
if (!Number.isNaN(numIndex) && bracketContent === String(numIndex)) {
|
|
3382
|
+
// Indice numérique
|
|
3383
|
+
parts.push({
|
|
3384
|
+
name: String(numIndex),
|
|
3385
|
+
type: 'numeric',
|
|
3386
|
+
index: numIndex
|
|
3387
|
+
});
|
|
3388
|
+
} else {
|
|
3389
|
+
// Nom de propriété
|
|
3390
|
+
parts.push({
|
|
3391
|
+
name: bracketContent,
|
|
3392
|
+
type: 'key'
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
i++; // Passer le ']'
|
|
3397
|
+
} else {
|
|
3398
|
+
current += _char;
|
|
3399
|
+
i++;
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
// Ajouter la dernière partie si elle existe
|
|
3404
|
+
if (current) {
|
|
3405
|
+
parts.push({
|
|
3406
|
+
name: current,
|
|
3407
|
+
type: 'key'
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
return parts;
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
/**
|
|
3414
|
+
* Vérifie si une valeur est un objet simple (pas un tableau, pas null)
|
|
3415
|
+
* @param {*} obj - La valeur à vérifier
|
|
3416
|
+
* @returns {boolean}
|
|
3417
|
+
* @private
|
|
3418
|
+
*/
|
|
3419
|
+
var isPlainObject = function isPlainObject(obj) {
|
|
3420
|
+
return _typeof(obj) === 'object' && obj !== null && !Array.isArray(obj);
|
|
3421
|
+
};
|
|
3422
|
+
|
|
2731
3423
|
/***/ }),
|
|
2732
3424
|
|
|
2733
3425
|
/***/ "./modules/tristate/tristate.mjs":
|
|
@@ -3039,42 +3731,44 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3039
3731
|
/* harmony import */ var _modules_dialog_dialog_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/dialog/dialog.mjs */ "./modules/dialog/dialog.mjs");
|
|
3040
3732
|
/* harmony import */ var _modules_toast_toast_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/toast/toast.mjs */ "./modules/toast/toast.mjs");
|
|
3041
3733
|
/* harmony import */ var _modules_common_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/common.mjs */ "./modules/common.mjs");
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
*
|
|
3052
|
-
* @
|
|
3053
|
-
* @
|
|
3054
|
-
*
|
|
3055
|
-
*
|
|
3056
|
-
*
|
|
3057
|
-
*
|
|
3058
|
-
*
|
|
3059
|
-
*
|
|
3060
|
-
*
|
|
3061
|
-
*
|
|
3062
|
-
*
|
|
3063
|
-
*
|
|
3064
|
-
*
|
|
3065
|
-
*
|
|
3066
|
-
*
|
|
3067
|
-
*
|
|
3068
|
-
*
|
|
3069
|
-
*
|
|
3070
|
-
*
|
|
3071
|
-
*
|
|
3072
|
-
*
|
|
3073
|
-
*
|
|
3074
|
-
*
|
|
3075
|
-
*
|
|
3076
|
-
*
|
|
3077
|
-
*
|
|
3734
|
+
/* harmony import */ var _modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/tools/exports.mjs */ "./modules/tools/exports.mjs");
|
|
3735
|
+
|
|
3736
|
+
|
|
3737
|
+
|
|
3738
|
+
|
|
3739
|
+
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
/**
|
|
3743
|
+
* Creates an APX object that wraps one or more HTML elements.
|
|
3744
|
+
* @param {string|HTMLElement|NodeList|HTMLCollection|Array<HTMLElement>|jQuery|Function} input - The input to create the APX object from.
|
|
3745
|
+
* @returns {Object} The APX object.
|
|
3746
|
+
* @throws {Error} If the input type is invalid.
|
|
3747
|
+
* @example
|
|
3748
|
+
* // XPath
|
|
3749
|
+
* const apx1 = APX('//div[@class="example"]');
|
|
3750
|
+
*
|
|
3751
|
+
* // CSS selector
|
|
3752
|
+
* const apx2 = APX('.example');
|
|
3753
|
+
*
|
|
3754
|
+
* // Single element
|
|
3755
|
+
* const element = document.querySelector('.example');
|
|
3756
|
+
* const apx3 = APX(element);
|
|
3757
|
+
*
|
|
3758
|
+
* // NodeList or HTMLCollection
|
|
3759
|
+
* const nodeList = document.querySelectorAll('.example');
|
|
3760
|
+
* const apx4 = APX(nodeList);
|
|
3761
|
+
*
|
|
3762
|
+
* // Array of elements
|
|
3763
|
+
* const elements = [document.querySelector('.example1'), document.querySelector('.example2')];
|
|
3764
|
+
* const apx5 = APX(elements);
|
|
3765
|
+
*
|
|
3766
|
+
* // jQuery object
|
|
3767
|
+
* const $example = $('.example');
|
|
3768
|
+
* const apx6 = APX($example);
|
|
3769
|
+
*
|
|
3770
|
+
* // Function returning an APX object
|
|
3771
|
+
* const apx7 = APX(() => APX('.example'));
|
|
3078
3772
|
*/
|
|
3079
3773
|
var APX = function APX(input) {
|
|
3080
3774
|
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
@@ -3150,11 +3844,13 @@ var APX = function APX(input) {
|
|
|
3150
3844
|
};
|
|
3151
3845
|
(0,_modules_listen_listen_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(apx);
|
|
3152
3846
|
(0,_modules_tristate_tristate_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(apx);
|
|
3847
|
+
(0,_modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__.augmentWithPack)(apx);
|
|
3153
3848
|
return apx;
|
|
3154
3849
|
};
|
|
3155
3850
|
APX.loadCss = _modules_common_mjs__WEBPACK_IMPORTED_MODULE_4__.loadCss;
|
|
3156
3851
|
APX.dialog = _modules_dialog_dialog_mjs__WEBPACK_IMPORTED_MODULE_2__["default"];
|
|
3157
3852
|
APX.toast = _modules_toast_toast_mjs__WEBPACK_IMPORTED_MODULE_3__["default"];
|
|
3853
|
+
APX.tools = _modules_tools_exports_mjs__WEBPACK_IMPORTED_MODULE_5__.tools;
|
|
3158
3854
|
APX.isAPXObject = function (obj) {
|
|
3159
3855
|
return obj && obj._isAPXObject === true;
|
|
3160
3856
|
};
|