You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 satır
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 = Tools.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 = Tools.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_a-function_js-node_modules_core-js_internals_export_js","vendors-node_modules_core-js_modules_es_array_find_js","vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-bed4a0","vendors-node_modules_jquery_src_jquery_js","vendors-node_modules_core-js_modules_es_string_replace_js-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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi4vTGFDbGljQnVuZGxlL1NvdkJ1bmRsZS9SZXNvdXJjZXMvYXNzZXRzL2FwcC9hZG1pbmx0ZS9maWVsZC9jb2xsZWN0aW9uL2FwcC5jb2xsZWN0aW9uLmpzIiwid2VicGFjazovLy8uLi9MYUNsaWNCdW5kbGUvU292QnVuZGxlL1Jlc291cmNlcy9hc3NldHMvYXBwL2FkbWlubHRlL2ZpZWxkL2NvbGxlY3Rpb24vZm9ybS5zY3NzIl0sIm5hbWVzIjpbIiQiLCJkb2N1bWVudCIsInJlYWR5IiwiaW5pdENvbGxlY3Rpb25XaWRnZXQiLCJlYWNoIiwiaSIsImNvbGxlY3Rpb25XaWRnZXQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0U29ydGFibGUiLCJyZWluZGV4S2V5Q29sbGVjdGlvbldpZGdldCIsInNldENvbGxlY3Rpb25XaWRnZXRBZGQiLCJzZXRDb2xsZWN0aW9uV2lkZ2V0RGVsZXRlIiwiJGNvbGxlY3Rpb25XaWRnZXQiLCJkYXRhIiwiZmluZCIsIm9uIiwiZSIsIm5ld1dpZGdldCIsImF0dHIiLCJyZXBsY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