VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-form__js__fdeditor__FDEditorCmd.js
/*** module: node_modules/absol-form/js/fdeditor/FDEditorCmd.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FDEditorCmdDescriptors = exports.default = void 0;

var _CmdDescriptors = _interopRequireDefault(require("../cmds/CmdDescriptors"));

var _R = _interopRequireDefault(require("../R"));

var _LEPageSettingDialog = require("../layouteditor/dialog/LEPageSettingDialog");


var FDEditorCmd = {};
/**
 * @this FDEditor
 */

FDEditorCmd.flushToLayoutEditor = function () {
  if (this.error) return;
  var layoutEditor = this.getContext(_R.default.LAYOUT_EDITOR);
  var data = this.getData();

  if (layoutEditor) {
    layoutEditor.setData(data);
  }
};
/**
 * @this FDEditor
 */


FDEditorCmd.preview = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('preview');
};
/**
 * @this FDEditor
 */


FDEditorCmd.save = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('save');
};
/**
 * @this FDEditor
 */


FDEditorCmd.saveAs = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('saveAs');
};
/**
 * @this FDEditor
 */


FDEditorCmd.saveAsSystem = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('saveAsSystem');
};
/**
 * @this FDEditor
 */


FDEditorCmd.importFromJson = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('importFromJson');
};
/**
 * @this FDEditor
 */


FDEditorCmd.export2Json = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('export2Json');
};
/**
 * @this FDEditor
 */


FDEditorCmd.export2sharpEncode = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('export2sharpEncode');
};
/**
 * @this FDEditor
 */


FDEditorCmd.export2clipboard = function () {
  this.execCmd('flushToLayoutEditor');
  this.flexFormEditor.execCmd('export2clipboard');
};
/**
 * @this FDEditor
 */


FDEditorCmd.pageSetting = function () {
  (0, _LEPageSettingDialog.openPageSettingDialog)().then(result => {
    console.log(result); // if (!result || !this.rootLayout) return;
    // this.rootLayout.style.width = result[0];
    // this.rootLayout.style.height = 'auto';
    // if (this.rootLayout.tag === 'LinearLayout') {
    //     this.rootLayout.style.paddingLeft = result[2];
    //     this.rootLayout.style.paddingRight = result[2];
    //     this.rootLayout.style.paddingTop = result[3];
    //     this.rootLayout.style.paddingBottom = result[3];
    // }
  });
};
/**
 * @this FDEditor
 */


FDEditorCmd.formatTextAlignLeft = function () {
  var range = this.selection.range;
  if (!range) return;
  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.fontStyle) return;

    if (comp.tag === 'HyperLayout' && comp.parent === this.rootLayout) {
      comp.style.contentAlign = 'left';
    } else if (comp.isText && comp.parent && comp.parent.tag === 'HyperLayout' && comp.parent !== this.rootLayout) {
      comp.parent.style.contentAlign = 'left';
    }
  });
  this.notifyCmdDescriptorsChange();
};

FDEditorCmd.formatTextAlignCenter = function () {
  var range = this.selection.range;
  if (!range) return;
  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.fontStyle) return;

    if (comp.tag === 'HyperLayout' && comp.parent === this.rootLayout) {
      comp.style.contentAlign = 'center';
    } else if (comp.isText && comp.parent && comp.parent.tag === 'HyperLayout' && comp.parent !== this.rootLayout) {
      comp.parent.style.contentAlign = 'center';
    }
  });
  this.notifyCmdDescriptorsChange();
};

FDEditorCmd.formatTextAlignRight = function () {
  var range = this.selection.range;
  if (!range) return;
  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.fontStyle) return;

    if (comp.tag === 'HyperLayout' && comp.parent === this.rootLayout) {
      comp.style.contentAlign = 'right';
    } else if (comp.isText && comp.parent && comp.parent.tag === 'HyperLayout' && comp.parent !== this.rootLayout) {
      comp.parent.style.contentAlign = 'right';
    }
  });
  this.notifyCmdDescriptorsChange();
};
/**
 * @this FDEditor
 */


FDEditorCmd.formatTextItalic = function (flag) {
  var range = this.selection.range;
  if (!range) return; //todo: separate text segment

  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.fontStyle) return;
    var value = comp.style.fontStyle || 'Regular';

    if (flag) {
      if (value === 'Bold') {
        value = 'Bold italic';
      } else value = 'Italic';
    } else {
      if (value === 'Bold Italic') value = 'Bold';else value = 'Regular';
    }

    comp.style.fontStyle = value;
  });
};

FDEditorCmd.formatTextBold = function (flag) {
  var range = this.selection.range;
  if (!range) return; //todo: separate text segment

  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.fontStyle) return;
    var value = comp.style.fontStyle || 'Regular';

    if (flag) {
      if (value === 'Italic') {
        value = 'Bold italic';
      } else value = 'Bold';
    } else {
      if (value === 'Bold Italic') value = 'Italic';else value = 'Regular';
    }

    comp.style.fontStyle = value;
  });
};
/**
 * @this FDEditor
 */


FDEditorCmd.formatTextUnderline = function (flag) {
  var range = this.selection.range;
  if (!range) return; //todo: separate text segment

  range.leafComponents.forEach(comp => {
    if (!comp.styleHandlers.textDecoration) return;
    if (flag) comp.style.textDecoration = 'underline';else comp.style.textDecoration = '';
  });
};

var _default = FDEditorCmd;
exports.default = _default;
var FDEditorCmdDescriptors = {};
/**
 * @this FDEditor
 */

exports.FDEditorCmdDescriptors = FDEditorCmdDescriptors;

FDEditorCmdDescriptors.formatTextItalic = function () {
  var res = {};
  res.checked = this.selection.range && this.selection.range.leafComponents.length > 0 && this.selection.range.leafComponents.every(comp => {
    var value = comp.style.fontStyle;
    if (value && value.toLowerCase().indexOf('italic') >= 0) return true;
    return false;
  });
  return res;
};
/**
 * @this FDEditor
 */


FDEditorCmdDescriptors.formatTextBold = function () {
  var res = {};
  res.checked = this.selection.range && this.selection.range.leafComponents.length > 0 && this.selection.range.leafComponents.every(comp => {
    var value = comp.style.fontStyle;
    if (value && value.toLowerCase().indexOf('bold') >= 0) return true;
    return false;
  });
  return res;
};
/**
 * @this FDEditor
 */


FDEditorCmdDescriptors.formatTextUnderline = function () {
  var res = {};
  res.checked = this.selection.range && this.selection.range.leafComponents.length > 0 && this.selection.range.leafComponents.every(comp => {
    var value = comp.style.textDecoration;
    if (value && value.toLowerCase().indexOf('underline') >= 0) return true;
    return false;
  });
  return res;
};

VaKeR 2022