[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-members/js/blocks/ -> member.js (source)

   1  // modules are defined as an array
   2  // [ module function, map of requires ]
   3  //
   4  // map of requires is short require name -> numeric require
   5  //
   6  // anything defined in a previous bundle is accessed via the
   7  // orig method which is the require for previous bundles
   8  parcelRequire = (function (modules, cache, entry, globalName) {
   9    // Save the require from previous bundle to this closure if any
  10    var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
  11    var nodeRequire = typeof require === 'function' && require;
  12  
  13    function newRequire(name, jumped) {
  14      if (!cache[name]) {
  15        if (!modules[name]) {
  16          // if we cannot find the module within our internal map or
  17          // cache jump to the current global require ie. the last bundle
  18          // that was added to the page.
  19          var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
  20          if (!jumped && currentRequire) {
  21            return currentRequire(name, true);
  22          }
  23  
  24          // If there are other bundles on this page the require from the
  25          // previous one is saved to 'previousRequire'. Repeat this as
  26          // many times as there are bundles until the module is found or
  27          // we exhaust the require chain.
  28          if (previousRequire) {
  29            return previousRequire(name, true);
  30          }
  31  
  32          // Try the node require function if it exists.
  33          if (nodeRequire && typeof name === 'string') {
  34            return nodeRequire(name);
  35          }
  36  
  37          var err = new Error('Cannot find module \'' + name + '\'');
  38          err.code = 'MODULE_NOT_FOUND';
  39          throw err;
  40        }
  41  
  42        localRequire.resolve = resolve;
  43        localRequire.cache = {};
  44  
  45        var module = cache[name] = new newRequire.Module(name);
  46  
  47        modules[name][0].call(module.exports, localRequire, module, module.exports, this);
  48      }
  49  
  50      return cache[name].exports;
  51  
  52      function localRequire(x){
  53        return newRequire(localRequire.resolve(x));
  54      }
  55  
  56      function resolve(x){
  57        return modules[name][1][x] || x;
  58      }
  59    }
  60  
  61    function Module(moduleName) {
  62      this.id = moduleName;
  63      this.bundle = newRequire;
  64      this.exports = {};
  65    }
  66  
  67    newRequire.isParcelRequire = true;
  68    newRequire.Module = Module;
  69    newRequire.modules = modules;
  70    newRequire.cache = cache;
  71    newRequire.parent = previousRequire;
  72    newRequire.register = function (id, exports) {
  73      modules[id] = [function (require, module) {
  74        module.exports = exports;
  75      }, {}];
  76    };
  77  
  78    var error;
  79    for (var i = 0; i < entry.length; i++) {
  80      try {
  81        newRequire(entry[i]);
  82      } catch (e) {
  83        // Save first error but execute all entries
  84        if (!error) {
  85          error = e;
  86        }
  87      }
  88    }
  89  
  90    if (entry.length) {
  91      // Expose entry point to Node, AMD or browser globals
  92      // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
  93      var mainExports = newRequire(entry[entry.length - 1]);
  94  
  95      // CommonJS
  96      if (typeof exports === "object" && typeof module !== "undefined") {
  97        module.exports = mainExports;
  98  
  99      // RequireJS
 100      } else if (typeof define === "function" && define.amd) {
 101       define(function () {
 102         return mainExports;
 103       });
 104  
 105      // <script>
 106      } else if (globalName) {
 107        this[globalName] = mainExports;
 108      }
 109    }
 110  
 111    // Override the current require with this new one
 112    parcelRequire = newRequire;
 113  
 114    if (error) {
 115      // throw error from earlier, _after updating parcelRequire_
 116      throw error;
 117    }
 118  
 119    return newRequire;
 120  })({"AE3e":[function(require,module,exports) {
 121  "use strict";
 122  
 123  Object.defineProperty(exports, "__esModule", {
 124    value: true
 125  });
 126  exports.AVATAR_SIZES = void 0;
 127  
 128  /**
 129   * WordPress dependencies.
 130   */
 131  const {
 132    i18n: {
 133      __
 134    }
 135  } = wp;
 136  /**
 137   * Avatar sizes.
 138   *
 139   * @type {Array}
 140   */
 141  
 142  const AVATAR_SIZES = [{
 143    label: __('None', 'buddypress'),
 144    value: 'none'
 145  }, {
 146    label: __('Thumb', 'buddypress'),
 147    value: 'thumb'
 148  }, {
 149    label: __('Full', 'buddypress'),
 150    value: 'full'
 151  }];
 152  exports.AVATAR_SIZES = AVATAR_SIZES;
 153  },{}],"YNTp":[function(require,module,exports) {
 154  "use strict";
 155  
 156  Object.defineProperty(exports, "__esModule", {
 157    value: true
 158  });
 159  exports.default = void 0;
 160  
 161  var _constants = require("./constants");
 162  
 163  /**
 164   * WordPress dependencies.
 165   */
 166  const {
 167    blockEditor: {
 168      InspectorControls,
 169      BlockControls
 170    },
 171    components: {
 172      Placeholder,
 173      Disabled,
 174      PanelBody,
 175      SelectControl,
 176      ToggleControl,
 177      Toolbar,
 178      ToolbarButton
 179    },
 180    element: {
 181      Fragment,
 182      createElement
 183    },
 184    i18n: {
 185      __
 186    },
 187    serverSideRender: ServerSideRender
 188  } = wp;
 189  /**
 190   * BuddyPress dependencies.
 191   */
 192  
 193  const {
 194    blockComponents: {
 195      AutoCompleter
 196    },
 197    blockData: {
 198      isActive
 199    }
 200  } = bp;
 201  /**
 202   * Internal dependencies.
 203   */
 204  
 205  const getSlugValue = item => {
 206    if (item && item.mention_name) {
 207      return item.mention_name;
 208    }
 209  
 210    return null;
 211  };
 212  
 213  const editMemberBlock = ({
 214    attributes,
 215    setAttributes
 216  }) => {
 217    const isAvatarEnabled = isActive('members', 'avatar');
 218    const isMentionEnabled = isActive('activity', 'mentions');
 219    const isCoverImageEnabled = isActive('members', 'cover');
 220    const {
 221      avatarSize,
 222      displayMentionSlug,
 223      displayActionButton,
 224      displayCoverImage
 225    } = attributes;
 226  
 227    if (!attributes.itemID) {
 228      return createElement(Placeholder, {
 229        icon: "admin-users",
 230        label: __('BuddyPress Member', 'buddypress'),
 231        instructions: __('Start typing the name of the member you want to feature into this post.', 'buddypress')
 232      }, createElement(AutoCompleter, {
 233        component: "members",
 234        slugValue: getSlugValue,
 235        ariaLabel: __('Member\'s username', 'buddypress'),
 236        placeholder: __('Enter Member\'s username hereā€¦', 'buddypress'),
 237        onSelectItem: setAttributes,
 238        useAvatar: isAvatarEnabled
 239      }));
 240    }
 241  
 242    return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, {
 243      label: __('Block toolbar', 'buddypress')
 244    }, createElement(ToolbarButton, {
 245      icon: "edit",
 246      title: __('Select another member', 'buddypress'),
 247      onClick: () => {
 248        setAttributes({
 249          itemID: 0
 250        });
 251      }
 252    }))), createElement(InspectorControls, null, createElement(PanelBody, {
 253      title: __('Settings', 'buddypress'),
 254      initialOpen: true
 255    }, createElement(ToggleControl, {
 256      label: __('Display Profile button', 'buddypress'),
 257      checked: !!displayActionButton,
 258      onChange: () => {
 259        setAttributes({
 260          displayActionButton: !displayActionButton
 261        });
 262      },
 263      help: displayActionButton ? __('Include a link to the user\'s profile page under their display name.', 'buddypress') : __('Toggle to display a link to the user\'s profile page under their display name.', 'buddypress')
 264    }), isAvatarEnabled && createElement(SelectControl, {
 265      label: __('Avatar size', 'buddypress'),
 266      value: avatarSize,
 267      options: _constants.AVATAR_SIZES,
 268      help: __('Select "None" to disable the avatar.', 'buddypress'),
 269      onChange: option => {
 270        setAttributes({
 271          avatarSize: option
 272        });
 273      }
 274    }), isCoverImageEnabled && createElement(ToggleControl, {
 275      label: __('Display Cover Image', 'buddypress'),
 276      checked: !!displayCoverImage,
 277      onChange: () => {
 278        setAttributes({
 279          displayCoverImage: !displayCoverImage
 280        });
 281      },
 282      help: displayCoverImage ? __('Include the user\'s cover image over their display name.', 'buddypress') : __('Toggle to display the user\'s cover image over their display name.', 'buddypress')
 283    }), isMentionEnabled && createElement(ToggleControl, {
 284      label: __('Display Mention slug', 'buddypress'),
 285      checked: !!displayMentionSlug,
 286      onChange: () => {
 287        setAttributes({
 288          displayMentionSlug: !displayMentionSlug
 289        });
 290      },
 291      help: displayMentionSlug ? __('Include the user\'s mention name under their display name.', 'buddypress') : __('Toggle to display the user\'s mention name under their display name.', 'buddypress')
 292    }))), createElement(Disabled, null, createElement(ServerSideRender, {
 293      block: "bp/member",
 294      attributes: attributes
 295    })));
 296  };
 297  
 298  var _default = editMemberBlock;
 299  exports.default = _default;
 300  },{"./constants":"AE3e"}],"TmUL":[function(require,module,exports) {
 301  "use strict";
 302  
 303  var _edit = _interopRequireDefault(require("./member/edit"));
 304  
 305  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 306  
 307  /**
 308   * WordPress dependencies.
 309   */
 310  const {
 311    blocks: {
 312      registerBlockType
 313    },
 314    i18n: {
 315      __
 316    }
 317  } = wp;
 318  /**
 319   * Internal dependencies.
 320   */
 321  
 322  registerBlockType('bp/member', {
 323    title: __('Member', 'buddypress'),
 324    description: __('BuddyPress Member.', 'buddypress'),
 325    icon: {
 326      background: '#fff',
 327      foreground: '#d84800',
 328      src: 'admin-users'
 329    },
 330    category: 'buddypress',
 331    attributes: {
 332      itemID: {
 333        type: 'integer',
 334        default: 0
 335      },
 336      avatarSize: {
 337        type: 'string',
 338        default: 'full'
 339      },
 340      displayMentionSlug: {
 341        type: 'boolean',
 342        default: true
 343      },
 344      displayActionButton: {
 345        type: 'boolean',
 346        default: true
 347      },
 348      displayCoverImage: {
 349        type: 'boolean',
 350        default: true
 351      }
 352    },
 353    edit: _edit.default
 354  });
 355  },{"./member/edit":"YNTp"}]},{},["TmUL"], null)


Generated: Wed Jan 19 01:01:00 2022 Cross-referenced by PHPXref 0.7.1