jsl-ui 10.1.0 → 10.1.1

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.
@@ -39,8 +39,10 @@ function card<T>(id: string, title: string, description: string, grid: GridCompo
39
39
  ...extras, { tag: "div", attr: { class: "grid-sample-host" }, children: [grid] }
40
40
  ] };
41
41
  }
42
- const basic = new GridComponent(data(30), columns(), {
43
- primaryKey: "id", multiColumnSort: true, numberedMultiColumnSort: true
42
+ const basicTeams = ["Design", "Engineering", "Operations", "Research", "Product", "Marketing", "Finance", "Support", "Security", "Customer Success"];
43
+ const basicData = data(100).map((project, index) => ({ ...project, team: basicTeams[index % basicTeams.length] }));
44
+ const basic = new GridComponent(basicData, columns().map(column => ({ ...column, filterable: true })), {
45
+ primaryKey: "id", multiColumnSort: true, numberedMultiColumnSort: true, showHeaderMenu: true
44
46
  }, "300px");
45
47
  const edits: IJSLVNode = { tag: "p", content: "Edit a project, budget, date, or approval value.", attr: { role: "status", class: "sample-status" } };
46
48
  const editable = new GridComponent(data(25), columns(true), { primaryKey: "id", editable: true, autoEdit: false }, "300px");
@@ -191,7 +193,7 @@ export const gridShowcase: IJSLVNode = {
191
193
  text("p", "Representative data, formatting, editing, grouping, and scrolling examples for the grid redesign.")
192
194
  ] },
193
195
  { tag: "div", attr: { class: "grid-samples" }, children: [
194
- card("grid-basic", "Browse and sort", "30 projects. Click a heading to sort, then Shift-click other headings to add sort levels. Numbers show sorting priority. Select rows and resize or reorder columns.", basic),
196
+ card("grid-basic", "Browse, sort & filter", "100 projects across 10 teams. Open a column header menu and choose Filter to select values. Click a heading to sort, then Shift-click other headings to add sort levels. Numbers show sorting priority. Select rows and resize or reorder columns.", basic),
195
197
  card("grid-editable", "Edit in place", "Double-click an editable cell. Enter commits and Escape cancels. Editors retain their existing behavior and styling in this step.", editable, [edits]),
196
198
  card("grid-editors-formatters", "Formatters and editors", "Try text, multiline, numeric, date, time, boolean, lookup, multi-lookup, and autosuggest editors. The adjacent columns demonstrate the matching display formatters; TimeFormatter displays a Date value, while TimeEditor edits a time string.", editorCatalog, [editorCatalogStatus]),
197
199
  card("grid-grouped", "Grouped projects", "45 projects grouped by team. Expand and collapse groups independently.", grouped, [
@@ -210,7 +212,7 @@ export const gridShowcase: IJSLVNode = {
210
212
  { tag: "details", attr: { class: "usage" }, children: [
211
213
  text("summary", "Grid showcase scope"),
212
214
  text("p", 'NumericFormatter supplies right-aligned cells; NumericFormatter and DateFormatter apply tabular numerals. Set headerCssClass: "right" or "center" explicitly to match a column’s content. Header alignment is never inferred from its formatter.'),
213
- text("p", "These examples use the existing GridComponent constructor, column definitions, editors, and DataView APIs. The default row height is 40 px; rowHeight can retain a different density. Column headers fit up to two lines. Core presentation follows the shared theme and inherits the host's typography. Filter dialogs, menus, and lifecycle behavior are reserved for later steps.")
215
+ text("p", "These examples use the existing GridComponent constructor, column definitions, editors, and DataView APIs. The default row height is 40 px; rowHeight can retain a different density. Column headers fit up to two lines. Core presentation follows the shared theme and inherits the host's typography. The Browse, sort & filter example demonstrates the Excel filter from a column header menu.")
214
216
  ] }
215
217
  ]
216
218
  };
@@ -46,8 +46,8 @@ export class ExcelFilter {
46
46
  }
47
47
  }
48
48
  const dlg = document.createElement("div");
49
- dlg.classList.add("jsl-dialog-overlay");
50
- dlg.innerHTML = '<div class="jsl-dialog" style="width:50vw;min-height:50vh;"><div class="dlg-header">' + UILang.grid.Filter + '</div><div class="dlg-body" style="max-height:calc(100vh - 7.5rem)"></div>' +
49
+ dlg.classList.add("jsl-dialog-overlay", "jsl-grid-filter-overlay");
50
+ dlg.innerHTML = '<div class="jsl-dialog jsl-grid-filter-dialog"><div class="dlg-header">' + UILang.grid.Filter + '</div><div class="dlg-body jsl-grid-filter-body"></div>' +
51
51
  '<div class="dlg-footer">' +
52
52
  '<button class="jsl-button ok-button">' + UILang.core.Ok + "</button>" +
53
53
  (currentFilters.length > 0 ? ('<button class="jsl-button clear-button">' + UILang.grid.ClearFilter + '</button>') : "") +
@@ -56,9 +56,11 @@ export class ExcelFilter {
56
56
  const dlgBody = dlg.querySelector(".dlg-body");
57
57
  const id = helper.newDomGuid();
58
58
  const search = document.createElement("div");
59
+ search.classList.add("jsl-grid-filter-search");
59
60
  search.innerHTML = "<input type='text' placeholder='" + UILang.grid.Search + "' />";
60
61
  dlgBody.appendChild(search);
61
62
  const cbAllContainer = document.createElement("div");
63
+ cbAllContainer.classList.add("jsl-grid-filter-all");
62
64
  const cbAll = document.createElement("input");
63
65
  cbAll.type = "checkbox";
64
66
  cbAll.id = id;
@@ -93,17 +95,16 @@ export class ExcelFilter {
93
95
  let visibleValues = sortedValues;
94
96
  const checkedValues = { ...oldCheckedValues };
95
97
  const cbContainer = document.createElement("div");
98
+ cbContainer.classList.add("jsl-grid-filter-values");
96
99
  dlgBody.appendChild(cbContainer);
97
- const rowHeight = /*this.grid.getOptions().rowHeight ||*/ Math.round(ExcelFilter.convertRemToPixels(1.5));
98
- let height = sortedValues.length * rowHeight;
99
- height = Math.min(height, Math.round(window.innerHeight - ExcelFilter.convertRemToPixels(13)));
100
+ const rowHeight = Math.round(ExcelFilter.convertRemToPixels(1.75));
101
+ const maxHeight = Math.max(rowHeight, Math.round(window.innerHeight - ExcelFilter.convertRemToPixels(19)));
102
+ const height = Math.min(sortedValues.length * rowHeight, maxHeight);
100
103
  const vr = new VirtualRenderComponent({
101
104
  data: visibleValues,
102
105
  renderRow: (args) => {
103
- args.container.attr.style["padding-left"] = "1rem";
104
- args.container.attr.style["overflow"] = "hidden";
105
- args.container.attr.style["display"] = "flex";
106
- args.container.attr.style["align-items"] = "center";
106
+ var _a;
107
+ args.container.attr.class = "jsl-grid-filter-value-row";
107
108
  args.container.children.push({
108
109
  tag: "input",
109
110
  attr: {
@@ -132,7 +133,8 @@ export class ExcelFilter {
132
133
  tag: "label",
133
134
  attr: {
134
135
  for: id + "_" + args.index,
135
- style: "margin-left:0.2rem;cursor:pointer"
136
+ class: "jsl-grid-filter-value-label",
137
+ title: String((_a = args.rowData.txt) !== null && _a !== void 0 ? _a : "")
136
138
  },
137
139
  raw: true,
138
140
  content: args.rowData.txt
@@ -1,101 +1,98 @@
1
- /* Menu button */
2
- .slick-header-menubutton {
3
- position: absolute;
4
- right: 0;
5
- top: 0;
6
- bottom: 0;
7
- width: 14px;
8
- background-repeat: no-repeat;
9
- background-position: left center;
10
- background-image: url('data:image/gif;base64,R0lGODlhDgAOAIABADtKYwAAACH5BAEAAAEALAAAAAAOAA4AAAISjI+py+0PHZgUsGobhTn6DxoFADs=');
11
- cursor: pointer;
12
-
13
- display: none;
14
- border-left: thin ridge silver;
15
- }
16
-
17
- .slick-header-menubutton.resize-offset {
18
- right: 0.5rem;
19
- }
20
-
21
- .slick-header-column:hover > .slick-header-menubutton,
22
- .slick-header-column-active .slick-header-menubutton {
23
- display: inline-block;
24
- }
25
-
26
- /* Menu */
27
- .slick-header-menu {
28
- position: absolute;
29
- display: inline-block;
30
- margin: 0;
31
- padding: 2px;
32
- cursor: default;
33
- }
34
-
35
-
36
- /* Menu items */
37
- .slick-header-menuitem {
38
- list-style: none;
39
- margin: 0;
40
- padding: 0;
41
- cursor: pointer;
42
- }
43
-
44
- .slick-header-menuicon {
45
- display: inline-block;
46
- width: 16px;
47
- height: 16px;
48
- vertical-align: middle;
49
- margin-right: 4px;
50
- background-repeat: no-repeat;
51
- background-position: center center;
52
- }
53
-
54
- .slick-header-menucontent {
55
- display: inline-block;
56
- vertical-align: middle;
57
- }
58
-
59
-
60
- /* Disabled */
61
- .slick-header-menuitem-disabled {
62
- color: silver;
63
- }
64
-
65
- /* Divider */
66
- .slick-header-menuitem.slick-header-menuitem-divider {
67
- cursor: default;
68
- border: none;
69
- overflow: hidden;
70
- padding: 0;
71
- height: 1px;
72
- margin: 8px 2px;
73
- background-color: #cecece;
74
- }
75
- .slick-header-menuitem-divider.slick-header-menuitem:hover {
76
- background-color: #cecece;
77
- }
78
-
79
- .slick-header-menu {
80
- border: 1px solid #bebebe;
81
- background: #ffffff;
82
- padding: 2px;
83
- box-shadow: 2px 2px 2px silver;
84
- z-index: 20;
85
- }
86
-
87
-
88
- .slick-header-menuitem {
89
- padding: 2px 4px;
90
- border-radius: 3px;
91
- }
92
-
93
- .slick-header-menuitem:hover {
94
- background: #3B99FF;
95
- color:white;
96
- }
97
-
98
- .slick-header-menuitem-disabled {
99
- border-color: transparent !important;
100
- background: inherit !important;
101
- }
1
+ /* Menu button */
2
+ .slick-header-menubutton {
3
+ position: absolute;
4
+ right: 0;
5
+ top: 0;
6
+ bottom: 0;
7
+ width: 14px;
8
+ background-repeat: no-repeat;
9
+ background-position: left center;
10
+ background-image: url('data:image/gif;base64,R0lGODlhDgAOAIABADtKYwAAACH5BAEAAAEALAAAAAAOAA4AAAISjI+py+0PHZgUsGobhTn6DxoFADs=');
11
+ cursor: pointer;
12
+
13
+ display: none;
14
+ border-left: thin ridge silver;
15
+ }
16
+
17
+ .slick-header-menubutton.resize-offset {
18
+ right: 0.5rem;
19
+ }
20
+
21
+ .slick-header-column:hover > .slick-header-menubutton,
22
+ .slick-header-column-active .slick-header-menubutton {
23
+ display: inline-block;
24
+ }
25
+
26
+ /* Menu */
27
+ .slick-header-menu {
28
+ position: absolute;
29
+ display: inline-block;
30
+ margin: 0;
31
+ padding: 2px;
32
+ cursor: default;
33
+ }
34
+
35
+ /* Menu items */
36
+ .slick-header-menuitem {
37
+ list-style: none;
38
+ margin: 0;
39
+ padding: 0;
40
+ cursor: pointer;
41
+ }
42
+
43
+ .slick-header-menuicon {
44
+ display: inline-block;
45
+ width: 16px;
46
+ height: 16px;
47
+ vertical-align: middle;
48
+ margin-right: 4px;
49
+ background-repeat: no-repeat;
50
+ background-position: center center;
51
+ }
52
+
53
+ .slick-header-menucontent {
54
+ display: inline-block;
55
+ vertical-align: middle;
56
+ }
57
+
58
+ /* Disabled */
59
+ .slick-header-menuitem-disabled {
60
+ color: silver;
61
+ }
62
+
63
+ /* Divider */
64
+ .slick-header-menuitem.slick-header-menuitem-divider {
65
+ cursor: default;
66
+ border: none;
67
+ overflow: hidden;
68
+ padding: 0;
69
+ height: 1px;
70
+ margin: 8px 2px;
71
+ background-color: #cecece;
72
+ }
73
+ .slick-header-menuitem-divider.slick-header-menuitem:hover {
74
+ background-color: #cecece;
75
+ }
76
+
77
+ .slick-header-menu {
78
+ border: 1px solid #bebebe;
79
+ background: #ffffff;
80
+ padding: 2px;
81
+ box-shadow: 2px 2px 2px silver;
82
+ z-index: 20;
83
+ }
84
+
85
+ .slick-header-menuitem {
86
+ padding: 2px 4px;
87
+ border-radius: 3px;
88
+ }
89
+
90
+ .slick-header-menuitem:hover {
91
+ background: var(--jsl-color-accent);
92
+ color: var(--jsl-color-on-accent);
93
+ }
94
+
95
+ .slick-header-menuitem-disabled {
96
+ border-color: transparent !important;
97
+ background: inherit !important;
98
+ }
@@ -335,3 +335,112 @@ input.editor-text, textarea.editor-text {
335
335
  right: 1.2rem;
336
336
  width: 1.2rem;
337
337
  }
338
+
339
+ /* Excel filter dialog */
340
+ .jsl-dialog.jsl-grid-filter-dialog {
341
+ width: min(34rem, calc(100% - 2rem));
342
+ max-height: calc(100vh - 1rem);
343
+ }
344
+
345
+ .jsl-dialog.jsl-grid-filter-dialog > .dlg-body {
346
+ display: flex;
347
+ flex-direction: column;
348
+ gap: 0.625rem;
349
+ min-height: 0;
350
+ overflow: hidden;
351
+ overflow-wrap: normal;
352
+ padding: 1.25rem;
353
+ }
354
+
355
+ .jsl-grid-filter-search {
356
+ flex: 0 0 auto;
357
+ }
358
+
359
+ .jsl-grid-filter-search > input {
360
+ display: block;
361
+ box-sizing: border-box;
362
+ width: 100%;
363
+ min-height: 2.5rem;
364
+ padding: 0.5rem 0.75rem;
365
+ border: 1px solid var(--jsl-color-border);
366
+ border-radius: 0.375rem;
367
+ background: var(--jsl-color-surface);
368
+ color: var(--jsl-color-text);
369
+ font: inherit;
370
+ }
371
+
372
+ .jsl-grid-filter-search > input:focus-visible {
373
+ border-color: var(--jsl-color-focus);
374
+ outline: 2px solid var(--jsl-color-focus);
375
+ outline-offset: 1px;
376
+ }
377
+
378
+ .jsl-grid-filter-all {
379
+ display: flex;
380
+ flex: 0 0 auto;
381
+ align-items: center;
382
+ min-height: 1.75rem;
383
+ padding: 0 0.625rem 0.5rem;
384
+ border-bottom: 1px solid var(--jsl-color-border-subtle);
385
+ }
386
+
387
+ .jsl-grid-filter-all > label,
388
+ .jsl-grid-filter-value-label {
389
+ margin: 0 0 0 0.375rem;
390
+ color: var(--jsl-color-text);
391
+ line-height: 1.4;
392
+ cursor: pointer;
393
+ }
394
+
395
+ .jsl-grid-filter-values {
396
+ flex: 1 1 auto;
397
+ min-height: 0;
398
+ overflow: hidden;
399
+ border: 1px solid var(--jsl-color-border-subtle);
400
+ border-radius: 0.375rem;
401
+ background: var(--jsl-color-surface);
402
+ }
403
+
404
+ .jsl-grid-filter-values > .v-r-comp {
405
+ box-sizing: border-box;
406
+ width: 100%;
407
+ overflow-x: hidden;
408
+ scrollbar-gutter: stable;
409
+ overscroll-behavior: contain;
410
+ }
411
+
412
+ .jsl-grid-filter-value-row {
413
+ display: flex;
414
+ align-items: center;
415
+ gap: 0.375rem;
416
+ box-sizing: border-box;
417
+ min-width: 0;
418
+ padding: 0 0.625rem;
419
+ overflow: hidden;
420
+ overflow-wrap: normal;
421
+ }
422
+
423
+ .jsl-grid-filter-value-row > input {
424
+ flex: 0 0 auto;
425
+ margin: 0;
426
+ }
427
+
428
+ .jsl-grid-filter-value-label {
429
+ display: block;
430
+ flex: 1 1 auto;
431
+ min-width: 0;
432
+ margin: 0;
433
+ overflow: hidden;
434
+ text-overflow: ellipsis;
435
+ white-space: nowrap;
436
+ }
437
+
438
+ .jsl-grid-filter-value-row:hover {
439
+ background: var(--jsl-color-surface-hover);
440
+ }
441
+
442
+ @media (max-width: 480px) {
443
+ .jsl-dialog.jsl-grid-filter-dialog > .dlg-body {
444
+ padding: 1rem;
445
+ }
446
+ }