PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.3
Secure Custom Fields v6.9.3
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / assets / build / js / pro / acf-pro-field-group.js
secure-custom-fields / assets / build / js / pro Last commit date
acf-datastore.asset.php 3 months ago acf-datastore.js 3 months ago acf-datastore.js.map 3 months ago acf-datastore.min.asset.php 3 months ago acf-datastore.min.js 3 months ago acf-field-bindings.asset.php 3 months ago acf-field-bindings.js 3 months ago acf-field-bindings.js.map 3 months ago acf-field-bindings.min.asset.php 3 months ago acf-field-bindings.min.js 3 months ago acf-pro-blocks.asset.php 1 month ago acf-pro-blocks.js 1 month ago acf-pro-blocks.js.map 1 month ago acf-pro-blocks.min.asset.php 1 month ago acf-pro-blocks.min.js 1 month ago acf-pro-field-group.asset.php 11 months ago acf-pro-field-group.js 11 months ago acf-pro-field-group.js.map 9 months ago acf-pro-field-group.min.asset.php 9 months ago acf-pro-field-group.min.js 9 months ago acf-pro-input.asset.php 1 month ago acf-pro-input.js 1 month ago acf-pro-input.js.map 1 month ago acf-pro-input.min.asset.php 1 month ago acf-pro-input.min.js 1 month ago acf-pro-ui-options-page.asset.php 9 months ago acf-pro-ui-options-page.js 9 months ago acf-pro-ui-options-page.js.map 9 months ago acf-pro-ui-options-page.min.asset.php 9 months ago acf-pro-ui-options-page.min.js 9 months ago index.php 1 year ago
acf-pro-field-group.js
680 lines
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./assets/src/js/pro/_acf-setting-clone.js":
5 /*!*************************************************!*\
6 !*** ./assets/src/js/pro/_acf-setting-clone.js ***!
7 \*************************************************/
8 /***/ (() => {
9
10 (function ($) {
11 /**
12 * CloneDisplayFieldSetting
13 *
14 * Extra logic for this field setting
15 *
16 * @date 18/4/18
17 * @since ACF 5.6.9
18 *
19 * @param void
20 * @return void
21 */
22
23 var CloneDisplayFieldSetting = acf.FieldSetting.extend({
24 type: 'clone',
25 name: 'display',
26 render: function () {
27 // vars
28 var display = this.field.val();
29
30 // set data attribute used by CSS to hide/show
31 this.$fieldObject.attr('data-display', display);
32 }
33 });
34 acf.registerFieldSetting(CloneDisplayFieldSetting);
35
36 /**
37 * ClonePrefixLabelFieldSetting
38 *
39 * Extra logic for this field setting
40 *
41 * @date 18/4/18
42 * @since ACF 5.6.9
43 *
44 * @param void
45 * @return void
46 */
47
48 var ClonePrefixLabelFieldSetting = acf.FieldSetting.extend({
49 type: 'clone',
50 name: 'prefix_label',
51 render: function () {
52 // vars
53 var prefix = '';
54
55 // if checked
56 if (this.field.val()) {
57 prefix = this.fieldObject.prop('label') + ' ';
58 }
59
60 // update HTML
61 this.$('code').html(prefix + '%field_label%');
62 }
63 });
64 acf.registerFieldSetting(ClonePrefixLabelFieldSetting);
65
66 /**
67 * ClonePrefixNameFieldSetting
68 *
69 * Extra logic for this field setting
70 *
71 * @date 18/4/18
72 * @since ACF 5.6.9
73 *
74 * @param void
75 * @return void
76 */
77
78 var ClonePrefixNameFieldSetting = acf.FieldSetting.extend({
79 type: 'clone',
80 name: 'prefix_name',
81 render: function () {
82 // vars
83 var prefix = '';
84
85 // if checked
86 if (this.field.val()) {
87 prefix = this.fieldObject.prop('name') + '_';
88 }
89
90 // update HTML
91 this.$('code').html(prefix + '%field_name%');
92 }
93 });
94 acf.registerFieldSetting(ClonePrefixNameFieldSetting);
95
96 /**
97 * cloneFieldSelectHelper
98 *
99 * Customizes the clone field setting Select2 instance
100 *
101 * @date 18/4/18
102 * @since ACF 5.6.9
103 *
104 * @param void
105 * @return void
106 */
107
108 var cloneFieldSelectHelper = new acf.Model({
109 filters: {
110 select2_args: 'select2Args'
111 },
112 select2Args: function (options, $select, data, $el, instance) {
113 // check
114 if (data.ajaxAction == 'acf/fields/clone/query') {
115 // remain open on select
116 options.closeOnSelect = false;
117
118 // customize ajaxData function
119 instance.data.ajaxData = this.ajaxData;
120 }
121
122 // return
123 return options;
124 },
125 ajaxData: function (data) {
126 // find current fields
127 data.fields = {};
128
129 // loop
130 acf.getFieldObjects().map(function (fieldObject) {
131 // append
132 data.fields[fieldObject.prop('key')] = {
133 key: fieldObject.prop('key'),
134 type: fieldObject.prop('type'),
135 label: fieldObject.prop('label'),
136 ancestors: fieldObject.getParents().length
137 };
138 });
139
140 // append title
141 data.title = $('#title').val();
142
143 // return
144 return data;
145 }
146 });
147 })(jQuery);
148
149 /***/ }),
150
151 /***/ "./assets/src/js/pro/_acf-setting-flexible-content.js":
152 /*!************************************************************!*\
153 !*** ./assets/src/js/pro/_acf-setting-flexible-content.js ***!
154 \************************************************************/
155 /***/ (() => {
156
157 (function ($) {
158 /**
159 * CloneDisplayFieldSetting
160 *
161 * Extra logic for this field setting
162 *
163 * @date 18/4/18
164 * @since ACF 5.6.9
165 *
166 * @param void
167 * @return void
168 */
169
170 var FlexibleContentLayoutFieldSetting = acf.FieldSetting.extend({
171 type: 'flexible_content',
172 name: 'fc_layout',
173 events: {
174 'blur .layout-label': 'onChangeLabel',
175 'blur .layout-name': 'onChangeName',
176 'click .add-layout': 'onClickAdd',
177 'click .acf-field-settings-fc_head': 'onClickEdit',
178 'click .acf-field-setting-fc-duplicate': 'onClickDuplicate',
179 'click .acf-field-setting-fc-delete': 'onClickDelete',
180 'changed:layoutLabel': 'updateLayoutTitles',
181 'changed:layoutName': 'updateLayoutTitles'
182 },
183 $input: function (name) {
184 return $('#' + this.getInputId() + '-' + name);
185 },
186 $list: function () {
187 return this.$('.acf-field-list:first');
188 },
189 getInputId: function () {
190 return this.fieldObject.getInputId() + '-layouts-' + this.field.get('id');
191 },
192 // get all sub fields
193 getFields: function () {
194 return acf.getFieldObjects({
195 parent: this.$el
196 });
197 },
198 // get immediate children
199 getChildren: function () {
200 return acf.getFieldObjects({
201 list: this.$list()
202 });
203 },
204 initialize: function () {
205 // add sortable
206 var $tbody = this.$el.parent();
207 $tbody.css('position', 'relative');
208 if (!$tbody.hasClass('ui-sortable')) {
209 $tbody.sortable({
210 items: '> .acf-field-setting-fc_layout',
211 handle: '.acf-fc_draggable',
212 zIndex: 9999,
213 forceHelperSize: true,
214 forcePlaceholderSize: true,
215 scroll: true,
216 stop: this.proxy(function (event, ui) {
217 this.fieldObject.save();
218 })
219 });
220 }
221
222 // add meta to sub fields
223 this.updateFieldLayouts();
224 this.updateLayoutTitles();
225 },
226 updateFieldLayouts: function () {
227 this.getChildren().map(this.updateFieldLayout, this);
228 },
229 updateFieldLayout: function (field) {
230 field.prop('parent_layout', this.get('id'));
231 },
232 updateLayoutTitles: function () {
233 const label = this.get('layoutLabel');
234 const name = this.get('layoutName');
235 const $layoutHeaderLabelText = this.$el.find('> .acf-label .acf-fc-layout-label');
236 if (label) {
237 $layoutHeaderLabelText.text(acf.decode(label));
238 }
239 const $layoutHeaderNameText = this.$el.find('> .acf-label .acf-fc-layout-name span');
240 if (name) {
241 $layoutHeaderNameText.text(name);
242 $layoutHeaderNameText.parent().css('display', '');
243 } else {
244 $layoutHeaderNameText.parent().css('display', 'none');
245 }
246 },
247 onClickEdit: function (e) {
248 const $target = $(e.target);
249 if ($target.hasClass('acf-btn') || $target.hasClass('copyable') || $target.parent().hasClass('acf-btn') || $target.parent().hasClass('copyable')) {
250 return;
251 }
252 this.isOpen() ? this.close() : this.open();
253 },
254 isOpen: function (e) {
255 const $settings = this.$el.children('.acf-field-layout-settings');
256 return $settings.hasClass('open');
257 },
258 open: function (element, isAddingLayout) {
259 const $header = element ? element.children('.acf-field-settings-fc_head') : this.$el.children('.acf-field-settings-fc_head');
260 const $settings = element ? element.children('.acf-field-layout-settings') : this.$el.children('.acf-field-layout-settings');
261 const toggle = element ? element.find('.toggle-indicator').first() : this.$el.find('.toggle-indicator').first();
262
263 // action (show)
264 acf.doAction('show', $settings);
265
266 // open
267 if (isAddingLayout) {
268 $settings.slideDown({
269 complete: function () {
270 $settings.find('.layout-label').trigger('focus');
271 }
272 });
273 } else {
274 $settings.slideDown();
275 }
276 toggle.addClass('open');
277 if (toggle.hasClass('closed')) {
278 toggle.removeClass('closed');
279 }
280 $settings.addClass('open');
281 $header.addClass('open');
282 },
283 close: function () {
284 const $header = this.$el.children('.acf-field-settings-fc_head');
285 const $settings = this.$el.children('.acf-field-layout-settings');
286 const toggle = this.$el.find('.toggle-indicator').first();
287
288 // close
289 $settings.slideUp();
290 $settings.removeClass('open');
291 toggle.removeClass('open');
292 $header.removeClass('open');
293 if (!toggle.hasClass('closed')) {
294 toggle.addClass('closed');
295 }
296
297 // action (hide)
298 acf.doAction('hide', $settings);
299 },
300 onChangeLabel: function (e, $el) {
301 let label = $el.val();
302 const safeLabel = acf.strEscape(label);
303 this.set('layoutLabel', safeLabel);
304 this.$el.attr('data-layout-label', safeLabel);
305 let $name = this.$input('name');
306
307 // render name
308 if ($name.val() == '') {
309 acf.val($name, acf.strSanitize(label));
310 this.$el.find('.layout-name').trigger('blur');
311 }
312 },
313 onChangeName: function (e, $el) {
314 const sanitizedName = acf.strSanitize($el.val(), false);
315 $el.val(sanitizedName);
316 this.set('layoutName', sanitizedName);
317 this.$el.attr('data-layout-name', sanitizedName);
318 },
319 onClickAdd: function (e, $el) {
320 e.preventDefault();
321 var prevKey = this.get('id');
322 var newKey = acf.uniqid('layout_');
323
324 // duplicate
325 $layout = acf.duplicate({
326 $el: this.$el,
327 search: prevKey,
328 replace: newKey,
329 after: function ($el, $el2) {
330 var $list = $el2.find('.acf-field-list:first');
331
332 // remove sub fields
333 $list.children('.acf-field-object').remove();
334
335 // show empty
336 $list.addClass('-empty');
337
338 // reset layout meta values
339 $el2.attr('data-layout-label', '');
340 $el2.attr('data-layout-name', '');
341 $el2.find('.acf-fc-meta input').val('');
342 $el2.find('label.acf-fc-layout-label').html(acf.__('Layout'));
343 }
344 });
345
346 // get layout
347 var layout = acf.getFieldSetting($layout);
348
349 // update hidden input
350 layout.$input('key').val(newKey);
351 !this.isOpen() ? this.open(layout.$el, true) : layout.$el.find('.layout-label').trigger('focus');
352
353 // save
354 this.fieldObject.save();
355 },
356 onClickDuplicate: function (e, $el) {
357 e.preventDefault();
358 var prevKey = this.get('id');
359 var newKey = acf.uniqid('layout_');
360
361 // duplicate
362 $layout = acf.duplicate({
363 $el: this.$el,
364 search: prevKey,
365 replace: newKey
366 });
367
368 // get all fields in new layout similar to fieldManager.onDuplicateField().
369 // important to run field.wipe() before making any changes to the "parent_layout" prop
370 // to ensure the correct input is modified.
371 var children = acf.getFieldObjects({
372 parent: $layout
373 });
374 if (children.length) {
375 // loop
376 children.map(function (child) {
377 // wipe field
378 child.wipe();
379
380 // if the child is open, re-fire the open method to ensure it's initialised correctly.
381 if (child.isOpen()) {
382 child.open();
383 }
384
385 // update parent
386 child.updateParent();
387 });
388
389 // action
390 acf.doAction('duplicate_field_objects', children, this.fieldObject, this.fieldObject);
391 }
392
393 // get layout
394 var layout = acf.getFieldSetting($layout);
395
396 // get current label/names so we can prepare to append 'copy'
397 var label = layout.get('layoutLabel');
398 var name = layout.get('layoutName');
399 var end = name.split('_').pop();
400 var copy = acf.__('copy');
401
402 // increase suffix "1"
403 if (acf.isNumeric(end)) {
404 var i = end * 1 + 1;
405 label = label.replace(end, i);
406 name = name.replace(end, i);
407
408 // increase suffix "(copy1)"
409 } else if (end.indexOf(copy) === 0) {
410 var i = end.replace(copy, '') * 1;
411 i = i ? i + 1 : 2;
412
413 // replace
414 label = label.replace(end, copy + i);
415 name = name.replace(end, copy + i);
416
417 // add default "(copy)"
418 } else {
419 label += ' (' + copy + ')';
420 name += '_' + copy;
421 }
422
423 // update inputs and data attributes which will trigger header label updates too.
424 layout.$input('label').val(label);
425 layout.set('layoutLabel', label);
426 layout.$el.attr('data-layout-label', label);
427 layout.$input('name').val(name);
428 layout.set('layoutName', name);
429 layout.$el.attr('data-layout-name', name);
430
431 // update hidden input
432 layout.$input('key').val(newKey);
433 !this.isOpen() ? this.open(layout.$el, true) : layout.$el.find('.layout-label').trigger('focus');
434 // save
435 this.fieldObject.save();
436 },
437 onClickDelete: function (e, $el) {
438 e.preventDefault();
439 // Bypass confirmation when holding down "shift" key.
440 if (e.shiftKey) {
441 return this.delete();
442 }
443
444 // add class
445 this.$el.addClass('-hover');
446
447 // add tooltip
448 var tooltip = acf.newTooltip({
449 confirmRemove: true,
450 target: $el,
451 context: this,
452 confirm: function () {
453 this.delete();
454 },
455 cancel: function () {
456 this.$el.removeClass('-hover');
457 }
458 });
459 },
460 delete: function () {
461 var $siblings = this.$el.siblings('.acf-field-setting-fc_layout');
462
463 // validate
464 if (!$siblings.length) {
465 alert(acf.__('Flexible Content requires at least 1 layout'));
466 return false;
467 }
468
469 // delete sub fields
470 this.getFields().map(function (child) {
471 child.delete({
472 animate: false
473 });
474 });
475
476 // remove tr
477 acf.remove(this.$el);
478
479 // save
480 this.fieldObject.save();
481 }
482 });
483 acf.registerFieldSetting(FlexibleContentLayoutFieldSetting);
484
485 /**
486 * flexibleContentHelper
487 *
488 * description
489 *
490 * @date 19/4/18
491 * @since ACF 5.6.9
492 *
493 * @param type $var Description. Default.
494 * @return type Description.
495 */
496
497 var flexibleContentHelper = new acf.Model({
498 actions: {
499 sortstop_field_object: 'updateParentLayout',
500 change_field_object_parent: 'updateParentLayout'
501 },
502 updateParentLayout: function (fieldObject) {
503 var parent = fieldObject.getParent();
504
505 // delete meta
506 if (!parent || parent.prop('type') !== 'flexible_content') {
507 fieldObject.prop('parent_layout', null);
508 return;
509 }
510
511 // get layout
512 var $layout = fieldObject.$el.closest('.acf-field-setting-fc_layout');
513 var layout = acf.getFieldSetting($layout);
514
515 // check if previous prop exists
516 // - if not, set prop to allow following code to trigger 'change' and save the field
517 if (!fieldObject.has('parent_layout')) {
518 fieldObject.prop('parent_layout', 0);
519 }
520
521 // update meta
522 fieldObject.prop('parent_layout', layout.get('id'));
523 }
524 });
525 })(jQuery);
526
527 /***/ }),
528
529 /***/ "./assets/src/js/pro/_acf-setting-repeater.js":
530 /*!****************************************************!*\
531 !*** ./assets/src/js/pro/_acf-setting-repeater.js ***!
532 \****************************************************/
533 /***/ (() => {
534
535 (function ($) {
536 /*
537 * Repeater
538 *
539 * This field type requires some extra logic for its settings
540 *
541 * @type function
542 * @date 24/10/13
543 * @since ACF 5.0.0
544 *
545 * @param n/a
546 * @return n/a
547 */
548
549 var RepeaterCollapsedFieldSetting = acf.FieldSetting.extend({
550 type: 'repeater',
551 name: 'collapsed',
552 events: {
553 'focus select': 'onFocus'
554 },
555 onFocus: function (e, $el) {
556 // vars
557 var $select = $el;
558
559 // collapsed
560 var choices = [];
561
562 // keep 'null' choice
563 choices.push({
564 label: $select.find('option[value=""]').text(),
565 value: ''
566 });
567
568 // find sub fields
569 var $list = this.fieldObject.$('.acf-field-list:first');
570 var fields = acf.getFieldObjects({
571 list: $list
572 });
573
574 // loop
575 fields.map(function (field) {
576 choices.push({
577 label: field.prop('label'),
578 value: field.prop('key')
579 });
580 });
581
582 // render
583 acf.renderSelect($select, choices);
584 }
585 });
586 acf.registerFieldSetting(RepeaterCollapsedFieldSetting);
587 })(jQuery);
588
589 /***/ })
590
591 /******/ });
592 /************************************************************************/
593 /******/ // The module cache
594 /******/ var __webpack_module_cache__ = {};
595 /******/
596 /******/ // The require function
597 /******/ function __webpack_require__(moduleId) {
598 /******/ // Check if module is in cache
599 /******/ var cachedModule = __webpack_module_cache__[moduleId];
600 /******/ if (cachedModule !== undefined) {
601 /******/ return cachedModule.exports;
602 /******/ }
603 /******/ // Create a new module (and put it into the cache)
604 /******/ var module = __webpack_module_cache__[moduleId] = {
605 /******/ // no module.id needed
606 /******/ // no module.loaded needed
607 /******/ exports: {}
608 /******/ };
609 /******/
610 /******/ // Execute the module function
611 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
612 /******/
613 /******/ // Return the exports of the module
614 /******/ return module.exports;
615 /******/ }
616 /******/
617 /************************************************************************/
618 /******/ /* webpack/runtime/compat get default export */
619 /******/ (() => {
620 /******/ // getDefaultExport function for compatibility with non-harmony modules
621 /******/ __webpack_require__.n = (module) => {
622 /******/ var getter = module && module.__esModule ?
623 /******/ () => (module['default']) :
624 /******/ () => (module);
625 /******/ __webpack_require__.d(getter, { a: getter });
626 /******/ return getter;
627 /******/ };
628 /******/ })();
629 /******/
630 /******/ /* webpack/runtime/define property getters */
631 /******/ (() => {
632 /******/ // define getter functions for harmony exports
633 /******/ __webpack_require__.d = (exports, definition) => {
634 /******/ for(var key in definition) {
635 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
636 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
637 /******/ }
638 /******/ }
639 /******/ };
640 /******/ })();
641 /******/
642 /******/ /* webpack/runtime/hasOwnProperty shorthand */
643 /******/ (() => {
644 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
645 /******/ })();
646 /******/
647 /******/ /* webpack/runtime/make namespace object */
648 /******/ (() => {
649 /******/ // define __esModule on exports
650 /******/ __webpack_require__.r = (exports) => {
651 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
652 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
653 /******/ }
654 /******/ Object.defineProperty(exports, '__esModule', { value: true });
655 /******/ };
656 /******/ })();
657 /******/
658 /************************************************************************/
659 var __webpack_exports__ = {};
660 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
661 (() => {
662 "use strict";
663 /*!**************************************************!*\
664 !*** ./assets/src/js/pro/acf-pro-field-group.js ***!
665 \**************************************************/
666 __webpack_require__.r(__webpack_exports__);
667 /* harmony import */ var _acf_setting_repeater_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_acf-setting-repeater.js */ "./assets/src/js/pro/_acf-setting-repeater.js");
668 /* harmony import */ var _acf_setting_repeater_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_acf_setting_repeater_js__WEBPACK_IMPORTED_MODULE_0__);
669 /* harmony import */ var _acf_setting_flexible_content_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_acf-setting-flexible-content.js */ "./assets/src/js/pro/_acf-setting-flexible-content.js");
670 /* harmony import */ var _acf_setting_flexible_content_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_acf_setting_flexible_content_js__WEBPACK_IMPORTED_MODULE_1__);
671 /* harmony import */ var _acf_setting_clone_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_acf-setting-clone.js */ "./assets/src/js/pro/_acf-setting-clone.js");
672 /* harmony import */ var _acf_setting_clone_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_acf_setting_clone_js__WEBPACK_IMPORTED_MODULE_2__);
673
674
675
676 })();
677
678 /******/ })()
679 ;
680 //# sourceMappingURL=acf-pro-field-group.js.map