x4js 1.4.10 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/formatters.js +1 -0
- package/lib/gridview.js +7 -5
- package/lib/layout.d.ts +6 -0
- package/lib/layout.js +40 -1
- package/lib/listview.d.ts +3 -3
- package/lib/listview.js +1 -12
- package/lib/tools.js +2 -1
- package/lib/tooltips.js +1 -1
- package/lib/x4.css +36 -23
- package/package.json +1 -1
- package/src/formatters.ts +4 -1
- package/src/gridview.ts +10 -6
- package/src/layout.ts +54 -3
- package/src/listview.ts +3 -3
- package/src/tools.ts +3 -1
- package/src/tooltips.ts +1 -1
- package/src/x4.less +37 -24
package/lib/formatters.js
CHANGED
package/lib/gridview.js
CHANGED
|
@@ -60,7 +60,7 @@ class ColHeader extends component_1.Component {
|
|
|
60
60
|
}),
|
|
61
61
|
new icon_js_1.Icon({
|
|
62
62
|
ref: 'sorter',
|
|
63
|
-
cls: '@hidden',
|
|
63
|
+
cls: '@hidden sort',
|
|
64
64
|
icon: 'var( --x4-icon-arrow-down )'
|
|
65
65
|
})
|
|
66
66
|
]);
|
|
@@ -328,6 +328,7 @@ class GridView extends layout_1.VLayout {
|
|
|
328
328
|
col.$col = comp;
|
|
329
329
|
return comp;
|
|
330
330
|
});
|
|
331
|
+
cols.push(new component_1.Flex({}));
|
|
331
332
|
// compute full width
|
|
332
333
|
let full_width = 0;
|
|
333
334
|
this.m_columns.forEach((col) => {
|
|
@@ -359,6 +360,7 @@ class GridView extends layout_1.VLayout {
|
|
|
359
360
|
});
|
|
360
361
|
return comp;
|
|
361
362
|
});
|
|
363
|
+
foots.push(new component_1.Flex({}));
|
|
362
364
|
this.m_footer = new layout_1.HLayout({
|
|
363
365
|
cls: '@footer',
|
|
364
366
|
content: foots,
|
|
@@ -579,16 +581,16 @@ class GridView extends layout_1.VLayout {
|
|
|
579
581
|
}
|
|
580
582
|
this.m_empty_msg.show(show);
|
|
581
583
|
if (full_width < rc.width) {
|
|
582
|
-
this.m_header.setStyleValue('width', null);
|
|
583
|
-
this.m_footer?.setStyleValue('width', null);
|
|
584
|
+
//this.m_header.setStyleValue('width', null);
|
|
585
|
+
//this.m_footer?.setStyleValue('width', null);
|
|
584
586
|
this.m_container.setStyle({
|
|
585
587
|
height: count * this.m_itemHeight,
|
|
586
588
|
width: null
|
|
587
589
|
});
|
|
588
590
|
}
|
|
589
591
|
else {
|
|
590
|
-
this.m_header.setStyleValue('width', full_width);
|
|
591
|
-
this.m_footer?.setStyleValue('width', full_width);
|
|
592
|
+
this.m_header.setStyleValue('width', full_width + 5);
|
|
593
|
+
this.m_footer?.setStyleValue('width', full_width + 5);
|
|
592
594
|
this.m_container.setStyle({
|
|
593
595
|
height: count * this.m_itemHeight,
|
|
594
596
|
width: full_width
|
package/lib/layout.d.ts
CHANGED
|
@@ -78,4 +78,10 @@ export declare class ScrollView extends Component<ScrollViewProps> {
|
|
|
78
78
|
constructor(props: ScrollViewProps);
|
|
79
79
|
setContent(content: ComponentContent): void;
|
|
80
80
|
}
|
|
81
|
+
export declare class Masonry extends Container {
|
|
82
|
+
constructor(props: any);
|
|
83
|
+
resizeItem(item: Component): void;
|
|
84
|
+
resizeAllItems(): void;
|
|
85
|
+
addItem(itm: Component): void;
|
|
86
|
+
}
|
|
81
87
|
export {};
|
package/lib/layout.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.ScrollView = exports.TableLayout = exports.GridLayout = exports.AutoLayout = exports.VLayout = exports.HLayout = exports.AbsLayout = void 0;
|
|
31
|
+
exports.Masonry = exports.ScrollView = exports.TableLayout = exports.GridLayout = exports.AutoLayout = exports.VLayout = exports.HLayout = exports.AbsLayout = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
33
|
const tools_1 = require("./tools");
|
|
34
34
|
// ============================================================================
|
|
@@ -273,3 +273,42 @@ class ScrollView extends component_1.Component {
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
exports.ScrollView = ScrollView;
|
|
276
|
+
// :: MASONERY ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
277
|
+
// from a nice article of Andy Barefoot
|
|
278
|
+
// https://medium.com/@andybarefoot/a-masonry-style-layout-using-css-grid-8c663d355ebb
|
|
279
|
+
class Masonry extends component_1.Container {
|
|
280
|
+
constructor(props) {
|
|
281
|
+
super(props);
|
|
282
|
+
this.setDomEvent('sizechange', () => {
|
|
283
|
+
this.resizeAllItems();
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
resizeItem(item) {
|
|
287
|
+
const style = this.getComputedStyle();
|
|
288
|
+
const rowHeight = style.parse('grid-auto-rows');
|
|
289
|
+
const rowGap = style.parse('grid-row-gap');
|
|
290
|
+
let content = item.queryItem('.content');
|
|
291
|
+
if (!content) {
|
|
292
|
+
content = item;
|
|
293
|
+
}
|
|
294
|
+
if (content && (rowHeight + rowGap)) {
|
|
295
|
+
const rc = content.getBoundingRect();
|
|
296
|
+
const rowSpan = Math.ceil((rc.height + rowGap) / (rowHeight + rowGap));
|
|
297
|
+
item.setStyleValue('gridRowEnd', "span " + rowSpan);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
resizeAllItems() {
|
|
301
|
+
this.queryAll(".item", (itm) => {
|
|
302
|
+
;
|
|
303
|
+
this.resizeItem(itm);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
addItem(itm) {
|
|
307
|
+
itm.addClass('content');
|
|
308
|
+
this.appendChild(new component_1.Container({
|
|
309
|
+
cls: 'item',
|
|
310
|
+
content: itm
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.Masonry = Masonry;
|
package/lib/listview.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
|
-
import { Container, Component,
|
|
29
|
+
import { Container, Component, ContainerProps, ContainerEventMap, EvDblClick } from './component';
|
|
30
30
|
import { IconID } from './icon';
|
|
31
31
|
import { VLayout } from './layout';
|
|
32
32
|
import { Popup, PopupEventMap, PopupProps } from './popup';
|
|
@@ -35,7 +35,7 @@ import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent }
|
|
|
35
35
|
/**
|
|
36
36
|
* item definition
|
|
37
37
|
*/
|
|
38
|
-
export
|
|
38
|
+
export interface ListViewItem {
|
|
39
39
|
id: any;
|
|
40
40
|
text?: string | HtmlString;
|
|
41
41
|
html?: boolean;
|
|
@@ -67,7 +67,7 @@ export interface ListViewEventMap extends ContainerEventMap {
|
|
|
67
67
|
/**
|
|
68
68
|
* listview properties
|
|
69
69
|
*/
|
|
70
|
-
export interface ListViewProps<E extends ListViewEventMap = ListViewEventMap> extends
|
|
70
|
+
export interface ListViewProps<E extends ListViewEventMap = ListViewEventMap> extends ContainerProps<E> {
|
|
71
71
|
items?: ListViewItem[];
|
|
72
72
|
populate?: PopulateItems;
|
|
73
73
|
gadgets?: Component[];
|
package/lib/listview.js
CHANGED
|
@@ -28,24 +28,13 @@
|
|
|
28
28
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.PopupListView = exports.EvCancel = exports.ListView =
|
|
31
|
+
exports.PopupListView = exports.EvCancel = exports.ListView = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
33
|
const layout_1 = require("./layout");
|
|
34
34
|
const popup_1 = require("./popup");
|
|
35
35
|
const tools_1 = require("./tools");
|
|
36
36
|
const menu_1 = require("./menu");
|
|
37
37
|
const x4_events_1 = require("./x4_events");
|
|
38
|
-
/**
|
|
39
|
-
* item definition
|
|
40
|
-
*/
|
|
41
|
-
class ListViewItem {
|
|
42
|
-
id;
|
|
43
|
-
text; // if you need pure text
|
|
44
|
-
html; // if text is html
|
|
45
|
-
icon;
|
|
46
|
-
data;
|
|
47
|
-
}
|
|
48
|
-
exports.ListViewItem = ListViewItem;
|
|
49
38
|
;
|
|
50
39
|
/**
|
|
51
40
|
* Standard listview class
|
package/lib/tools.js
CHANGED
|
@@ -455,9 +455,10 @@ function parseIntlDate(value, fmts = i18n_1._tr.global.date_input_formats) {
|
|
|
455
455
|
let rematch = new RegExp('^' + smatch + '$', 'm');
|
|
456
456
|
let match = rematch.exec(value);
|
|
457
457
|
if (match) {
|
|
458
|
+
const now = new Date();
|
|
458
459
|
let d = parseInt(match.groups.day ?? '1');
|
|
459
460
|
let m = parseInt(match.groups.month ?? '1');
|
|
460
|
-
let y = parseInt(match.groups.year ?? '
|
|
461
|
+
let y = parseInt(match.groups.year ?? now.getFullYear() + '');
|
|
461
462
|
let h = parseInt(match.groups.hour ?? '0');
|
|
462
463
|
let i = parseInt(match.groups.min ?? '0');
|
|
463
464
|
let s = parseInt(match.groups.sec ?? '0');
|
package/lib/tooltips.js
CHANGED
|
@@ -47,7 +47,7 @@ class Tooltip extends component_1.Component {
|
|
|
47
47
|
render() {
|
|
48
48
|
this.setClass('@non-maskable', true);
|
|
49
49
|
this.setContent([
|
|
50
|
-
new icon_1.Icon({ icon: '
|
|
50
|
+
new icon_1.Icon({ icon: 'var( --x4-icon-tip )' }),
|
|
51
51
|
this.m_text = new label_1.Label({ text: 'help' })
|
|
52
52
|
]);
|
|
53
53
|
}
|
package/lib/x4.css
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
--x4-icon-xmark: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>';
|
|
59
59
|
--x4-icon-angle-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><path d="M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"/></svg>';
|
|
60
60
|
--x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
|
|
61
|
+
--x4-icon-tip: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"/></svg>';
|
|
61
62
|
}
|
|
62
63
|
/* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
|
|
63
64
|
:root {
|
|
@@ -291,10 +292,13 @@ textarea::selection {
|
|
|
291
292
|
.x-icon:before {
|
|
292
293
|
font-family: var(--x4-icon-font-family);
|
|
293
294
|
}
|
|
294
|
-
.x-icon.x-svg-icon
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
.x-icon.x-svg-icon {
|
|
296
|
+
width: 1rem;
|
|
297
|
+
height: 1rem;
|
|
298
|
+
}
|
|
299
|
+
.x-icon.x-svg-icon > svg {
|
|
300
|
+
width: 100%;
|
|
301
|
+
height: 100%;
|
|
298
302
|
}
|
|
299
303
|
.x-base-button {
|
|
300
304
|
display: flex;
|
|
@@ -946,13 +950,15 @@ textarea::selection {
|
|
|
946
950
|
.x-form {
|
|
947
951
|
background-color: var(--x4-form-color);
|
|
948
952
|
margin-block-end: 0;
|
|
949
|
-
padding: 8px;
|
|
953
|
+
padding: 8px 0;
|
|
950
954
|
min-width: 250px;
|
|
951
955
|
min-height: 50px;
|
|
952
|
-
|
|
956
|
+
padding-right: 4px;
|
|
953
957
|
}
|
|
954
958
|
.x-form > .container {
|
|
955
959
|
padding: 0px;
|
|
960
|
+
overflow: auto;
|
|
961
|
+
padding: 0 4px 0 8px;
|
|
956
962
|
}
|
|
957
963
|
.x-form > .footer {
|
|
958
964
|
position: relative;
|
|
@@ -960,7 +966,7 @@ textarea::selection {
|
|
|
960
966
|
bottom: 0;
|
|
961
967
|
width: 100%;
|
|
962
968
|
justify-content: flex-end;
|
|
963
|
-
padding: 0px;
|
|
969
|
+
padding: 0px 4px 0 8px;
|
|
964
970
|
margin-top: 8px;
|
|
965
971
|
align-items: center;
|
|
966
972
|
}
|
|
@@ -1090,25 +1096,25 @@ textarea::selection {
|
|
|
1090
1096
|
.x-grid-view .x-footer .x-cell,
|
|
1091
1097
|
.x-spreadsheet .x-header .x-cell,
|
|
1092
1098
|
.x-grid-view .x-header .x-cell {
|
|
1093
|
-
text-overflow: ellipsis;
|
|
1094
1099
|
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
1095
1100
|
height: unset;
|
|
1096
1101
|
}
|
|
1102
|
+
.x-spreadsheet .x-footer .x-cell span,
|
|
1103
|
+
.x-grid-view .x-footer .x-cell span,
|
|
1104
|
+
.x-spreadsheet .x-header .x-cell span,
|
|
1105
|
+
.x-grid-view .x-header .x-cell span {
|
|
1106
|
+
min-width: 0;
|
|
1107
|
+
text-transform: uppercase;
|
|
1108
|
+
text-overflow: ellipsis;
|
|
1109
|
+
overflow: hidden;
|
|
1110
|
+
font-weight: bold;
|
|
1111
|
+
}
|
|
1097
1112
|
.x-spreadsheet .x-footer .x-cell.sort,
|
|
1098
1113
|
.x-grid-view .x-footer .x-cell.sort,
|
|
1099
1114
|
.x-spreadsheet .x-header .x-cell.sort,
|
|
1100
1115
|
.x-grid-view .x-header .x-cell.sort {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
background-size: 1rem 1rem;
|
|
1104
|
-
background-position: right 0 top 6px;
|
|
1105
|
-
padding-right: calc(1rem + 4px);
|
|
1106
|
-
}
|
|
1107
|
-
.x-spreadsheet .x-footer .x-cell.sort.desc,
|
|
1108
|
-
.x-grid-view .x-footer .x-cell.sort.desc,
|
|
1109
|
-
.x-spreadsheet .x-header .x-cell.sort.desc,
|
|
1110
|
-
.x-grid-view .x-header .x-cell.sort.desc {
|
|
1111
|
-
background-image: var(--x4-icon-arrow-up-long);
|
|
1116
|
+
height: 0.7rem;
|
|
1117
|
+
opacity: 0.7;
|
|
1112
1118
|
}
|
|
1113
1119
|
.x-spreadsheet .x-header .x-cell,
|
|
1114
1120
|
.x-grid-view .x-header .x-cell {
|
|
@@ -1235,14 +1241,14 @@ textarea::selection {
|
|
|
1235
1241
|
background-color: white;
|
|
1236
1242
|
color: white;
|
|
1237
1243
|
padding-left: 24px;
|
|
1238
|
-
font-
|
|
1239
|
-
font-
|
|
1244
|
+
font-family: var(--x4-font);
|
|
1245
|
+
font-size: var(--x4-font-size);
|
|
1240
1246
|
}
|
|
1241
1247
|
.x-tooltip .x-icon {
|
|
1242
1248
|
position: absolute;
|
|
1243
|
-
left:
|
|
1249
|
+
left: 5px;
|
|
1244
1250
|
top: 7px;
|
|
1245
|
-
color: var(--x4-
|
|
1251
|
+
color: var(--x4-selection-color);
|
|
1246
1252
|
}
|
|
1247
1253
|
.x-tooltip .x-label {
|
|
1248
1254
|
background-color: var(--x4-selection-color);
|
|
@@ -1277,6 +1283,7 @@ textarea::selection {
|
|
|
1277
1283
|
overflow-y: auto;
|
|
1278
1284
|
}
|
|
1279
1285
|
.x-popup-list-view {
|
|
1286
|
+
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
|
|
1280
1287
|
background-color: white;
|
|
1281
1288
|
}
|
|
1282
1289
|
.x-popup-list-view .x-combo-popup {
|
|
@@ -1678,3 +1685,9 @@ textarea::selection {
|
|
|
1678
1685
|
left: 0;
|
|
1679
1686
|
right: 0;
|
|
1680
1687
|
}
|
|
1688
|
+
.x-masonry {
|
|
1689
|
+
display: grid;
|
|
1690
|
+
grid-gap: 10px;
|
|
1691
|
+
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
1692
|
+
grid-auto-rows: 10px;
|
|
1693
|
+
}
|
package/package.json
CHANGED
package/src/formatters.ts
CHANGED
package/src/gridview.ts
CHANGED
|
@@ -36,7 +36,7 @@ const T_UPDATE = Symbol('update');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
import { HLayout, VLayout } from './layout'
|
|
39
|
-
import { Component, ContainerEventMap, EvSize, EvDblClick, CProps, flyWrap, html, HtmlString, SizerOverlay } from './component'
|
|
39
|
+
import { Component, ContainerEventMap, EvSize, EvDblClick, CProps, flyWrap, html, HtmlString, SizerOverlay, Flex } from './component'
|
|
40
40
|
import { Label } from './label'
|
|
41
41
|
import { _tr } from './i18n'
|
|
42
42
|
import * as Formatters from './formatters'
|
|
@@ -122,7 +122,7 @@ class ColHeader extends Component {
|
|
|
122
122
|
}),
|
|
123
123
|
new Icon( {
|
|
124
124
|
ref: 'sorter',
|
|
125
|
-
cls: '@hidden',
|
|
125
|
+
cls: '@hidden sort',
|
|
126
126
|
icon: 'var( --x4-icon-arrow-down )'
|
|
127
127
|
})
|
|
128
128
|
]);
|
|
@@ -467,6 +467,8 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
467
467
|
return comp;
|
|
468
468
|
});
|
|
469
469
|
|
|
470
|
+
(cols as any).push( new Flex( {} ) );
|
|
471
|
+
|
|
470
472
|
// compute full width
|
|
471
473
|
let full_width = 0;
|
|
472
474
|
this.m_columns.forEach((col) => {
|
|
@@ -507,6 +509,8 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
507
509
|
return comp;
|
|
508
510
|
});
|
|
509
511
|
|
|
512
|
+
(foots as any).push( new Flex( {} ) );
|
|
513
|
+
|
|
510
514
|
this.m_footer = new HLayout({
|
|
511
515
|
cls: '@footer',
|
|
512
516
|
content: <any>foots,
|
|
@@ -779,16 +783,16 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
779
783
|
this.m_empty_msg.show(show);
|
|
780
784
|
|
|
781
785
|
if (full_width < rc.width) {
|
|
782
|
-
this.m_header.setStyleValue('width', null);
|
|
783
|
-
this.m_footer?.setStyleValue('width', null);
|
|
786
|
+
//this.m_header.setStyleValue('width', null);
|
|
787
|
+
//this.m_footer?.setStyleValue('width', null);
|
|
784
788
|
this.m_container.setStyle({
|
|
785
789
|
height: count * this.m_itemHeight,
|
|
786
790
|
width: null
|
|
787
791
|
});
|
|
788
792
|
}
|
|
789
793
|
else {
|
|
790
|
-
this.m_header.setStyleValue('width', full_width);
|
|
791
|
-
this.m_footer?.setStyleValue('width', full_width);
|
|
794
|
+
this.m_header.setStyleValue('width', full_width + 5 );
|
|
795
|
+
this.m_footer?.setStyleValue('width', full_width + 5 );
|
|
792
796
|
|
|
793
797
|
this.m_container.setStyle({
|
|
794
798
|
height: count * this.m_itemHeight,
|
package/src/layout.ts
CHANGED
|
@@ -116,7 +116,7 @@ export class GridLayout<P extends GridLayoutProps = GridLayoutProps> extends Con
|
|
|
116
116
|
constructor(props: GridLayoutProps) {
|
|
117
117
|
/// @ts-ignore
|
|
118
118
|
// Argument of type 'GridLayoutProps' is not assignable to parameter of type 'P'.
|
|
119
|
-
|
|
119
|
+
// 'GridLayoutProps' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint 'GridLayoutProps'.
|
|
120
120
|
super(props);
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -134,8 +134,8 @@ export class GridLayout<P extends GridLayoutProps = GridLayoutProps> extends Con
|
|
|
134
134
|
this.setStyleValue('grid-gap', this.m_props.colGap);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
if(
|
|
138
|
-
this.setStyleValue('grid-template-areas', this.m_props.template.join('\n')
|
|
137
|
+
if (this.m_props.template) {
|
|
138
|
+
this.setStyleValue('grid-template-areas', this.m_props.template.join('\n'));
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -368,3 +368,54 @@ export class ScrollView extends Component<ScrollViewProps> {
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
// :: MASONERY ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
374
|
+
|
|
375
|
+
// from a nice article of Andy Barefoot
|
|
376
|
+
// https://medium.com/@andybarefoot/a-masonry-style-layout-using-css-grid-8c663d355ebb
|
|
377
|
+
|
|
378
|
+
export class Masonry extends Container {
|
|
379
|
+
|
|
380
|
+
constructor(props) {
|
|
381
|
+
super(props);
|
|
382
|
+
|
|
383
|
+
this.setDomEvent('sizechange', () => {
|
|
384
|
+
this.resizeAllItems( );
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
resizeItem(item: Component) {
|
|
389
|
+
|
|
390
|
+
const style = this.getComputedStyle();
|
|
391
|
+
|
|
392
|
+
const rowHeight = style.parse('grid-auto-rows');
|
|
393
|
+
const rowGap = style.parse('grid-row-gap');
|
|
394
|
+
|
|
395
|
+
let content = item.queryItem('.content');
|
|
396
|
+
if( !content ) {
|
|
397
|
+
content = item;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (content && (rowHeight + rowGap)) {
|
|
401
|
+
const rc = content.getBoundingRect();
|
|
402
|
+
const rowSpan = Math.ceil( (rc.height + rowGap) / (rowHeight + rowGap) );
|
|
403
|
+
item.setStyleValue('gridRowEnd', "span " + rowSpan);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
resizeAllItems( ) {
|
|
408
|
+
this.queryAll( ".item", ( itm ) => {;
|
|
409
|
+
this.resizeItem( itm );
|
|
410
|
+
} );
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
addItem( itm: Component ) {
|
|
414
|
+
itm.addClass( 'content' );
|
|
415
|
+
this.appendChild( new Container( {
|
|
416
|
+
cls: 'item',
|
|
417
|
+
content: itm
|
|
418
|
+
}));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
package/src/listview.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
-
import { Container, Component,
|
|
30
|
+
import { Container, Component, ContainerProps, ContainerEventMap, EvDblClick } from './component'
|
|
31
31
|
import { IconID } from './icon';
|
|
32
32
|
import { HLayout, VLayout } from './layout'
|
|
33
33
|
import { Popup, PopupEventMap, PopupProps } from './popup';
|
|
@@ -40,7 +40,7 @@ import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent, E
|
|
|
40
40
|
* item definition
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
|
-
export
|
|
43
|
+
export interface ListViewItem {
|
|
44
44
|
id: any;
|
|
45
45
|
text?: string | HtmlString; // if you need pure text
|
|
46
46
|
html?: boolean; // if text is html
|
|
@@ -79,7 +79,7 @@ export interface ListViewEventMap extends ContainerEventMap {
|
|
|
79
79
|
/**
|
|
80
80
|
* listview properties
|
|
81
81
|
*/
|
|
82
|
-
export interface ListViewProps<E extends ListViewEventMap = ListViewEventMap> extends
|
|
82
|
+
export interface ListViewProps<E extends ListViewEventMap = ListViewEventMap> extends ContainerProps<E> {
|
|
83
83
|
items?: ListViewItem[];
|
|
84
84
|
populate?: PopulateItems;
|
|
85
85
|
gadgets?: Component[]; // gadgets to instert at bottom
|
package/src/tools.ts
CHANGED
|
@@ -551,9 +551,11 @@ export function parseIntlDate(value: string, fmts: string = _tr.global.date_inpu
|
|
|
551
551
|
let match = rematch.exec(value);
|
|
552
552
|
|
|
553
553
|
if (match) {
|
|
554
|
+
const now = new Date( );
|
|
555
|
+
|
|
554
556
|
let d = parseInt(match.groups.day ?? '1');
|
|
555
557
|
let m = parseInt(match.groups.month ?? '1');
|
|
556
|
-
let y = parseInt(match.groups.year ?? '
|
|
558
|
+
let y = parseInt(match.groups.year ?? now.getFullYear()+'');
|
|
557
559
|
let h = parseInt(match.groups.hour ?? '0');
|
|
558
560
|
let i = parseInt(match.groups.min ?? '0');
|
|
559
561
|
let s = parseInt(match.groups.sec ?? '0');
|
package/src/tooltips.ts
CHANGED
|
@@ -52,7 +52,7 @@ export class Tooltip extends Component {
|
|
|
52
52
|
render() {
|
|
53
53
|
this.setClass('@non-maskable', true);
|
|
54
54
|
this.setContent([
|
|
55
|
-
new Icon({ icon: '
|
|
55
|
+
new Icon({ icon: 'var( --x4-icon-tip )' }),
|
|
56
56
|
this.m_text = new Label({ text: 'help' })
|
|
57
57
|
]);
|
|
58
58
|
}
|
package/src/x4.less
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
--x4-icon-xmark: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>';
|
|
71
71
|
--x4-icon-angle-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><path d="M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"/></svg>';
|
|
72
72
|
--x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
|
|
73
|
+
--x4-icon-tip: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"/></svg>';
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
@BLACK10: rgba(0,0,0,0.1);
|
|
@@ -368,9 +369,14 @@ textarea {
|
|
|
368
369
|
text-align: center;
|
|
369
370
|
flex-direction: column;
|
|
370
371
|
|
|
371
|
-
&.x-svg-icon
|
|
372
|
-
width:
|
|
373
|
-
height:
|
|
372
|
+
&.x-svg-icon {
|
|
373
|
+
width: 1rem;
|
|
374
|
+
height: 1rem;
|
|
375
|
+
|
|
376
|
+
& > svg {
|
|
377
|
+
width: 100%;
|
|
378
|
+
height: 100%;
|
|
379
|
+
}
|
|
374
380
|
}
|
|
375
381
|
}
|
|
376
382
|
|
|
@@ -1184,13 +1190,15 @@ textarea {
|
|
|
1184
1190
|
.x-form {
|
|
1185
1191
|
background-color: var( --x4-form-color );
|
|
1186
1192
|
margin-block-end: 0;
|
|
1187
|
-
padding: 8px;
|
|
1193
|
+
padding: 8px 0;
|
|
1188
1194
|
min-width: 250px;
|
|
1189
1195
|
min-height: 50px;
|
|
1190
|
-
|
|
1191
|
-
|
|
1196
|
+
padding-right: 4px;
|
|
1197
|
+
|
|
1192
1198
|
&>.container {
|
|
1193
1199
|
padding: 0px;
|
|
1200
|
+
overflow: auto;
|
|
1201
|
+
padding: 0 4px 0 8px;
|
|
1194
1202
|
}
|
|
1195
1203
|
|
|
1196
1204
|
&>.footer {
|
|
@@ -1199,7 +1207,7 @@ textarea {
|
|
|
1199
1207
|
bottom: 0;
|
|
1200
1208
|
width: 100%;
|
|
1201
1209
|
justify-content: flex-end;
|
|
1202
|
-
padding: 0px;
|
|
1210
|
+
padding: 0px 4px 0 8px;
|
|
1203
1211
|
margin-top: 8px;
|
|
1204
1212
|
align-items: center;
|
|
1205
1213
|
|
|
@@ -1335,21 +1343,20 @@ textarea {
|
|
|
1335
1343
|
}
|
|
1336
1344
|
|
|
1337
1345
|
.x-cell {
|
|
1338
|
-
text-overflow: ellipsis;
|
|
1339
1346
|
border-right: 1px solid rgba(0,0,0,0.1);
|
|
1340
|
-
//text-transform: capitalize;
|
|
1341
1347
|
height: unset;
|
|
1342
1348
|
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
+
span {
|
|
1350
|
+
min-width: 0;
|
|
1351
|
+
text-transform: uppercase;
|
|
1352
|
+
text-overflow: ellipsis;
|
|
1353
|
+
overflow: hidden;
|
|
1354
|
+
font-weight: bold;
|
|
1349
1355
|
}
|
|
1350
1356
|
|
|
1351
|
-
&.sort
|
|
1352
|
-
|
|
1357
|
+
&.sort {
|
|
1358
|
+
height: 0.7rem;
|
|
1359
|
+
opacity: 0.7;
|
|
1353
1360
|
}
|
|
1354
1361
|
}
|
|
1355
1362
|
}
|
|
@@ -1525,19 +1532,17 @@ textarea {
|
|
|
1525
1532
|
pointer-events: none;
|
|
1526
1533
|
|
|
1527
1534
|
background-color: white;
|
|
1528
|
-
//border: 1px solid fadeout(darken(#2e404f,5%),10%);
|
|
1529
1535
|
color: white;
|
|
1530
|
-
//padding: 4px 8px;
|
|
1531
1536
|
padding-left: 24px;
|
|
1532
1537
|
|
|
1533
|
-
font-
|
|
1534
|
-
font-
|
|
1535
|
-
|
|
1538
|
+
font-family: var( --x4-font );
|
|
1539
|
+
font-size: var( --x4-font-size );
|
|
1540
|
+
|
|
1536
1541
|
.x-icon {
|
|
1537
1542
|
position: absolute;
|
|
1538
|
-
left:
|
|
1543
|
+
left: 5px;
|
|
1539
1544
|
top: 7px;
|
|
1540
|
-
color: var( --x4-
|
|
1545
|
+
color: var( --x4-selection-color );
|
|
1541
1546
|
}
|
|
1542
1547
|
|
|
1543
1548
|
.x-label {
|
|
@@ -1589,6 +1594,7 @@ textarea {
|
|
|
1589
1594
|
|
|
1590
1595
|
|
|
1591
1596
|
.x-popup-list-view {
|
|
1597
|
+
.z-float-4( );
|
|
1592
1598
|
background-color: white;
|
|
1593
1599
|
|
|
1594
1600
|
.x-combo-popup {
|
|
@@ -2120,4 +2126,11 @@ textarea {
|
|
|
2120
2126
|
left: 0;
|
|
2121
2127
|
right: 0;
|
|
2122
2128
|
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
.x-masonry {
|
|
2132
|
+
display: grid;
|
|
2133
|
+
grid-gap: 10px;
|
|
2134
|
+
grid-template-columns: repeat(auto-fill, minmax(250px,1fr));
|
|
2135
|
+
grid-auto-rows: 10px;
|
|
2123
2136
|
}
|