Liferay.Loader.define("data-engine-taglib@2.5.18/data_layout_builder/js/actions.es", ['module', 'exports', 'require', './utils/dataDefinition.es', './utils/dataLayoutVisitor.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.dropFieldSet = exports.dropLayoutBuilderField = exports.dropCustomObjectField = exports.UPDATE_PAGES = exports.UPDATE_IDS = exports.UPDATE_HOVERED_FIELD = exports.UPDATE_FOCUSED_FIELD = exports.UPDATE_FIELD_TYPES = exports.UPDATE_EDITING_LANGUAGE_ID = exports.UPDATE_EDITING_DATA_DEFINITION_ID = exports.UPDATE_DATA_LAYOUT_RULE = exports.UPDATE_DATA_LAYOUT_NAME = exports.UPDATE_DATA_LAYOUT = exports.UPDATE_DATA_DEFINITION = exports.UPDATE_FOCUSED_CUSTOM_OBJECT_FIELD = exports.UPDATE_FIELDSETS = exports.UPDATE_CONFIG = exports.UPDATE_APP_PROPS = exports.SWITCH_SIDEBAR_PANEL = exports.EVALUATION_ERROR = exports.EDIT_CUSTOM_OBJECT_FIELD = exports.DELETE_DATA_LAYOUT_RULE = exports.DELETE_DATA_LAYOUT_FIELD = exports.DELETE_DATA_DEFINITION_FIELD = exports.ADD_DATA_LAYOUT_RULE = exports.ADD_CUSTOM_OBJECT_FIELD = void 0;

    var _dataDefinition = require("./utils/dataDefinition.es");

    var _dataLayoutVisitor = require("./utils/dataLayoutVisitor.es");

    function _objectWithoutProperties(source, excluded) {
      if (source == null) return {};var target = _objectWithoutPropertiesLoose(source, excluded);var key, i;if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);for (i = 0; i < sourceSymbolKeys.length; i++) {
          key = sourceSymbolKeys[i];if (excluded.indexOf(key) >= 0) continue;if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;target[key] = source[key];
        }
      }return target;
    }

    function _objectWithoutPropertiesLoose(source, excluded) {
      if (source == null) return {};var target = {};var sourceKeys = Object.keys(source);var key, i;for (i = 0; i < sourceKeys.length; i++) {
        key = sourceKeys[i];if (excluded.indexOf(key) >= 0) continue;target[key] = source[key];
      }return target;
    }

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var ADD_CUSTOM_OBJECT_FIELD = 'ADD_CUSTOM_OBJECT_FIELD';
    exports.ADD_CUSTOM_OBJECT_FIELD = ADD_CUSTOM_OBJECT_FIELD;
    var ADD_DATA_LAYOUT_RULE = 'ADD_DATA_LAYOUT_RULE';
    exports.ADD_DATA_LAYOUT_RULE = ADD_DATA_LAYOUT_RULE;
    var DELETE_DATA_DEFINITION_FIELD = 'DELETE_DATA_DEFINITION_FIELD';
    exports.DELETE_DATA_DEFINITION_FIELD = DELETE_DATA_DEFINITION_FIELD;
    var DELETE_DATA_LAYOUT_FIELD = 'DELETE_DATA_LAYOUT_FIELD';
    exports.DELETE_DATA_LAYOUT_FIELD = DELETE_DATA_LAYOUT_FIELD;
    var DELETE_DATA_LAYOUT_RULE = 'DELETE_DATA_LAYOUT_RULE';
    exports.DELETE_DATA_LAYOUT_RULE = DELETE_DATA_LAYOUT_RULE;
    var EDIT_CUSTOM_OBJECT_FIELD = 'EDIT_CUSTOM_OBJECT_FIELD';
    exports.EDIT_CUSTOM_OBJECT_FIELD = EDIT_CUSTOM_OBJECT_FIELD;
    var EVALUATION_ERROR = 'EVALUATION_ERROR';
    exports.EVALUATION_ERROR = EVALUATION_ERROR;
    var SWITCH_SIDEBAR_PANEL = 'SWITCH_SIDEBAR_PANEL';
    exports.SWITCH_SIDEBAR_PANEL = SWITCH_SIDEBAR_PANEL;
    var UPDATE_APP_PROPS = 'UPDATE_APP_PROPS';
    exports.UPDATE_APP_PROPS = UPDATE_APP_PROPS;
    var UPDATE_CONFIG = 'UPDATE_CONFIG';
    exports.UPDATE_CONFIG = UPDATE_CONFIG;
    var UPDATE_FIELDSETS = 'UPDATE_FIELDSETS';
    exports.UPDATE_FIELDSETS = UPDATE_FIELDSETS;
    var UPDATE_FOCUSED_CUSTOM_OBJECT_FIELD = 'UPDATE_FOCUSED_CUSTOM_OBJECT_FIELD';
    exports.UPDATE_FOCUSED_CUSTOM_OBJECT_FIELD = UPDATE_FOCUSED_CUSTOM_OBJECT_FIELD;
    var UPDATE_DATA_DEFINITION = 'UPDATE_DATA_DEFINITION';
    exports.UPDATE_DATA_DEFINITION = UPDATE_DATA_DEFINITION;
    var UPDATE_DATA_LAYOUT = 'UPDATE_DATA_LAYOUT';
    exports.UPDATE_DATA_LAYOUT = UPDATE_DATA_LAYOUT;
    var UPDATE_DATA_LAYOUT_NAME = 'UPDATE_DATA_LAYOUT_NAME';
    exports.UPDATE_DATA_LAYOUT_NAME = UPDATE_DATA_LAYOUT_NAME;
    var UPDATE_DATA_LAYOUT_RULE = 'UPDATE_DATA_LAYOUT_RULE';
    exports.UPDATE_DATA_LAYOUT_RULE = UPDATE_DATA_LAYOUT_RULE;
    var UPDATE_EDITING_DATA_DEFINITION_ID = 'UPDATE_EDITING_DATA_DEFINITION_ID';
    exports.UPDATE_EDITING_DATA_DEFINITION_ID = UPDATE_EDITING_DATA_DEFINITION_ID;
    var UPDATE_EDITING_LANGUAGE_ID = 'UPDATE_EDITING_LANGUAGE_ID';
    exports.UPDATE_EDITING_LANGUAGE_ID = UPDATE_EDITING_LANGUAGE_ID;
    var UPDATE_FIELD_TYPES = 'UPDATE_FIELD_TYPES';
    exports.UPDATE_FIELD_TYPES = UPDATE_FIELD_TYPES;
    var UPDATE_FOCUSED_FIELD = 'UPDATE_FOCUSED_FIELD';
    exports.UPDATE_FOCUSED_FIELD = UPDATE_FOCUSED_FIELD;
    var UPDATE_HOVERED_FIELD = 'UPDATE_HOVERED_FIELD';
    exports.UPDATE_HOVERED_FIELD = UPDATE_HOVERED_FIELD;
    var UPDATE_IDS = 'UPDATE_IDS';
    exports.UPDATE_IDS = UPDATE_IDS;
    var UPDATE_PAGES = 'UPDATE_PAGES';
    exports.UPDATE_PAGES = UPDATE_PAGES;

    var dropCustomObjectField = function dropCustomObjectField(_ref) {
      var dataDefinition = _ref.dataDefinition,
          dataDefinitionFieldName = _ref.dataDefinitionFieldName,
          dataLayoutBuilder = _ref.dataLayoutBuilder,
          fieldName = _ref.fieldName,
          indexes = _ref.indexes,
          parentFieldName = _ref.parentFieldName;
      var dataDefinitionField = (0, _dataDefinition.getDataDefinitionField)(dataDefinition, dataDefinitionFieldName);
      var settingsContext = dataLayoutBuilder.getDDMFormFieldSettingsContext(dataDefinitionField);
      var label = dataDefinitionField.label;

      var _dataLayoutBuilder$ge = dataLayoutBuilder.getState(),
          editingLanguageId = _dataLayoutBuilder$ge.editingLanguageId;

      return {
        data: {
          fieldName: fieldName,
          parentFieldName: parentFieldName
        },
        fieldType: _objectSpread({}, dataLayoutBuilder.getFieldTypes().find(function (_ref2) {
          var name = _ref2.name;
          return name === dataDefinitionField.fieldType;
        }), {
          editable: true,
          label: label[editingLanguageId] || label[themeDisplay.getLanguageId()],
          settingsContext: settingsContext
        }),
        indexes: indexes,
        skipFieldNameGeneration: true
      };
    };

    exports.dropCustomObjectField = dropCustomObjectField;

    var dropLayoutBuilderField = function dropLayoutBuilderField(_ref3) {
      var dataLayoutBuilder = _ref3.dataLayoutBuilder,
          fieldName = _ref3.fieldName,
          fieldTypeName = _ref3.fieldTypeName,
          indexes = _ref3.indexes,
          parentFieldName = _ref3.parentFieldName;
      return {
        data: {
          fieldName: fieldName,
          parentFieldName: parentFieldName
        },
        fieldType: _objectSpread({}, dataLayoutBuilder.getFieldTypes().find(function (_ref4) {
          var name = _ref4.name;
          return name === fieldTypeName;
        }), {
          editable: true
        }),
        indexes: indexes
      };
    };

    exports.dropLayoutBuilderField = dropLayoutBuilderField;

    var dropFieldSet = function dropFieldSet(_ref5) {
      var dataLayoutBuilder = _ref5.dataLayoutBuilder,
          fieldName = _ref5.fieldName,
          fieldSet = _ref5.fieldSet,
          indexes = _ref5.indexes,
          parentFieldName = _ref5.parentFieldName,
          useFieldName = _ref5.useFieldName,
          otherProps = _objectWithoutProperties(_ref5, ["dataLayoutBuilder", "fieldName", "fieldSet", "indexes", "parentFieldName", "useFieldName"]);

      var dataLayoutPages = (fieldSet.defaultDataLayout || dataLayoutBuilder.getDefaultDataLayout(fieldSet)).dataLayoutPages;
      return _objectSpread({}, otherProps, {
        defaultLanguageId: fieldSet.defaultLanguageId,
        fieldName: fieldName,
        fieldSet: dataLayoutBuilder.getDDMForm(fieldSet),
        indexes: indexes,
        parentFieldName: parentFieldName,
        useFieldName: useFieldName
      }, fieldSet.id && {
        rows: (0, _dataLayoutVisitor.normalizeDataLayoutRows)(dataLayoutPages)
      });
    };

    exports.dropFieldSet = dropFieldSet;
    //# sourceMappingURL=actions.es.js.map
  }
});
//# sourceMappingURL=actions.es.js.map