mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Fixed errors VC
This commit is contained in:
parent
b2f356bd4b
commit
a557c25c31
@ -128,9 +128,8 @@ function createVisualConsole(
|
|||||||
|
|
||||||
if (meta.editMode) {
|
if (meta.editMode) {
|
||||||
// Item selection.
|
// Item selection.
|
||||||
/*
|
|
||||||
if (meta.isSelected) {
|
if (meta.isSelected) {
|
||||||
visualConsole.unselectItem(data.id);
|
visualConsole.unSelectItem(data.id);
|
||||||
} else {
|
} else {
|
||||||
// Unselect the rest of the elements if the
|
// Unselect the rest of the elements if the
|
||||||
var isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
var isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
||||||
@ -139,7 +138,6 @@ function createVisualConsole(
|
|||||||
isMac ? !e.nativeEvent.metaKey : !e.nativeEvent.ctrlKey
|
isMac ? !e.nativeEvent.metaKey : !e.nativeEvent.ctrlKey
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
} else if (
|
} else if (
|
||||||
!meta.editMode &&
|
!meta.editMode &&
|
||||||
data.linkedLayoutId != null &&
|
data.linkedLayoutId != null &&
|
||||||
|
@ -27,6 +27,29 @@ final class BarsGraph extends Item
|
|||||||
protected static $useHtmlOutput = true;
|
protected static $useHtmlOutput = true;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a type graph value.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return string One of 'vertical' or 'horizontal'. 'vertical' by default.
|
||||||
|
*/
|
||||||
|
private static function getTypeGraph(array $data)
|
||||||
|
{
|
||||||
|
return static::notEmptyStringOr(
|
||||||
|
static::issetInArray(
|
||||||
|
$data,
|
||||||
|
[
|
||||||
|
'typeGraph',
|
||||||
|
'type_graph',
|
||||||
|
'graphType',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a valid representation of a record in database.
|
* Return a valid representation of a record in database.
|
||||||
*
|
*
|
||||||
@ -40,11 +63,6 @@ final class BarsGraph extends Item
|
|||||||
{
|
{
|
||||||
$return = parent::encode($data);
|
$return = parent::encode($data);
|
||||||
|
|
||||||
$id_custom_graph = static::extractIdCustomGraph($data);
|
|
||||||
if ($id_custom_graph !== null) {
|
|
||||||
$return['id_custom_graph'] = $id_custom_graph;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type_graph = static::getTypeGraph($data);
|
$type_graph = static::getTypeGraph($data);
|
||||||
if ($type_graph !== null) {
|
if ($type_graph !== null) {
|
||||||
$return['type_graph'] = $type_graph;
|
$return['type_graph'] = $type_graph;
|
||||||
|
@ -61,6 +61,11 @@ final class ModuleGraph extends Item
|
|||||||
{
|
{
|
||||||
$return = parent::encode($data);
|
$return = parent::encode($data);
|
||||||
|
|
||||||
|
$id_custom_graph = static::extractIdCustomGraph($data);
|
||||||
|
if ($id_custom_graph !== null) {
|
||||||
|
$return['id_custom_graph'] = $id_custom_graph;
|
||||||
|
}
|
||||||
|
|
||||||
$type_graph = static::getTypeGraph($data);
|
$type_graph = static::getTypeGraph($data);
|
||||||
if ($type_graph !== null) {
|
if ($type_graph !== null) {
|
||||||
$return['type_graph'] = $type_graph;
|
$return['type_graph'] = $type_graph;
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -338,7 +338,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
// This function will only run the 2nd arg function after the time
|
// This function will only run the 2nd arg function after the time
|
||||||
// of the first arg have passed after its last execution.
|
// of the first arg have passed after its last execution.
|
||||||
private debouncedResizementSave = debounce(
|
private debouncedResizementSave = debounce(
|
||||||
500, // ms.
|
300, // ms.
|
||||||
(width: Size["width"], height: Size["height"]) => {
|
(width: Size["width"], height: Size["height"]) => {
|
||||||
// Update the metadata information.
|
// Update the metadata information.
|
||||||
// Don't use the .meta property cause we don't need DOM updates.
|
// Don't use the .meta property cause we don't need DOM updates.
|
||||||
@ -517,11 +517,6 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.meta.isBeingMoved && !this.meta.isBeingResized) {
|
if (!this.meta.isBeingMoved && !this.meta.isBeingResized) {
|
||||||
if (this.meta.isSelected === false) {
|
|
||||||
this.selectItem();
|
|
||||||
} else {
|
|
||||||
this.unSelectItem();
|
|
||||||
}
|
|
||||||
this.clickEventManager.emit({
|
this.clickEventManager.emit({
|
||||||
item: this,
|
item: this,
|
||||||
nativeEvent: e
|
nativeEvent: e
|
||||||
|
@ -905,6 +905,41 @@ export default class VisualConsole {
|
|||||||
this.containerRef.classList.remove("is-editing");
|
this.containerRef.classList.remove("is-editing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select an item.
|
||||||
|
* @param itemId Item Id.
|
||||||
|
* @param unique To remove the selection of other items or not.
|
||||||
|
*/
|
||||||
|
public selectItem(itemId: number, unique: boolean = false): void {
|
||||||
|
if (unique) {
|
||||||
|
this.elementIds.forEach(currentItemId => {
|
||||||
|
const meta = this.elementsById[currentItemId].meta;
|
||||||
|
|
||||||
|
if (currentItemId !== itemId && meta.isSelected) {
|
||||||
|
this.elementsById[currentItemId].unSelectItem();
|
||||||
|
} else if (currentItemId === itemId && !meta.isSelected) {
|
||||||
|
this.elementsById[currentItemId].selectItem();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (this.elementsById[itemId]) {
|
||||||
|
this.elementsById[itemId].selectItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unselect an item.
|
||||||
|
* @param itemId Item Id.
|
||||||
|
*/
|
||||||
|
public unSelectItem(itemId: number): void {
|
||||||
|
if (this.elementsById[itemId]) {
|
||||||
|
const meta = this.elementsById[itemId].meta;
|
||||||
|
|
||||||
|
if (meta.isSelected) {
|
||||||
|
this.elementsById[itemId].unSelectItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unselect all items.
|
* Unselect all items.
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
t
|
t
|
||||||
} from "../../lib";
|
} from "../../lib";
|
||||||
import Item, { ItemProps, itemBasePropsDecoder, ItemType } from "../../Item";
|
import Item, { ItemProps, itemBasePropsDecoder, ItemType } from "../../Item";
|
||||||
import { InputGroup, FormContainer } from "../../Form";
|
|
||||||
|
|
||||||
export type ClockProps = {
|
export type ClockProps = {
|
||||||
type: ItemType.CLOCK;
|
type: ItemType.CLOCK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user