Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

136 lines
18KB

  1. (self["webpackChunk"] = self["webpackChunk"] || []).push([["adminlte-field-collection"],{
  2. /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js":
  3. /*!**************************************************************************************************!*\
  4. !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js ***!
  5. \**************************************************************************************************/
  6. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  7. "use strict";
  8. __webpack_require__.r(__webpack_exports__);
  9. /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
  10. /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_0__);
  11. /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ "./node_modules/core-js/modules/es.regexp.exec.js");
  12. /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__);
  13. /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ "./node_modules/core-js/modules/es.string.replace.js");
  14. /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_2__);
  15. /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui-dist/jquery-ui.js");
  16. /* harmony import */ var jquery_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery_ui__WEBPACK_IMPORTED_MODULE_3__);
  17. /* harmony import */ var _form_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./form.scss */ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss");
  18. $(document).ready(function () {
  19. initCollectionWidget();
  20. });
  21. function initCollectionWidget() {
  22. $('.field-collection[data-prototype]').each(function (i, collectionWidget) {
  23. setCollectionWidgetSortable($(collectionWidget));
  24. reindexKeyCollectionWidget($(collectionWidget));
  25. setCollectionWidgetAdd($(collectionWidget));
  26. setCollectionWidgetDelete($(collectionWidget));
  27. });
  28. }
  29. function setCollectionWidgetAdd($collectionWidget) {
  30. if ($collectionWidget.data('allow-add')) {
  31. $collectionWidget.find('.field-collection-add').on('click', function (e) {
  32. // grab the prototype template
  33. var newWidget = $collectionWidget.attr('data-prototype'); // replace the "__name__" used in the id and name of the prototype
  34. // with a number that's unique to your emails
  35. // end name attribute looks like name="contact[emails][2]"
  36. newWidget = newWidget.replace(/__name__/g, getNumItems($collectionWidget)); // create a new list element and add it to the list
  37. $collectionWidget.find('.form-widget-compound .field-collection-group').append(newWidget);
  38. $collectionWidget.find('.field-collection-item:last').find('.field-position').val(getNumItems($collectionWidget));
  39. reindexKeyCollectionWidget($collectionWidget);
  40. setCollectionWidgetDelete($collectionWidget);
  41. $collectionWidget.trigger('collection-add-item');
  42. $collectionWidget.data('num-items', $collectionWidget.data('num-items') + 1);
  43. $collectionWidget.find('.collection-empty').hide();
  44. });
  45. }
  46. }
  47. function setCollectionWidgetDelete($collectionWidget) {
  48. if ($collectionWidget.data('allow-delete')) {
  49. $collectionWidget.find('.field-collection-delete').off('click');
  50. $collectionWidget.find('.field-collection-delete').on('click', function () {
  51. $(this).parents('.form-group:first').remove();
  52. reindexKeyCollectionWidget($collectionWidget);
  53. if (getNumItems($collectionWidget) == 0) $collectionWidget.find('.collection-empty').show();
  54. });
  55. }
  56. }
  57. function getNumItems($collectionWidget) {
  58. if ($collectionWidget.data('reindex-key')) {
  59. return $collectionWidget.find('.field-collection-item').length;
  60. } else {
  61. return $collectionWidget.data('num-items');
  62. }
  63. }
  64. function reindexKeyCollectionWidget($collectionWidget) {
  65. if ($collectionWidget.data('reindex-key')) {
  66. $collectionWidget.find('.field-collection-item').each(function (i, item) {
  67. $(item).find('input,textarea').each(function (y, field) {
  68. var $field = $(field); //Chanegment ID
  69. var posId = SovTools.indexOfLastDigit($field.prop('id'));
  70. var idPrefix = $field.prop('id').substr(0, posId);
  71. var idSuffix = $field.prop('id').substr(posId + 1);
  72. $field.prop('id', idPrefix + i + idSuffix); //Chanegment Name
  73. var posName = SovTools.indexOfLastDigit($field.prop('name'));
  74. var namePrefix = $field.prop('name').substr(0, posName);
  75. var nameSuffix = $field.prop('name').substr(posName + 1);
  76. $field.prop('name', namePrefix + i + nameSuffix);
  77. });
  78. });
  79. }
  80. }
  81. function setCollectionWidgetSortable($collectionWidget) {
  82. if ($collectionWidget.data('sortable')) {
  83. $collectionWidget.find('.field-collection-group').sortable({
  84. "handle": '.lc-btn-sortable',
  85. cancel: ''
  86. });
  87. $collectionWidget.find('.field-collection-group').on("sortupdate", function (event, ui) {
  88. $collectionWidget.find('.field-collection-group>div').each(function (index, item) {
  89. $(item).find('.field-position').val(index);
  90. });
  91. });
  92. }
  93. }
  94. /***/ }),
  95. /***/ "../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss":
  96. /*!******************************************************************************************!*\
  97. !*** ../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/form.scss ***!
  98. \******************************************************************************************/
  99. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  100. "use strict";
  101. __webpack_require__.r(__webpack_exports__);
  102. // extracted by mini-css-extract-plugin
  103. /***/ })
  104. },
  105. /******/ __webpack_require__ => { // webpackRuntimeModules
  106. /******/ "use strict";
  107. /******/
  108. /******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
  109. /******/ __webpack_require__.O(0, ["vendors-node_modules_core-js_internals_export_js","vendors-node_modules_core-js_modules_es_string_replace_js","vendors-node_modules_core-js_modules_es_array_find_js","vendors-node_modules_jquery_src_jquery_js","vendors-node_modules_jquery-ui-dist_jquery-ui_js"], () => (__webpack_exec__("../LaClicBundle/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js")));
  110. /******/ var __webpack_exports__ = __webpack_require__.O();
  111. /******/ }
  112. ]);
  113. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi4vTGFDbGljQnVuZGxlL1NvdkJ1bmRsZS9SZXNvdXJjZXMvYXNzZXRzL2FwcC9hZG1pbmx0ZS9maWVsZC9jb2xsZWN0aW9uL2FwcC5jb2xsZWN0aW9uLmpzIiwid2VicGFjazovLy8uLi9MYUNsaWNCdW5kbGUvU292QnVuZGxlL1Jlc291cmNlcy9hc3NldHMvYXBwL2FkbWlubHRlL2ZpZWxkL2NvbGxlY3Rpb24vZm9ybS5zY3NzIl0sIm5hbWVzIjpbIiQiLCJkb2N1bWVudCIsInJlYWR5IiwiaW5pdENvbGxlY3Rpb25XaWRnZXQiLCJlYWNoIiwiaSIsImNvbGxlY3Rpb25XaWRnZXQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0U29ydGFibGUiLCJyZWluZGV4S2V5Q29sbGVjdGlvbldpZGdldCIsInNldENvbGxlY3Rpb25XaWRnZXRBZGQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0RGVsZXRlIiwiJGNvbGxlY3Rpb25XaWRnZXQiLCJkYXRhIiwiZmluZCIsIm9uIiwiZSIsIm5ld1dpZGdldCIsImF0dHIiLCJyZXBsYWNlIiwiZ2V0TnVtSXRlbXMiLCJhcHBl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lY3Rpb25XaWRnZXQuZGF0YSgncmVpbmRleC1rZXknKSkge1xuICAgICAgICAkY29sbGVjdGlvbldpZGdldC5maW5kKCcuZmllbGQtY29sbGVjdGlvbi1pdGVtJykuZWFjaChmdW5jdGlvbiAoaSwgaXRlbSkge1xuICAgICAgICAgICAgJChpdGVtKS5maW5kKCdpbnB1dCx0ZXh0YXJlYScpLmVhY2goZnVuY3Rpb24gKHksIGZpZWxkKSB7XG4gICAgICAgICAgICAgICAgbGV0ICRmaWVsZCA9ICQoZmllbGQpO1xuICAgICAgICAgICAgICAgIC8vQ2hhbmVnbWVudCBJRFxuICAgICAgICAgICAgICAgIGxldCBwb3NJZCA9IFNvdlRvb2xzLmluZGV4T2ZMYXN0RGlnaXQoJGZpZWxkLnByb3AoJ2lkJykpO1xuICAgICAgICAgICAgICAgIGxldCBpZFByZWZpeCA9ICRmaWVsZC5wcm9wKCdpZCcpLnN1YnN0cigwLCBwb3NJZCk7XG4gICAgICAgICAgICAgICAgbGV0IGlkU3VmZml4ID0gJGZpZWxkLnByb3AoJ2lkJykuc3Vic3RyKHBvc0lkICsgMSk7XG4gICAgICAgICAgICAgICAgJGZpZWxkLnByb3AoJ2lkJywgaWRQcmVmaXggKyBpICsgaWRTdWZmaXgpO1xuXG4gICAgICAgICAgICAgICAgLy9DaGFuZWdtZW50IE5hbWVcbiAgICAgICAgICAgICAgICBsZXQgcG9zTmFtZSA9IFNvdlRvb2xzLmluZGV4T2ZMYXN0RGlnaXQoJGZpZWxkLnByb3AoJ25hbWUnKSk7XG4gICAgICAgICAgICAgICAgbGV0IG5hbWVQcmVmaXggPSAkZmllbGQucHJvcCgnbmFtZScpLnN1YnN0cigwLCBwb3NOYW1lKTtcbiAgICAgICAgICAgICAgICBsZXQgbmFtZVN1ZmZpeCA9ICRmaWVsZC5wcm9wKCduYW1lJykuc3Vic3RyKHBvc05hbWUgKyAxKTtcbiAgICAgICAgICAgICAgICAkZmllbGQucHJvcCgnbmFtZScsIG5hbWVQcm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