sync sample.
This commit is contained in:
1 parent
f9efaec884
commit
29a327ff02
4 files changed
+236
-118
No files matched your search
+23
-42
@@ -7,53 +7,34 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>UI Lib</title>
|
<title>UI Lib</title>
|
||||||
<!-- <script src="amrnb.js"></script> -->
|
<!-- <script src="amrnb.js"></script> -->
|
||||||
|
<link rel="stylesheet" href="./style.scss" />
|
||||||
<script type="module" src="main.ts"></script>
|
<script type="module" src="main.ts"></script>
|
||||||
<link rel="stylesheet" href="../lib/ui/css/common.scss" />
|
|
||||||
<style type="text/css">
|
|
||||||
:root {
|
|
||||||
--red-color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drag-box {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.box-inner {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drag-hover {
|
|
||||||
background-color: #ccc;
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
position: relative;
|
|
||||||
height: 100%;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#container>.ui-grid {
|
|
||||||
width: 1000px;
|
|
||||||
height: 400px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div id="container"></div>
|
<div id="container">
|
||||||
|
<div>
|
||||||
|
<label class="ui-switch">
|
||||||
|
<input type="checkbox" />
|
||||||
|
<span>Display Behavior/Insight Events Only</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="ui-switch-group">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="reviewed" checked="checked" />
|
||||||
|
<span>Yes</span>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="reviewed" />
|
||||||
|
<span>No</span>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="reviewed" />
|
||||||
|
<span>Pending</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!--<button id="setItem">set item</button>
|
<!--<button id="setItem">set item</button>
|
||||||
<button id="addItem">add item</button>
|
<button id="addItem">add item</button>
|
||||||
<button id="addItems">add items</button>
|
<button id="addItems">add items</button>
|
||||||
|
|||||||
+162
-68
@@ -10,21 +10,20 @@ import '../lib/global.d.ts';
|
|||||||
import { createElement } from '../lib/functions';
|
import { createElement } from '../lib/functions';
|
||||||
import { Grid } from '../lib/ui/grid/grid';
|
import { Grid } from '../lib/ui/grid/grid';
|
||||||
import { toDateValue } from '../lib/ui/date';
|
import { toDateValue } from '../lib/ui/date';
|
||||||
import { showConfirm } from '../lib/ui/popup';
|
import { Popup, showAlert, showConfirm, showInput } from '../lib/ui/popup';
|
||||||
import { init } from '../lib/utility';
|
import { init } from '../lib/utility';
|
||||||
import { appendResizer, makeMovable } from '../lib/drag';
|
import { appendResizer, makeMovable } from '../lib/ui/movable';
|
||||||
|
import { Dropdown } from '../lib/ui/dropdown';
|
||||||
|
|
||||||
// document.querySelector('#js-logo').src = javascriptLogo
|
// document.querySelector('#js-logo').src = javascriptLogo
|
||||||
|
|
||||||
window.consts = {
|
window.consts = {
|
||||||
path: '/',
|
path: '',
|
||||||
resver: 20231218,
|
resver: 20231218,
|
||||||
prefix: ''
|
prefix: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
const snapPool: HTMLDivElement[] = [];
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const container = document.body.querySelector<HTMLElement>('.wrapper');
|
const container = document.body.querySelector<HTMLElement>('.wrapper');
|
||||||
if (container == null) {
|
if (container == null) {
|
||||||
return;
|
return;
|
||||||
@@ -41,7 +40,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
);
|
);
|
||||||
p.style.cssText += `
|
p.style.cssText += `
|
||||||
left: ${Math.round(Math.random() * 800)}px;
|
left: ${Math.round(Math.random() * 800)}px;
|
||||||
top: ${Math.round(Math.random() * 800)}px;
|
top: ${Math.round(Math.random() * 500)}px;
|
||||||
width: ${Math.round(Math.random() * 300) + 200}px;
|
width: ${Math.round(Math.random() * 300) + 200}px;
|
||||||
height: ${Math.round(Math.random() * 300) + 200}px;
|
height: ${Math.round(Math.random() * 300) + 200}px;
|
||||||
`;
|
`;
|
||||||
@@ -52,58 +51,114 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||||||
makeMovable(container, {
|
makeMovable(container, {
|
||||||
movable: true,
|
movable: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
snapThreshold: 5,
|
snapThreshold: 10
|
||||||
onSnap(guides) {
|
|
||||||
const maxX = Math.max(container.clientWidth, container.scrollWidth) - 1;
|
|
||||||
const maxY = Math.max(container.clientHeight, container.scrollHeight) - 1;
|
|
||||||
|
|
||||||
for (let i = 0; i < guides.length; i++) {
|
|
||||||
let line = snapPool[i];
|
|
||||||
if (!line) {
|
|
||||||
line = document.createElement('div');
|
|
||||||
container.appendChild(line);
|
|
||||||
snapPool.push(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { axis, pos, start, end } = guides[i];
|
|
||||||
const len = Math.max(0, Math.round(end - start));
|
|
||||||
|
|
||||||
if (axis === 'x') {
|
|
||||||
const left = Math.max(0, Math.min(Math.round(pos), maxX));
|
|
||||||
const top = Math.round(start);
|
|
||||||
line.className = 'snap-line line-x';
|
|
||||||
line.style.width = '1px';
|
|
||||||
line.style.height = `${len}px`;
|
|
||||||
line.style.transform = `translate(${left}px, ${top}px)`;
|
|
||||||
} else {
|
|
||||||
const top = Math.max(0, Math.min(Math.round(pos), maxY));
|
|
||||||
const left = Math.round(start);
|
|
||||||
line.className = 'snap-line line-y';
|
|
||||||
line.style.width = `${len}px`;
|
|
||||||
line.style.height = '1px';
|
|
||||||
line.style.transform = `translate(${left}px, ${top}px)`;
|
|
||||||
}
|
|
||||||
line.style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = guides.length; i < snapPool.length; i++) {
|
|
||||||
snapPool[i].style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
new Popup({
|
||||||
|
title: 'title',
|
||||||
|
content: createElement('div', div => {
|
||||||
|
div.style.backgroundColor = '#ccc';
|
||||||
|
div.innerText = 'test';
|
||||||
|
}),
|
||||||
|
movable: true,
|
||||||
|
resizable: true,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
key: 'ok',
|
||||||
|
text: 'Ok',
|
||||||
|
trigger(popup) {
|
||||||
|
console.log(this, popup);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).show();
|
||||||
|
|
||||||
|
// const r = await showAlert('Popup', 'all prepared.');
|
||||||
|
/*/
|
||||||
|
const r = await showConfirm('Confirm', 'confirm message', [
|
||||||
|
{
|
||||||
|
key: 'TRUE',
|
||||||
|
text: 'yes',
|
||||||
|
trigger(popup, button) {
|
||||||
|
console.log('button trigger.');
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, 2000);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'FALSE',
|
||||||
|
text: 'no'
|
||||||
|
}
|
||||||
|
]);//*/
|
||||||
|
// const r = await showInput('Input', true, 'Type message here.', {
|
||||||
|
// oninput(e: InputEvent) {
|
||||||
|
// console.log(e);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// console.log(r);
|
||||||
});
|
});
|
||||||
|
|
||||||
// const DateSelector = window['lib-ui'].DateSelector;
|
/*/
|
||||||
// const formatDate = window['lib-ui'].formatDate;
|
var dropdown = new Dropdown({
|
||||||
|
search: true,
|
||||||
|
multiSelect: true,
|
||||||
|
selectedList: ['beijing', 'hebei']
|
||||||
|
});
|
||||||
|
dropdown.source = [
|
||||||
|
{
|
||||||
|
value: 'beijing',
|
||||||
|
text: '北京市'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'hebei',
|
||||||
|
text: '河北省',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'shijiazhuang',
|
||||||
|
text: '石家庄市'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'tangshan',
|
||||||
|
text: '唐山市'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'chongqing',
|
||||||
|
text: '重庆市',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'yuzhongqu',
|
||||||
|
text: '渝中区'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'jiangsu',
|
||||||
|
text: '江苏省',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'nanjing',
|
||||||
|
text: '南京市'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'xuzhou',
|
||||||
|
text: '徐州市'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'suzhou',
|
||||||
|
text: '苏州市'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
// window.addEventListener('load', () => {
|
const wrapper = dropdown.create();
|
||||||
// DateSelector.resolve(document.querySelector('#container'), function (date) {
|
wrapper.style.minWidth = '220px';
|
||||||
// console.log(`element(#${this.element.id}), date changed to: ${formatDate(date)}`);
|
document.querySelector('#container')?.replaceChildren(wrapper);
|
||||||
|
|
||||||
// const value = document.querySelector('#dateFrom').value;
|
/*/
|
||||||
// console.log(`dateFrom.value = '${value}', formatted: '${formatDate(value)}'`);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
/*/
|
/*/
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
@@ -217,11 +272,11 @@ window.addEventListener('load', () => {
|
|||||||
return String(count).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
return String(count).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
};
|
};
|
||||||
grid.columns = [
|
grid.columns = [
|
||||||
{ key: 'name', caption: '包名称', type: Grid.ColumnTypes.Input },
|
{ key: 'name', caption: '包名称', type: Grid.ColumnTypes.Input, enabled: item => !item.version },
|
||||||
{ key: 'version', caption: '版本号' },
|
{ key: 'version', caption: '版本号', type: Grid.ColumnTypes.Input, enabled: item => !item.name },
|
||||||
{ key: 'author', caption: '作者' },
|
{ key: 'author', caption: '作者' },
|
||||||
{ key: 'count', caption: '下载量', filter: getCountFilter('count'), align: 'right' },
|
{ key: 'count', caption: '下载量', filter: getCountFilter('count'), align: 'right' },
|
||||||
{ key: 'mauiName', caption: 'Maui 对应包' },
|
{ key: 'mauiName', caption: 'Maui 对应包', allowFilter: true },
|
||||||
{ key: 'mauiVersion', caption: '版本号' },
|
{ key: 'mauiVersion', caption: '版本号' },
|
||||||
{ key: 'mauiNet', caption: '.NET' },
|
{ key: 'mauiNet', caption: '.NET' },
|
||||||
{ key: 'mauiCount', caption: '下载量', filter: getCountFilter('mauiCount'), align: 'right' }
|
{ key: 'mauiCount', caption: '下载量', filter: getCountFilter('mauiCount'), align: 'right' }
|
||||||
@@ -235,17 +290,19 @@ window.addEventListener('load', () => {
|
|||||||
mauiName: 'Dynatrace.OneAgent.MAUI',
|
mauiName: 'Dynatrace.OneAgent.MAUI',
|
||||||
mauiVersion: '1.283.1',
|
mauiVersion: '1.283.1',
|
||||||
mauiNet: '7.0',
|
mauiNet: '7.0',
|
||||||
mauiCount: 12351
|
mauiCount: 12351,
|
||||||
},
|
__children: [
|
||||||
{
|
{
|
||||||
name: 'Esri.ArcGISRuntime.Xamarin.Forms',
|
name: 'Esri.ArcGISRuntime.Xamarin.Forms',
|
||||||
version: '100.15.4',
|
version: '100.15.4',
|
||||||
author: 'Esri_Inc',
|
author: 'Esri_Inc',
|
||||||
count: 249909,
|
count: 249909,
|
||||||
mauiName: 'Esri.ArcGISRuntime.Maui',
|
mauiName: 'Esri.ArcGISRuntime.Maui',
|
||||||
mauiVersion: '200.3.0',
|
mauiVersion: '200.3.0',
|
||||||
mauiNet: '8.0',
|
mauiNet: '8.0',
|
||||||
mauiCount: 40913
|
mauiCount: 40913
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Scandit.DataCapture.Core.Xamarin',
|
name: 'Scandit.DataCapture.Core.Xamarin',
|
||||||
@@ -312,6 +369,43 @@ window.addEventListener('load', () => {
|
|||||||
window.grid = grid;
|
window.grid = grid;
|
||||||
});//*/
|
});//*/
|
||||||
|
|
||||||
|
// const DateSelector = window['lib-ui'].DateSelector;
|
||||||
|
// const formatDate = window['lib-ui'].formatDate;
|
||||||
|
|
||||||
|
// window.addEventListener('load', () => {
|
||||||
|
// DateSelector.resolve(document.querySelector('#container'), function (date) {
|
||||||
|
// console.log(`element(#${this.element.id}), date changed to: ${formatDate(date)}`);
|
||||||
|
|
||||||
|
// const value = document.querySelector('#dateFrom').value;
|
||||||
|
// console.log(`dateFrom.value = '${value}', formatted: '${formatDate(value)}'`);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
/*
|
||||||
|
const createVideoList = window['lib-ui'].createVideoList;
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
document.querySelector('#container').append(
|
||||||
|
createVideoList([
|
||||||
|
'http://192.168.25.95/ironintel/Temp/9fdd0f0c03c22c10204e7efaf80eb005.mp4',
|
||||||
|
'http://192.168.25.95/ironintel/Temp/9fdd0f0c03c22c10204e7efaf80eb005.mp4'
|
||||||
|
], {
|
||||||
|
autoPlay: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
const Grid = window['lib-ui'].Grid;
|
||||||
|
const createElement = window['lib-ui'].createElement;
|
||||||
|
const toDateValue = window['lib-ui'].toDateValue;
|
||||||
|
const showConfirm = window['lib-ui'].showConfirm;
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
});
|
||||||
|
//*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
const grid = new Grid('#container');
|
const grid = new Grid('#container');
|
||||||
|
|||||||
+39
-8
@@ -1,10 +1,10 @@
|
|||||||
@import '../lib/ui/css/variables/definition.scss';
|
@use '../lib/ui/css/variables/definition.scss';
|
||||||
@import '../lib/ui/css/common.scss';
|
@use '../lib/ui/css/common.scss';
|
||||||
@import '../lib/ui/css/checkbox.scss';
|
@use '../lib/ui/css/checkbox.scss';
|
||||||
@import '../lib/ui/css/dropdown.scss';
|
@use '../lib/ui/css/dropdown.scss';
|
||||||
@import '../lib/ui/css/grid.scss';
|
@use '../lib/ui/css/grid.scss';
|
||||||
@import '../lib/ui/css/popup.scss';
|
@use '../lib/ui/css/popup.scss';
|
||||||
@import '../lib/ui/css/tooltip.scss';
|
@use '../lib/ui/css/tooltip.scss';
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: var(--serif-font-family);
|
font-family: var(--serif-font-family);
|
||||||
@@ -115,7 +115,6 @@ button {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: flex;
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,4 +230,36 @@ h1 {
|
|||||||
button {
|
button {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-popup-mask {
|
||||||
|
.ui-popup-container {
|
||||||
|
.ui-popup-header {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-inner {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drag-hover {
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
width: 1000px;
|
||||||
|
height: 600px;
|
||||||
}
|
}
|
||||||
@@ -9,5 +9,17 @@
|
|||||||
<add name="Access-Control-Allow-Origin" value="*" />
|
<add name="Access-Control-Allow-Origin" value="*" />
|
||||||
</customHeaders>
|
</customHeaders>
|
||||||
</httpProtocol>
|
</httpProtocol>
|
||||||
|
<rewrite>
|
||||||
|
<rules>
|
||||||
|
<rule name="rsync" stopProcessing="true">
|
||||||
|
<match url="gui/(.*)" />
|
||||||
|
<conditions>
|
||||||
|
<add input="{CACHE_URL}" pattern="(.+)s://" />
|
||||||
|
<add input="{CACHE_URL}" pattern="(.*)s://" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Rewrite" url="{C:1}://localhost:8888/gui/{R:1}" />
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</rewrite>
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</configuration>
|
</configuration>
|
||||||
Reference in new issue
Block a user