Skip to content

Commit

Permalink
Merge branch 'dev-2311' into components
Browse files Browse the repository at this point in the history
  • Loading branch information
PTKu authored Feb 20, 2024
2 parents e7fee1a + abd13a2 commit 6b2bd93
Show file tree
Hide file tree
Showing 129 changed files with 3,541 additions and 1,363 deletions.
8 changes: 8 additions & 0 deletions src/base/src/AXOpen.Base.Abstractions/Dialogs/IAlert.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


namespace AXOpen.Base.Dialogs
{
public interface IAlert: IDialog
{
}
}

This file was deleted.

16 changes: 16 additions & 0 deletions src/base/src/AXOpen.Base.Abstractions/Dialogs/IAlertService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;


namespace AXOpen.Base.Dialogs
{
public interface IAlertService
{
public event EventHandler? AlertDialogChanged;
public void AddAlertDialog(eAlertType type, string title, string message, int time);
public void AddAlertDialog(IAlertToast toast);
public List<IAlertToast> GetAlertDialogs();
public void RemoveAlertDialog(IAlertToast toast);
public void RemoveAllAlertDialogs();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace AXOpen.Base.Dialogs
{
public interface IAlertDialog
public interface IAlertToast
{
public Guid Id { get; set; }
public eAlertDialogType Type { get; set; }
public eAlertType Type { get; set; }
public string Title { get; set; }
public string Message { get; set; }
public DateTimeOffset TimeToBurn { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
namespace AXOpen.Base.Dialogs
{

public interface IsDialogType : ITwinObject
public interface IDialog : ITwinObject
{
/// <summary>
/// Gets or sets dialog locator id.
/// </summary>
string DialogId { get; set; }
string DialogLocatorId { get; set; }

/// <summary>
/// Initialized remote task for this dialog, with polling instead of cyclic subscription.
Expand Down
7 changes: 7 additions & 0 deletions src/base/src/AXOpen.Base.Abstractions/Dialogs/IModalDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

namespace AXOpen.Base.Dialogs
{
public interface IModalDialog : IDialog
{
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace AXOpen.Base.Dialogs
{
public enum eAlertDialogType
public enum eAlertType
{
Undefined = 0,
Info = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ private List<ITwinElement> RetrieveKids(ITwinObject parent)
{
List<ITwinElement> kids = new List<ITwinElement>();
kids.Add(parent);

foreach (var kid in parent.GetKids())
{
if (kid is ITwinObject tobj)
{
kids.Add(tobj);
kids.AddRange(RetrieveKids(tobj));
}
if (kid is ITwinPrimitive prim)
Expand Down Expand Up @@ -134,6 +134,9 @@ public void RemoveChildren(VisualComposerItemData item)

public void CreateNew(string fileName)
{
if(fileName == "" || fileName == null)
return;

CurrentView = fileName;

if (!Directory.Exists("VisualComposerSerialize/" + Id.CorrectFilePath()))
Expand All @@ -148,6 +151,9 @@ public void CreateNew(string fileName)

public void CreateCopy(string fileName)
{
if (fileName == "" || fileName == null)
return;

CurrentView = fileName;

if (!Directory.Exists("VisualComposerSerialize/" + Id.CorrectFilePath()))
Expand Down
26 changes: 12 additions & 14 deletions src/base/src/AXOpen.VisualComposer/VisualComposerItem.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
};

export function getElementSize(id) {
const element = document.getElementById(id);
const element = document.getElementById(id).parentElement;

if (element) {

Expand All @@ -19,15 +19,12 @@ export function getElementSize(id) {
else {
var computedStyle = window.getComputedStyle(element);

var width = parseFloat(computedStyle.width);
var height = parseFloat(computedStyle.height);

return {
width: width,
height: height
width: parseFloat(computedStyle.width),
height: parseFloat(computedStyle.height)
};
}

} else {
return null;
}
Expand All @@ -37,17 +34,16 @@ export function dragElement(id, dotNetInstance, left, top, backgroundId, scale)
var elmnt = document.getElementById(id);

if (elmnt != null) {
var backgroundSize = getElementSize(backgroundId);

elmnt.onmousedown = function (e) {
dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundSize, scale);
dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundId, scale);
};

updateTransform(elmnt, left, top, dotNetInstance);
}
}

function dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundSize, scale) {
function dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundId, scale) {
console.log("call");
e = e || window.event;
e.preventDefault();

Expand All @@ -56,14 +52,16 @@ function dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundSize, scal

document.onmouseup = closeDragElement;
document.onmousemove = function (event) {
elementDrag(event, elmnt, left, top, startX, startY, dotNetInstance, backgroundSize, scale);
elementDrag(event, elmnt, left, top, startX, startY, dotNetInstance, backgroundId, scale);
};
}

function elementDrag(e, elmnt, left, top, startX, startY, dotNetInstance, backgroundSize, scale) {
function elementDrag(e, elmnt, left, top, startX, startY, dotNetInstance, backgroundId, scale) {
e = e || window.event;
e.preventDefault();

var backgroundSize = getElementSize(backgroundId);

if (backgroundSize != null && backgroundSize.width != 0 && backgroundSize.height != 0) {
var offsetX = ((startX - e.clientX) / backgroundSize.width * 100) * (1 / scale);
var offsetY = ((startY - e.clientY) / backgroundSize.height * 100) * (1 / scale);
Expand All @@ -73,7 +71,7 @@ function elementDrag(e, elmnt, left, top, startX, startY, dotNetInstance, backgr
}

elmnt.onmousedown = function (e) {
dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundSize, scale);
dragMouseDown(e, elmnt, left, top, dotNetInstance, backgroundId, scale);
};

updateTransform(elmnt, left, top, dotNetInstance);
Expand Down
15 changes: 15 additions & 0 deletions src/core/app/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug live on PLC",
"type": "plc-debug",
"request": "launch",
"program": "${workspaceFolder}",
"ip": "10.10.10.115"
}
]
}
8 changes: 8 additions & 0 deletions src/core/app/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,13 @@ scripts:
r:
- apax plc-mode set stop -t $AXTARGET -y
- apax plc-mode set run -t $AXTARGET -y

delta:
- START=$(date +%s)
- apax build --ignore-scripts
- apax sld load --accept-security-disclaimer -t $AXTARGET -i
$AXTARGETPLATFORMINPUT --mode delta
- echo "Downloaded in :" $(expr $(date +%s) - $START) "s"

installStrategy: strict
apaxVersion: 3.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@namespace axopencore
@using AXOpen.Core;
@using AXSharp.Connector;
@using Microsoft.AspNetCore.Components.Authorization
@inherits RenderableComplexComponentBase<AxoDialogExamples.AxoDialogTest>
@implements IDisposable;

<div class="border border-2 m-1 rounded">
<h5>@Component.Symbol</h5>

<div style="display: flex; justify-content: space-between;">
<div style="flex: 1;">
<RenderableContentControl Context="@Component._restoreDialog" Presentation="Control" />
</div>

<div style="flex: 1;">
<RenderableContentControl Context="@Component._callDialog" Presentation="Control" />
</div>

<div style="flex: 1;">
<RenderableContentControl Context="@Component._callDialogInSequnce" Presentation="Control" />
<RenderableContentControl Context="@Component._iterationStep" Presentation="Control" />
</div>

<div style="flex: 1;">
<RenderableContentControl Context="@Component._alertInSequnce" Presentation="Control" />
<RenderableContentControl Context="@Component._alertIterationStep" Presentation="Control" />
</div>
</div>
</div>

<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h3 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Dialog Section
</button>
</h3>
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="border border-2 m-1 rounded">
<RenderableContentControl Context="@Component._dialog" Presentation="Control" />
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Alert Dialog Section
</button>
</h3>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="border border-2 m-1 rounded">
<RenderableContentControl Context="@Component._alertDialog" Presentation="Control" />
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@namespace axopencore
@using AXOpen.Core;
@using AXSharp.Connector;
@using Microsoft.AspNetCore.Components.Authorization
@inherits RenderableComplexComponentBase<AxoDialogExamples.Dialogs>
@implements IDisposable;

<div class="border border-1 rounded m-0">
<h4>@Component.Symbol</h4>

<div class="border border-2 m-1 rounded">
<div style="display: flex; justify-content: space-between;">
<div style="flex: 1;">
<RenderableContentControl Context="@Component._invokeRestoreAll" Presentation="Control" />
</div>

<div style="flex: 1;">
<RenderableContentControl Context="@Component._invokeCallAll" Presentation="Control" />
</div>

<div style="flex: 1;">
<RenderableContentControl Context="@Component._invokeSequnceAll" Presentation="Control" />
</div>
</div>
</div>

<div class="border border-2 m-1 rounded border-warning">
<div style="display: flex; justify-content: space-between;">
<div style="flex: 1;">
<axopencore.AxoDialogTestView Component="@Component.AA" />
</div>

<div style="flex: 1;">
<axopencore.AxoDialogTestView Component="@Component.BB" />
</div>
</div>
</div>

</div>


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/DialogExamplesControl"
@using axopencore
@using AXOpen.Core
@using AXOpen.Core.Blazor.AxoDialogs

<axopencore.AxoDialogsView Component="@Entry.Plc.D_111" />

<axopencore.AxoDialogsView Component="@Entry.Plc.D_222" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page "/DialogExamplesHandling_1"
@using axopencore
@using AXOpen.Core
@using AXOpen.Core.Blazor.AxoDialogs

<h3>Dialog Examples Handling</h3>

<AxoDialogLocator LocatorPath="dialog1" ObservedObjects="new[] {Entry.Plc.D_111}"></AxoDialogLocator>

<AXOpen.Core.Blazor.Dialogs.AxoAlertLocator ObservedObjects="new [] {Entry.Plc.D_111}"></AXOpen.Core.Blazor.Dialogs.AxoAlertLocator>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page "/DialogExamplesHandling_2"
@using axopencore
@using AXOpen.Core
@using AXOpen.Core.Blazor.AxoDialogs

<h3>Dialog Examples Handling 1 and 2</h3>

<AxoDialogLocator LocatorPath="dialog2" DisplayInModalWindow="false" ObservedObjects="new [] { Entry.Plc.D_222, Entry.Plc.D_111}"></AxoDialogLocator>

<AXOpen.Core.Blazor.Dialogs.AxoAlertLocator ObservedObjects="new [] { Entry.Plc.D_222}"></AXOpen.Core.Blazor.Dialogs.AxoAlertLocator>
Loading

0 comments on commit 6b2bd93

Please sign in to comment.