![]() 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-form/js/editor/ |
Upload File : |
import BaseEditor from "../core/BaseEditor"; import FCore from "../core/FCore"; import '../../css/componentpropertieseditor.css'; import AttributeEditor from "./AttributeEditor"; import R from "../R"; import StyleEditor from "./StyleEditor"; import AllPropertyEditor from "./AllPropertyEditor"; import QuickMenu from "absol-acomp/js/QuickMenu"; import ResizeSystem from "absol/src/HTML5/ResizeSystem"; var _ = FCore._; var $ = FCore.$; function ComponentPropertiesEditor(editor) { BaseEditor.call(this); this.editor = editor; var self = this; var repeatEvents = { change: function (event) { self.emit('change', Object.assign({ componentPropertiesEditor: self }, event), self); }, stopchange: function (event) { self.emit('stopchange', Object.assign({ componentPropertiesEditor: self }, event), self); } }; this.attributeEditor = new AttributeEditor().on(repeatEvents) .on('stopchange', function (event) { self.allPropertyEditor.updatePropertyRecursive(event.name); }); this.styleEditor = new StyleEditor().on(repeatEvents) .on('stopchange', function (event) { self.allPropertyEditor.updatePropertyRecursive(event.name); }); this.allPropertyEditor = new AllPropertyEditor().on(repeatEvents) .on('stopchange', function (event) { self.attributeEditor.updatePropertyRecursive(event.name); self.styleEditor.updatePropertyRecursive(event.name); }); this.$dockElt = null; this.component = undefined; } Object.defineProperties(ComponentPropertiesEditor.prototype, Object.getOwnPropertyDescriptors(BaseEditor.prototype)); ComponentPropertiesEditor.prototype.constructor = ComponentPropertiesEditor; ComponentPropertiesEditor.prototype.CONFIG_STORE_KEY = "AS_ComponentPropertiesEditor_config"; ComponentPropertiesEditor.prototype.config = {}; ComponentPropertiesEditor.prototype.getView = function () { if (this.$view) return this.$view; var thisEditor = this; this.$attachhook = _('attachhook'); this.$view = _({ tag: 'tabview', class: ["as-form-component-properties-editor", 'xp-tiny'], child: [ { tag: 'tabframe', class: 'absol-bscroller', attr: { name: 'Attribute' }, child: this.attributeEditor.getView() }, { tag: 'tabframe', attr: { name: 'Style' }, child: this.styleEditor.getView() }, { tag: 'tabframe', class: 'absol-bscroller', attr: { name: 'All' }, child: this.allPropertyEditor.getView() } ] }); this.$view.appendChild(this.$attachhook); this.$attachhook.requestUpdateSize = this.updateSize.bind(this); ResizeSystem.add(this.$attachhook); this.$quickmenuBtn = _({ tag: 'button', class: ['as-form-component-properties-editor-quickmenu-button', 'as-from-tool-button'], child: 'span.mdi.mdi-dots-horizontal' }); QuickMenu.toggleWhenClick(this.$quickmenuBtn, { getMenuProps: function () { return { extendStyle: { 'font-size': '12px' }, items: [ { text: 'Undock', icon: 'span.mdi.mdi-dock-window', cmd: 'undock' }, { text: 'Help', icon: 'span.mdi.mdi-help' } ] } }, onSelect: function (item) { switch (item.cmd) { case 'undock': thisEditor.undock(); break; } } }); this.$view.appendChild(this.$quickmenuBtn); return this.$view; }; ComponentPropertiesEditor.prototype.onAttached = function () { this.setContext(R.ATTRIBUTE_EDITOR, this.attributeEditor); this.setContext(R.STYLE_EDITOR, this.styleEditor); this.setContext(R.ALL_PROPERTY_EDITOR, this.allPropertyEditor); this.attributeEditor.attach(this); this.styleEditor.attach(this); this.allPropertyEditor.attach(this); }; ComponentPropertiesEditor.prototype.onStart = function () { this.getView(); this.attributeEditor.start(); this.styleEditor.start(); this.allPropertyEditor.start(); }; ComponentPropertiesEditor.prototype.onDestroy = function () { this.attributeEditor.destroy(); this.styleEditor.destroy(); this.allPropertyEditor.destroy(); }; ComponentPropertiesEditor.prototype.onPause = function () { this.attributeEditor.pause(); this.styleEditor.pause(); this.allPropertyEditor.pause(); }; ComponentPropertiesEditor.prototype.onResume = function () { this.attributeEditor.resume(); this.styleEditor.resume(); this.allPropertyEditor.resume(); }; ComponentPropertiesEditor.prototype.edit = function () { this.component = arguments[0]; this.components = Array.prototype.slice.call(arguments); this.styleEditor.edit.apply(this.styleEditor, arguments); this.attributeEditor.edit.apply(this.attributeEditor, arguments); this.allPropertyEditor.edit.apply(this.allPropertyEditor, arguments); }; ComponentPropertiesEditor.prototype.updateSize = function () { var ateB = this.attributeEditor.getBound(); var steB = this.styleEditor.getBound(); var aleB = this.allPropertyEditor.getBound(); var width = Math.max(ateB.width, steB.width, aleB.width); var height = Math.max(ateB.height, steB.height, aleB.height); if (width > 0 && height > 0) { this.$view.addStyle('min-width', Math.max(200, width) + 'px') .addStyle('height', height + 'px'); } this.$view.addStyle('max-height', '100%'); }; export default ComponentPropertiesEditor;