@ixfx/components 0.13.0 → 0.13.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.
- package/bundle/index.d.ts +214 -73
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +347 -13
- package/bundle/index.js.map +1 -1
- package/dist/{button-BYuf72aR.d.ts → button-CTL45aBl.d.ts} +2 -2
- package/dist/{button-BYuf72aR.d.ts.map → button-CTL45aBl.d.ts.map} +1 -1
- package/dist/button.d.ts +1 -1
- package/dist/crumbs.d.ts +2 -2
- package/dist/{data-grid-BJ6XXvRc.d.ts → data-grid-Ck1Qx2H1.d.ts} +4 -4
- package/dist/{data-grid-BJ6XXvRc.d.ts.map → data-grid-Ck1Qx2H1.d.ts.map} +1 -1
- package/dist/data-grid.d.ts +2 -2
- package/dist/{detail-list-B0waVNeS.d.ts → detail-list-C1xzr1z7.d.ts} +4 -4
- package/dist/{detail-list-B0waVNeS.d.ts.map → detail-list-C1xzr1z7.d.ts.map} +1 -1
- package/dist/detail-list.d.ts +3 -3
- package/dist/editable-label-rzXkjf1H.d.ts.map +1 -1
- package/dist/editable-label.js +2 -2
- package/dist/editable-label.js.map +1 -1
- package/dist/{flat-list-eYItri8-.d.ts → flat-list-DEDG6epz.d.ts} +60 -5
- package/dist/flat-list-DEDG6epz.d.ts.map +1 -0
- package/dist/flat-list.d.ts +2 -2
- package/dist/flat-list.js +144 -9
- package/dist/flat-list.js.map +1 -1
- package/dist/{grid-list-_gI9ckcT.d.ts → grid-list-pefLORIr.d.ts} +4 -4
- package/dist/{grid-list-_gI9ckcT.d.ts.map → grid-list-pefLORIr.d.ts.map} +1 -1
- package/dist/grid-list.d.ts +2 -2
- package/dist/incr-search.d.ts +1 -1
- package/dist/{index-BvxHQUME.d.ts → index-CxZ61DO1.d.ts} +3 -3
- package/dist/{index-BvxHQUME.d.ts.map → index-CxZ61DO1.d.ts.map} +1 -1
- package/dist/{index-CW2QL33o.d.ts → index-Dq30pOnn.d.ts} +2 -2
- package/dist/{index-CW2QL33o.d.ts.map → index-Dq30pOnn.d.ts.map} +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/{list-native-drag-controller-CllsHLxw.d.ts → list-native-drag-controller-ChIi3eK5.d.ts} +2 -2
- package/dist/{list-native-drag-controller-CllsHLxw.d.ts.map → list-native-drag-controller-ChIi3eK5.d.ts.map} +1 -1
- package/dist/menu.d.ts +1 -1
- package/dist/miller.d.ts +3 -3
- package/dist/{tree-component-DukLqesg.d.ts → tree-component-Cj8V3uar.d.ts} +2 -2
- package/dist/{tree-component-DukLqesg.d.ts.map → tree-component-Cj8V3uar.d.ts.map} +1 -1
- package/dist/tree.d.ts +4 -4
- package/dist/{types-D-kYF16b.d.ts → types-DQ7KOUIj.d.ts} +6 -1
- package/dist/types-DQ7KOUIj.d.ts.map +1 -0
- package/dist/{vertical-list-DheZSEmB.d.ts → vertical-list-CqBc-t8w.d.ts} +86 -4
- package/dist/vertical-list-CqBc-t8w.d.ts.map +1 -0
- package/dist/vertical-list.d.ts +3 -3
- package/dist/vertical-list.js +202 -2
- package/dist/vertical-list.js.map +1 -1
- package/docs-user/flat-list.md +32 -2
- package/docs-user/index.json +2 -2
- package/docs-user/vertical-list.md +59 -3
- package/package.json +1 -1
- package/dist/flat-list-eYItri8-.d.ts.map +0 -1
- package/dist/types-D-kYF16b.d.ts.map +0 -1
- package/dist/vertical-list-DheZSEmB.d.ts.map +0 -1
|
@@ -43,7 +43,7 @@ declare class ButtonElement extends LitElement {
|
|
|
43
43
|
* attribute).
|
|
44
44
|
*/
|
|
45
45
|
value: boolean;
|
|
46
|
-
protected _renderIcon():
|
|
46
|
+
protected _renderIcon(): import("lit").TemplateResult<1> | typeof nothing;
|
|
47
47
|
protected render(): import("lit").TemplateResult<1>;
|
|
48
48
|
static styles: import("lit").CSSResult[];
|
|
49
49
|
}
|
|
@@ -60,4 +60,4 @@ interface ButtonElement {
|
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
62
|
export { ItemsProvider as a, SplitButtonSelectEvent as c, ButtonToggleEvent as i, SwitcherItem as l, ButtonElementEventMap as n, PopupItem as o, ButtonToggleDetail as r, SplitButtonSelectDetail as s, ButtonElement as t };
|
|
63
|
-
//# sourceMappingURL=button-
|
|
63
|
+
//# sourceMappingURL=button-CTL45aBl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-
|
|
1
|
+
{"version":3,"file":"button-CTL45aBl.d.ts","names":[],"sources":["../src/button/types.ts","../src/button/button.ts"],"mappings":";;KAAY;WACD;WACA;;KAGC,yBAAyB,YAAY;KAErC;WACD;WACA;WACA;;KAGC;WACD;WACA;WACA;WACA;;KAGC,sBAAsB,cAAc,QAAQ;KAE5C;WACD;;KAGC,oBAAoB,YAAY;;;cCf/B,sBAAsB;;EAEjC;EAGA;EAGA;EAGA;EAGA;EAGA;;;;;;EAQA;;;;;;EAQA;YAaU,6BAAW,2BAAA;YAcX,wBAAM;SAQT,sBAAM;;QAMP;YACI;IACR,eAAe;;;UAIF;EACf,QAAQ;;UAGO;EACf,oBAAoB,gBAAgB,uBAClC,MAAM,GACN,WAAW,MAAM,eAAe,OAAO,sBAAsB,aAC7D,oBAAoB,sCAEpB,cACA,UAAU,oCACV,oBAAoB"}
|
package/dist/button.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ButtonElementEventMap, t as ButtonElement } from "./button-
|
|
1
|
+
import { n as ButtonElementEventMap, t as ButtonElement } from "./button-CTL45aBl.js";
|
|
2
2
|
export { ButtonElement, ButtonElementEventMap };
|
package/dist/crumbs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as TreeSelectEvent, O as TreeTickleEvent, a as TreeComponent, k as TreeDataModel, n as TreeActivateEvent, o as TreeComponentEventMap, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-
|
|
2
|
-
import { n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-
|
|
1
|
+
import { E as TreeSelectEvent, O as TreeTickleEvent, a as TreeComponent, k as TreeDataModel, n as TreeActivateEvent, o as TreeComponentEventMap, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-Cj8V3uar.js";
|
|
2
|
+
import { n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-DQ7KOUIj.js";
|
|
3
3
|
import "./menu-item-B0zqw2xp.js";
|
|
4
4
|
import "./index-o-CWDt11.js";
|
|
5
5
|
import { LitElement, PropertyValues } from "lit";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./icon-DR_3rSyZ.js";
|
|
2
|
-
import { F as ListDragPreviewSourceResolver, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent } from "./tree-component-
|
|
2
|
+
import { F as ListDragPreviewSourceResolver, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent } from "./tree-component-Cj8V3uar.js";
|
|
3
3
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
4
|
-
import { S as ListSearchController } from "./index-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { S as ListSearchController } from "./index-CxZ61DO1.js";
|
|
5
|
+
import "./index-Dq30pOnn.js";
|
|
6
6
|
import "./pan-text-CoYmt2qd.js";
|
|
7
7
|
import { LitElement } from "lit";
|
|
8
8
|
import { CommandId, CommandRegistry } from "@clinth/ui-commands";
|
|
@@ -390,4 +390,4 @@ interface DataGridElement {
|
|
|
390
390
|
}
|
|
391
391
|
//#endregion
|
|
392
392
|
export { DataGridEditorFactory as A, GlobalFormatter as B, BuiltInFormatterName as C, DataGridDataType as D, DataGridColumnMenu as E, DataGridInteractionMode as F, DataGridRowLook as I, DataGridSelectionMode as L, DataGridGetRowKey as M, DataGridGroupBy as N, DataGridEditability as O, DataGridGroupLabel as P, DataGridSortDirection as R, DataGridViewportChangeEvent as S, DataGridColumn as T, DataGridSelectDetail as _, DataGridColumnReorderDetail as a, DataGridSortEvent as b, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridRowActivateEvent as g, DataGridRowActivateDetail as h, DataGridCellEditEvent as i, DataGridEditorType as j, DataGridEditorContext as k, DataGridColumnVisibilityDetail as l, DataGridGroupChangeEvent as m, DataGridCellClickEvent as n, DataGridColumnReorderEvent as o, DataGridGroupChangeDetail as p, DataGridCellEditDetail as r, DataGridColumnResizeDetail as s, DataGridCellClickDetail as t, DataGridColumnVisibilityEvent as u, DataGridSelectEvent as v, BuiltInFormatterOptions as w, DataGridViewportChangeDetail as x, DataGridSortDetail as y, DataGridSortState as z };
|
|
393
|
-
//# sourceMappingURL=data-grid-
|
|
393
|
+
//# sourceMappingURL=data-grid-Ck1Qx2H1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-
|
|
1
|
+
{"version":3,"file":"data-grid-Ck1Qx2H1.d.ts","names":[],"sources":["../src/data-grid/types.ts","../src/data-grid/data-grid.ts"],"mappings":";;;;;;;;;KAAY;KACA;KACA;KACA;WAA+B;WAAsB,WAAW;;KAChE;KACA;KAEA,sBAAsB;WACvB,KAAK;WACL,QAAQ,eAAe;WACvB;WACA;WACA;EACT,SAAS;EACT;;KAEU,sBAAsB,gBAAgB,KAAK,sBAAsB;KAEjE,eAAe;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU,GAAG,GAAG,GAAG;EACnB;EACA;EACA;EACA,YAAY,KAAK,GAAG,KAAK,eAAe,IAAI;EAC5C;EACA;EACA;EACA,WAAW;EACX,SAAS,qBAAqB,sBAAsB;EACpD,gBAAgB;IAAyB;IAAe;;EACxD,aAAa,gBAAgB,KAAK,GAAG,KAAK,eAAe;EACzD;IAA0B;;;KAGhB,mBAAmB,gBAAgB,oBAAoB;;;;;;;;;;;;KAavD;;EAEV;;EAEA;;EAEA;;E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ewRenderer, R as ListNativeDragStartEvent, j as ListDragEntry } from "./tree-component-
|
|
2
|
-
import { A as DataGridEditorFactory, B as GlobalFormatter, C as BuiltInFormatterName, D as DataGridDataType, E as DataGridColumnMenu, F as DataGridInteractionMode, I as DataGridRowLook, L as DataGridSelectionMode, M as DataGridGetRowKey, N as DataGridGroupBy, O as DataGridEditability, P as DataGridGroupLabel, R as DataGridSortDirection, S as DataGridViewportChangeEvent, T as DataGridColumn, _ as DataGridSelectDetail, a as DataGridColumnReorderDetail, b as DataGridSortEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridRowActivateEvent, h as DataGridRowActivateDetail, i as DataGridCellEditEvent, j as DataGridEditorType, k as DataGridEditorContext, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSelectEvent, w as BuiltInFormatterOptions, x as DataGridViewportChangeDetail, y as DataGridSortDetail, z as DataGridSortState } from "./data-grid-
|
|
1
|
+
import { I as ListDragSource, L as ListNativeDragStartDetail, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent, j as ListDragEntry } from "./tree-component-Cj8V3uar.js";
|
|
2
|
+
import { A as DataGridEditorFactory, B as GlobalFormatter, C as BuiltInFormatterName, D as DataGridDataType, E as DataGridColumnMenu, F as DataGridInteractionMode, I as DataGridRowLook, L as DataGridSelectionMode, M as DataGridGetRowKey, N as DataGridGroupBy, O as DataGridEditability, P as DataGridGroupLabel, R as DataGridSortDirection, S as DataGridViewportChangeEvent, T as DataGridColumn, _ as DataGridSelectDetail, a as DataGridColumnReorderDetail, b as DataGridSortEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridRowActivateEvent, h as DataGridRowActivateDetail, i as DataGridCellEditEvent, j as DataGridEditorType, k as DataGridEditorContext, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSelectEvent, w as BuiltInFormatterOptions, x as DataGridViewportChangeDetail, y as DataGridSortDetail, z as DataGridSortState } from "./data-grid-Ck1Qx2H1.js";
|
|
3
3
|
export { type BuiltInFormatterName, type BuiltInFormatterOptions, DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, type DataGridColumn, type DataGridColumnMenu, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, type DataGridDataType, type DataGridEditability, type DataGridEditorContext, type DataGridEditorFactory, type DataGridEditorType, DataGridElement, DataGridElementEventMap, type DataGridGetRowKey, type DataGridGroupBy, DataGridGroupChangeDetail, DataGridGroupChangeEvent, type DataGridGroupLabel, type DataGridInteractionMode, DataGridRowActivateDetail, DataGridRowActivateEvent, type DataGridRowLook, DataGridSelectDetail, DataGridSelectEvent, type DataGridSelectionMode, DataGridSortDetail, type DataGridSortDirection, DataGridSortEvent, type DataGridSortState, DataGridViewportChangeDetail, DataGridViewportChangeEvent, type GlobalFormatter, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListNativeDragStartDetail, type ListNativeDragStartEvent };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./icon-DR_3rSyZ.js";
|
|
2
2
|
import { r as IDataProvider } from "./data-provider-BAn_-oR1.js";
|
|
3
|
-
import { F as ListDragPreviewSourceResolver, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent } from "./tree-component-
|
|
3
|
+
import { F as ListDragPreviewSourceResolver, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent } from "./tree-component-Cj8V3uar.js";
|
|
4
4
|
import { n as ListViewportChangeEvent } from "./list-viewport-types-BRZsLcvp.js";
|
|
5
|
-
import { S as ListSearchController } from "./index-
|
|
5
|
+
import { S as ListSearchController } from "./index-CxZ61DO1.js";
|
|
6
6
|
import { a as ListGroupEventMap, o as ListGroupInfo, s as ListGroupLabel } from "./grouping-CUKgmkMm.js";
|
|
7
7
|
import { i as ListInteractionMode, l as ListSelectionMode, r as ListElementEventMap } from "./list-selection-types-PjKdhF-a.js";
|
|
8
|
-
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-
|
|
8
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-CqBc-t8w.js";
|
|
9
9
|
import "./list-group-header.js";
|
|
10
10
|
import { LitElement, PropertyValues } from "lit";
|
|
11
11
|
import { CommandId, CommandRegistry } from "@clinth/ui-commands";
|
|
@@ -252,4 +252,4 @@ interface DetailListElementEventMap extends ListElementEventMap, ListGroupEventM
|
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
254
|
export { DetailSortComparator as a, DetailGroupBy as i, DetailListElementEventMap as n, DetailSortItem as o, DetailFormatter as r, DetailSortMode as s, DetailListElement as t };
|
|
255
|
-
//# sourceMappingURL=detail-list-
|
|
255
|
+
//# sourceMappingURL=detail-list-C1xzr1z7.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detail-list-
|
|
1
|
+
{"version":3,"file":"detail-list-C1xzr1z7.d.ts","names":[],"sources":["../src/detail-list/types.ts","../src/detail-list/detail-list.ts"],"mappings":";;;;;;;;;;;;;KACY;;KAGA;WACD,SAAS;WACT;WACA;;;KAIC,wBAAwB,GAAG,gBAAgB,GAAG;;KAG9C,mBAAmB,eAAe,2BAA2B;;;;;;KAc7D,2BAA2B,eAAe,IAAI;;;;;;;;;;;;;;;;;;;;cCkI7C,0BAA0B;;EAErC,eAAe;E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EACtE,+BAA+B;EAC/B,0BAA0B,yBAAyB"}
|
package/dist/detail-list.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I as ListDragSource, L as ListNativeDragStartDetail, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent, j as ListDragEntry } from "./tree-component-
|
|
1
|
+
import { I as ListDragSource, L as ListNativeDragStartDetail, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent, j as ListDragEntry } from "./tree-component-Cj8V3uar.js";
|
|
2
2
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
3
3
|
import { i as ListGroupChangeEvent, l as ListGroupToggleDetail, n as ListGroupBy, o as ListGroupInfo, r as ListGroupChangeDetail, s as ListGroupLabel, u as ListGroupToggleEvent } from "./grouping-CUKgmkMm.js";
|
|
4
|
-
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-
|
|
5
|
-
import { a as DetailSortComparator, i as DetailGroupBy, n as DetailListElementEventMap, o as DetailSortItem, r as DetailFormatter, s as DetailSortMode, t as DetailListElement } from "./detail-list-
|
|
4
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-CqBc-t8w.js";
|
|
5
|
+
import { a as DetailSortComparator, i as DetailGroupBy, n as DetailListElementEventMap, o as DetailSortItem, r as DetailFormatter, s as DetailSortMode, t as DetailListElement } from "./detail-list-C1xzr1z7.js";
|
|
6
6
|
export { type AddItemOptions, type CustomCheckboxOptions, type DetailFormatter, type DetailGroupBy, DetailListElement, DetailListElementEventMap, type DetailSortComparator, type DetailSortItem, type DetailSortMode, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListGroupBy, type ListGroupChangeDetail, type ListGroupChangeEvent, type ListGroupInfo, type ListGroupLabel, type ListGroupToggleDetail, type ListGroupToggleEvent, type ListNativeDragStartDetail, type ListNativeDragStartEvent, type ListViewportChangeDetail, type ListViewportChangeEvent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable-label-rzXkjf1H.d.ts","names":[],"sources":["../src/editable-label/editable-label.ts"],"mappings":";;KAoCY;KACA;KACA;KAEA;WACD;;KAEC,2BAA2B,YAAY;cAGtC,sBAAsB;EACJ,MAAM;EACmB,WAAW;EACpC;EACe;EAChC;;EAG6B;;;;;;;;EASM,kBAAkB;;EAGV;;EAGG;;EAG1B,aAAa;;EAGb,aAAa;YAE1B;gBAEL,cAAc;;YAKlB;EAED;EAMA;YAQC;YACA;YACA;YACA;YAEA;UAOF;UAWA;YAOE;YAUA;;YAUA;YAWA;YAMA;YAMA;YAKA,iBAAkB,GAAG;YAgBrB,qBAAsB,GAAG;YAQzB;YAeA;YAMA;YAsBA;YAMA;YAcA;YAoBA,gBAAgB;UASlB;EAWC,wBAAM;EAgBN,QAAQ,SAAS;
|
|
1
|
+
{"version":3,"file":"editable-label-rzXkjf1H.d.ts","names":[],"sources":["../src/editable-label/editable-label.ts"],"mappings":";;KAoCY;KACA;KACA;KAEA;WACD;;KAEC,2BAA2B,YAAY;cAGtC,sBAAsB;EACJ,MAAM;EACmB,WAAW;EACpC;EACe;EAChC;;EAG6B;;;;;;;;EASM,kBAAkB;;EAGV;;EAGG;;EAG1B,aAAa;;EAGb,aAAa;YAE1B;gBAEL,cAAc;;YAKlB;EAED;EAMA;YAQC;YACA;YACA;YACA;YAEA;UAOF;UAWA;YAOE;YAUA;;YAUA;YAWA;YAMA;YAMA;YAKA,iBAAkB,GAAG;YAgBrB,qBAAsB,GAAG;YAQzB;YAeA;YAMA;YAsBA;YAMA;YAcA;YAoBA,gBAAgB;UASlB;EAWC,wBAAM;EAgBN,QAAQ,SAAS;SA4BV,QAAQ;;QA8FlB;YACI;IACR,uBAAuB"}
|
package/dist/editable-label.js
CHANGED
|
@@ -189,7 +189,7 @@ let EditableLabel = class EditableLabel extends LitElement {
|
|
|
189
189
|
@keydown=${this._handleKeydown}
|
|
190
190
|
@beforeinput=${this._handleBeforeInput}
|
|
191
191
|
@input=${this._handleInput}
|
|
192
|
-
|
|
192
|
+
></div>`;
|
|
193
193
|
}
|
|
194
194
|
updated(changed) {
|
|
195
195
|
super.updated(changed);
|
|
@@ -201,7 +201,7 @@ let EditableLabel = class EditableLabel extends LitElement {
|
|
|
201
201
|
_selectAll(el);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
if (changed.has(`displayTextLogic`) || changed.has(`displayText`) || changed.has(`formatter`) || changed.has(`value`)) this._requestDisplayUpdate();
|
|
204
|
+
if (changed.has(`_editing`) && !this._editing || changed.has(`displayTextLogic`) || changed.has(`displayText`) || changed.has(`formatter`) || changed.has(`value`)) this._requestDisplayUpdate();
|
|
205
205
|
}
|
|
206
206
|
static {
|
|
207
207
|
this.styles = [themeFallbacks, css`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable-label.js","names":["customElement"],"sources":["../src/editable-label/editable-label.ts"],"sourcesContent":["/**\n * <ixfx-editable-label> — inline editable text label.\n *\n * Two display modes:\n * label (default) — renders as plain text until clicked, then becomes an editable box.\n * editor — always renders as an editable box; becomes active on focus/click.\n *\n * Entry modes (filter characters as typed):\n * free (default) — no restrictions\n * text — alphabetical characters and spaces only\n * number — digits, decimal point, minus sign\n * percent — digits, decimal point, percent sign\n *\n * Properties (not attributes):\n * validator (value: string) => boolean — override commit validation; default uses entry-mode rules\n * formatter (value: string) => string — transform committed value for display\n *\n * Events:\n * input — CustomEvent<{ value: string }>, bubbles + composed; fired as value changes during editing\n * change — CustomEvent<{ value: string }>, bubbles + composed; fired when value is committed\n *\n * CSS variables:\n * --label-font-size defaults to var(--text-m, 12px)\n * --label-font-family defaults to var(--font-family, system-ui, sans-serif)\n * --label-color defaults to var(--surface-2-text)\n * --label-muted-color placeholder colour, defaults to var(--surface-muted-text)\n * --label-padding defaults to var(--space-xs, 3px) var(--space-s, 4px)\n * --label-radius defaults to var(--radius-s, 3px)\n * --label-align text alignment: left | center (default) | right\n */\nimport type { CSSResult, PropertyValues } from 'lit';\nimport { css, html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { themeFallbacks } from '../styles/fallbacks.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\n\nexport type EditableMode = `label` | `editor`;\nexport type EntryMode = `free` | `text` | `number` | `percent`;\nexport type DisplayTextLogic = `hidden` | `show` | `override` | `transient`;\n\nexport type EditableLabelChangeDetail = {\n readonly value: string;\n};\nexport type EditableLabelChangeEvent = CustomEvent<EditableLabelChangeDetail>;\n\n@customElement(`ixfx-editable-label`)\nexport class EditableLabel extends LitElement {\n @property({ reflect: true }) mode: EditableMode = `label`;\n @property({ attribute: `entry-mode`, reflect: true }) entryMode: EntryMode = `free`;\n @property({ reflect: true }) value = ``;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property() placeholder = ``;\n\n /** Override displayed text. Bypasses formatter and value. When editing, shows raw value. */\n @property({ attribute: `display-text` }) displayText?: string;\n\n /**\n * Controls when displayText is shown:\n * - 'hidden' (default): never use displayText\n * - 'show': show displayText instead of formatted value, but hide while editing; revert after disappearDelay\n * - 'override': always show displayText, even when editing\n * - 'transient': show displayText by default, switch to formatted value after appearDelay on hover/interaction; revert after disappearDelay\n */\n @property({ attribute: `display-text-logic` }) displayTextLogic: DisplayTextLogic = `hidden`;\n\n /** Delay before showing value in transient mode (ms). Default: 50 */\n @property({ type: Number, attribute: `appear-delay` }) appearDelay = 50;\n\n /** Delay before reverting to displayText after editing ends (ms). Default: 1000 */\n @property({ type: Number, attribute: `disappear-delay` }) disappearDelay = 1000;\n\n /** Override commit validation. Return true to accept, false to reject (reverts). */\n @property({ attribute: false }) validator?: (value: string) => boolean;\n\n /** Transform the committed value for display. Does not affect the stored value. */\n @property({ attribute: false }) formatter?: (value: string) => string;\n\n @state() protected _editing = false;\n\n protected get _contentEl(): HTMLElement | undefined {\n return this.renderRoot?.querySelector<HTMLElement>(`.content`) ?? undefined;\n }\n\n /** Snapshot of value taken when editing begins; restored on cancel. */\n protected _prevValue = ``;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(`mouseenter`, this._onMouseEnter);\n this.addEventListener(`mouseleave`, this._onMouseLeave);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener(`mouseenter`, this._onMouseEnter);\n this.removeEventListener(`mouseleave`, this._onMouseLeave);\n this._clearTransientTimer();\n }\n\n // ── Transient display state ─────────────────────────────────────────────────\n protected _hovering = false;\n protected _transientShowingValue = false;\n protected _transientTimer: number | undefined = undefined;\n protected _showModeWaitingToHide = false;\n\n protected _clearTransientTimer(): void {\n if (this._transientTimer !== undefined) {\n clearTimeout(this._transientTimer);\n this._transientTimer = undefined;\n }\n }\n\n private _onMouseEnter = (): void => {\n if (this.displayTextLogic !== `transient`)\n return;\n this._hovering = true;\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n this._transientShowingValue = true;\n this._requestDisplayUpdate();\n }, this.appearDelay);\n };\n\n private _onMouseLeave = (): void => {\n if (this.displayTextLogic !== `transient`)\n return;\n this._hovering = false;\n this._startTransientRevertTimer();\n };\n\n protected _startTransientRevertTimer(): void {\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n if (!this._hovering && this.displayTextLogic === `transient`) {\n this._transientShowingValue = false;\n this._requestDisplayUpdate();\n }\n }, this.disappearDelay);\n }\n\n protected _requestDisplayUpdate(): void {\n if (!this._editing) {\n const el = this._contentEl;\n if (el) {\n el.textContent = this._getDisplayText();\n }\n }\n }\n\n /** Called by subclasses when user interacts (drag, keyboard, etc) to temporarily show value in transient mode */\n protected _onUserInteraction(): void {\n if (this.displayTextLogic !== `transient`)\n return;\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n this._transientShowingValue = true;\n this._startTransientRevertTimer();\n this._requestDisplayUpdate();\n }, this.appearDelay);\n };\n\n protected _handleClick = (): void => {\n if (this.mode === `label` && !this.disabled && !this._editing) {\n this._beginEdit();\n }\n };\n\n protected _handleFocus = (): void => {\n if (this.mode === `editor` && !this.disabled && !this._editing) {\n this._beginEdit();\n }\n };\n\n protected _handleBlur = (): void => {\n if (this._editing)\n this._tryCommit();\n };\n\n protected _handleKeydown = (e: KeyboardEvent): void => {\n if (!this._editing)\n return;\n if (e.key === `Enter`) {\n e.preventDefault();\n this._tryCommit();\n if (this.mode === `editor`)\n this._contentEl?.blur();\n } else if (e.key === `Escape`) {\n e.preventDefault();\n this._cancelEdit();\n if (this.mode === `editor`)\n this._contentEl?.blur();\n }\n };\n\n protected _handleBeforeInput = (e: InputEvent): void => {\n if (e.inputType !== `insertText` || !e.data)\n return;\n if (!this._isAllowedInput(e.data)) {\n e.preventDefault();\n }\n };\n\n protected _handleInput = (): void => {\n if (!this._editing)\n return;\n\n const raw = this._contentEl?.textContent?.trim() ?? ``;\n\n this.dispatchEvent(new CustomEvent<EditableLabelChangeDetail>(`input`, {\n detail: { value: raw },\n bubbles: true,\n composed: true,\n }));\n };\n\n // ── Core logic ───────────────────────────────────────────────────────────\n\n protected _beginEdit(): void {\n this._prevValue = this.value;\n this._editing = true;\n this.removeAttribute(`invalid`);\n }\n\n protected _tryCommit(): void {\n let raw = this._contentEl?.textContent?.trim() ?? ``;\n if (this.entryMode === `percent`)\n raw = raw.replaceAll(`%`, ``).trim();\n const validate = this.validator ?? this._defaultValidator.bind(this);\n if (validate(raw)) {\n this.removeAttribute(`invalid`);\n const prev = this.value;\n this.value = raw;\n this._editing = false;\n if (raw !== prev) {\n this.dispatchEvent(new CustomEvent<EditableLabelChangeDetail>(`change`, {\n detail: { value: raw },\n bubbles: true,\n composed: true,\n }));\n }\n } else {\n this._cancelEdit();\n }\n }\n\n protected _cancelEdit(): void {\n this.value = this._prevValue;\n this._editing = false;\n this.removeAttribute(`invalid`);\n }\n\n protected _getDisplayText(): string {\n const useDisplayText = this._shouldUseDisplayText();\n if (useDisplayText && this.displayText !== undefined && this.displayText !== ``) {\n return this.displayText;\n }\n if (!this.value)\n return ``;\n if (this.formatter)\n return this.formatter(this.value);\n if (this.entryMode === `percent`)\n return `${this.value}%`;\n return this.value;\n }\n\n protected _shouldUseDisplayText(): boolean {\n if (this.displayTextLogic === `hidden`)\n return false;\n if (this.displayTextLogic === `override`)\n return true;\n if (this.displayTextLogic === `show`) {\n if (this._editing)\n return false;\n return this._showModeWaitingToHide;\n }\n if (this.displayTextLogic === `transient`) {\n if (this._editing)\n return false;\n if (this._transientShowingValue)\n return false;\n return true;\n }\n return false;\n }\n\n protected _isAllowedInput(char: string): boolean {\n switch (this.entryMode) {\n case `text`: return /^[a-z\\s]$/i.test(char);\n case `number`: return /^[\\d.\\-]$/.test(char);\n case `percent`: return /^[\\d.%]$/.test(char);\n default: return true;\n }\n }\n\n private _defaultValidator(value: string): boolean {\n switch (this.entryMode) {\n case `text`: return /^[a-z\\s]*$/i.test(value);\n case `number`: return value === `` || /^-?\\d*(?:\\.\\d*)?$/.test(value);\n case `percent`: return value === `` || /^\\d*(?:\\.\\d*)?$/.test(value);\n default: return true;\n } // asdf\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n override render() {\n const isEditor = this.mode === `editor`;\n return html`<div\n class=\"content\"\n contenteditable=${this._editing ? `plaintext-only` : `false`}\n data-placeholder=${this.placeholder}\n tabindex=${isEditor && !this._editing ? `0` : nothing}\n @click=${this._handleClick}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n @keydown=${this._handleKeydown}\n @beforeinput=${this._handleBeforeInput}\n @input=${this._handleInput}\n >${this._editing ? nothing : this._getDisplayText()}</div>`;\n }\n\n override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has(`_editing`) && this._editing) {\n const el = this._contentEl;\n if (el) {\n el.textContent = this.value;\n el.focus();\n _selectAll(el);\n }\n }\n // The text content is managed imperatively (see _requestDisplayUpdate), so\n // a re-render alone does not refresh it. Refresh when display-affecting\n // properties change — e.g. a labelled wrapper toggling displayTextLogic\n // while its slider is dragged. _requestDisplayUpdate() no-ops while editing.\n if (\n changed.has(`displayTextLogic`)\n || changed.has(`displayText`)\n || changed.has(`formatter`)\n || changed.has(`value`)\n ) {\n this._requestDisplayUpdate();\n }\n }\n\n // ── Styles ───────────────────────────────────────────────────────────────\n\n static override styles: CSSResult[] = [themeFallbacks, css`\n :host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n --_font-size: var(--label-font-size, var(--text-m, 12px));\n --_font-family: var(--label-font-family, var(--font-family, system-ui, sans-serif));\n --_color: var(--label-color, var(--surface-2-text));\n --_muted: var(--label-muted-color, var(--surface-muted-text, oklch(55% 0.02 240)));\n --_padding: var(--label-padding, var(--space-xs, 3px) var(--space-s, 4px));\n --_radius: var(--label-radius, var(--radius-s, 3px));\n --_align: var(--label-align, center);\n --_min-width: var(--label-min-width, 1ch);\n }\n\n .content {\n box-sizing: border-box;\n width: 100%;\n text-align: var(--_align);\n outline: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: var(--_min-width);\n font-family: var(--_font-family);\n font-size: var(--_font-size);\n color: var(--_color);\n padding: var(--_padding);\n border: 1px solid transparent;\n border-radius: var(--_radius);\n cursor: pointer;\n transition:\n background var(--transition, 0.15s ease-out),\n border-color var(--transition, 0.15s ease-out);\n }\n\n /* Remove overflow clipping while editing so the cursor is never hidden */\n .content[contenteditable=\"plaintext-only\"] {\n overflow: visible;\n text-overflow: clip;\n }\n\n /* ── Label mode ── */\n :host([mode=\"label\"]) .content {\n background: transparent;\n }\n\n :host([mode=\"label\"]) .content[contenteditable=\"plaintext-only\"] {\n background: var(--surface-4, oklch(22% 0.02 240));\n border: var(--border, 1px solid oklch(25% 0.02 240));\n cursor: text;\n }\n\n /* ── Editor mode — always shows box ── */\n :host([mode=\"editor\"]) .content {\n background: var(--surface-4, oklch(22% 0.02 240));\n border: var(--border, 1px solid oklch(25% 0.02 240));\n }\n\n :host([mode=\"editor\"]) .content[contenteditable=\"plaintext-only\"] {\n border-color: var(--accent, oklch(60% 0.15 140));\n cursor: text;\n }\n\n /* ── Placeholder ── */\n .content:empty::before {\n content: attr(data-placeholder);\n color: var(--_muted);\n pointer-events: none;\n }\n\n /* ── Invalid ── */\n :host([invalid]) .content {\n border-color: var(--error, oklch(60% 0.15 20));\n }\n\n /* ── Disabled ── */\n :host([disabled]) .content {\n opacity: var(--disabled-opacity, 0.5);\n cursor: not-allowed;\n pointer-events: none;\n }\n `];\n}\n\nfunction _selectAll(el: HTMLElement): void {\n const range = document.createRange();\n range.selectNodeContents(el);\n const sel = window.getSelection();\n sel?.removeAllRanges();\n sel?.addRange(range);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-editable-label': EditableLabel;\n }\n}\n"],"mappings":";;;;;AA8CO,IAAM,gBAAN,MAAM,sBAAsB,WAAW;;;EACM,KAAA,OAAA;EAC2B,KAAA,YAAA;EACxC,KAAA,QAAA;EACkB,KAAA,WAAA;EAC7B,KAAA,cAAA;EAY0D,KAAA,mBAAA;EAGf,KAAA,cAAA;EAGM,KAAA,iBAAA;EAQ7C,KAAA,WAAA;EAOP,KAAA,aAAA;EAgBD,KAAA,YAAA;EACa,KAAA,yBAAA;EACa,KAAA,kBAAA,KAAA;EACb,KAAA,yBAAA;EASC,KAAA,sBAAA;GAClC,IAAI,KAAK,qBAAqB,aAC5B;GACF,KAAK,YAAY;GACjB,KAAK,qBAAqB;GAC1B,KAAK,kBAAkB,OAAO,iBAAiB;IAC7C,KAAK,yBAAyB;IAC9B,KAAK,sBAAsB;GAC7B,GAAG,KAAK,WAAW;EACrB;EAEoC,KAAA,sBAAA;GAClC,IAAI,KAAK,qBAAqB,aAC5B;GACF,KAAK,YAAY;GACjB,KAAK,2BAA2B;EAClC;EAiCqC,KAAA,qBAAA;GACnC,IAAI,KAAK,SAAS,WAAW,CAAC,KAAK,YAAY,CAAC,KAAK,UACnD,KAAK,WAAW;EAEpB;EAEqC,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,CAAA,SAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAA,cAAA,WAAA,eAAA,KAAA,CAAA;AAGpD,WAAA,CAAA,SAAS;CAAE,MAAM;CAAQ,WAAW;AAAkB,CAAC,CAAA,GAAA,cAAA,WAAA,kBAAA,KAAA,CAAA;AAGvD,WAAA,CAAA,SAAS,EAAE,WAAW,MAAM,CAAC,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAG7B,WAAA,CAAA,SAAS,EAAE,WAAW,MAAM,CAAC,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAE7B,WAAA,CAAA,MAAM,CAAA,GAAA,cAAA,WAAA,YAAA,KAAA,CAAA;AAhCRA,gBAAAA,WAAAA,CAAAA,kBAAc,qBAAqB,CAAA,GAAA,aAAA;AAoYpC,SAAS,WAAW,IAAuB;CACzC,MAAM,QAAQ,SAAS,YAAY;CACnC,MAAM,mBAAmB,EAAE;CAC3B,MAAM,MAAM,OAAO,aAAa;CAChC,KAAK,gBAAgB;CACrB,KAAK,SAAS,KAAK;AACrB"}
|
|
1
|
+
{"version":3,"file":"editable-label.js","names":["customElement"],"sources":["../src/editable-label/editable-label.ts"],"sourcesContent":["/**\n * <ixfx-editable-label> — inline editable text label.\n *\n * Two display modes:\n * label (default) — renders as plain text until clicked, then becomes an editable box.\n * editor — always renders as an editable box; becomes active on focus/click.\n *\n * Entry modes (filter characters as typed):\n * free (default) — no restrictions\n * text — alphabetical characters and spaces only\n * number — digits, decimal point, minus sign\n * percent — digits, decimal point, percent sign\n *\n * Properties (not attributes):\n * validator (value: string) => boolean — override commit validation; default uses entry-mode rules\n * formatter (value: string) => string — transform committed value for display\n *\n * Events:\n * input — CustomEvent<{ value: string }>, bubbles + composed; fired as value changes during editing\n * change — CustomEvent<{ value: string }>, bubbles + composed; fired when value is committed\n *\n * CSS variables:\n * --label-font-size defaults to var(--text-m, 12px)\n * --label-font-family defaults to var(--font-family, system-ui, sans-serif)\n * --label-color defaults to var(--surface-2-text)\n * --label-muted-color placeholder colour, defaults to var(--surface-muted-text)\n * --label-padding defaults to var(--space-xs, 3px) var(--space-s, 4px)\n * --label-radius defaults to var(--radius-s, 3px)\n * --label-align text alignment: left | center (default) | right\n */\nimport type { CSSResult, PropertyValues } from 'lit';\nimport { css, html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { themeFallbacks } from '../styles/fallbacks.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\n\nexport type EditableMode = `label` | `editor`;\nexport type EntryMode = `free` | `text` | `number` | `percent`;\nexport type DisplayTextLogic = `hidden` | `show` | `override` | `transient`;\n\nexport type EditableLabelChangeDetail = {\n readonly value: string;\n};\nexport type EditableLabelChangeEvent = CustomEvent<EditableLabelChangeDetail>;\n\n@customElement(`ixfx-editable-label`)\nexport class EditableLabel extends LitElement {\n @property({ reflect: true }) mode: EditableMode = `label`;\n @property({ attribute: `entry-mode`, reflect: true }) entryMode: EntryMode = `free`;\n @property({ reflect: true }) value = ``;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property() placeholder = ``;\n\n /** Override displayed text. Bypasses formatter and value. When editing, shows raw value. */\n @property({ attribute: `display-text` }) displayText?: string;\n\n /**\n * Controls when displayText is shown:\n * - 'hidden' (default): never use displayText\n * - 'show': show displayText instead of formatted value, but hide while editing; revert after disappearDelay\n * - 'override': always show displayText, even when editing\n * - 'transient': show displayText by default, switch to formatted value after appearDelay on hover/interaction; revert after disappearDelay\n */\n @property({ attribute: `display-text-logic` }) displayTextLogic: DisplayTextLogic = `hidden`;\n\n /** Delay before showing value in transient mode (ms). Default: 50 */\n @property({ type: Number, attribute: `appear-delay` }) appearDelay = 50;\n\n /** Delay before reverting to displayText after editing ends (ms). Default: 1000 */\n @property({ type: Number, attribute: `disappear-delay` }) disappearDelay = 1000;\n\n /** Override commit validation. Return true to accept, false to reject (reverts). */\n @property({ attribute: false }) validator?: (value: string) => boolean;\n\n /** Transform the committed value for display. Does not affect the stored value. */\n @property({ attribute: false }) formatter?: (value: string) => string;\n\n @state() protected _editing = false;\n\n protected get _contentEl(): HTMLElement | undefined {\n return this.renderRoot?.querySelector<HTMLElement>(`.content`) ?? undefined;\n }\n\n /** Snapshot of value taken when editing begins; restored on cancel. */\n protected _prevValue = ``;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(`mouseenter`, this._onMouseEnter);\n this.addEventListener(`mouseleave`, this._onMouseLeave);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener(`mouseenter`, this._onMouseEnter);\n this.removeEventListener(`mouseleave`, this._onMouseLeave);\n this._clearTransientTimer();\n }\n\n // ── Transient display state ─────────────────────────────────────────────────\n protected _hovering = false;\n protected _transientShowingValue = false;\n protected _transientTimer: number | undefined = undefined;\n protected _showModeWaitingToHide = false;\n\n protected _clearTransientTimer(): void {\n if (this._transientTimer !== undefined) {\n clearTimeout(this._transientTimer);\n this._transientTimer = undefined;\n }\n }\n\n private _onMouseEnter = (): void => {\n if (this.displayTextLogic !== `transient`)\n return;\n this._hovering = true;\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n this._transientShowingValue = true;\n this._requestDisplayUpdate();\n }, this.appearDelay);\n };\n\n private _onMouseLeave = (): void => {\n if (this.displayTextLogic !== `transient`)\n return;\n this._hovering = false;\n this._startTransientRevertTimer();\n };\n\n protected _startTransientRevertTimer(): void {\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n if (!this._hovering && this.displayTextLogic === `transient`) {\n this._transientShowingValue = false;\n this._requestDisplayUpdate();\n }\n }, this.disappearDelay);\n }\n\n protected _requestDisplayUpdate(): void {\n if (!this._editing) {\n const el = this._contentEl;\n if (el) {\n el.textContent = this._getDisplayText();\n }\n }\n }\n\n /** Called by subclasses when user interacts (drag, keyboard, etc) to temporarily show value in transient mode */\n protected _onUserInteraction(): void {\n if (this.displayTextLogic !== `transient`)\n return;\n this._clearTransientTimer();\n this._transientTimer = window.setTimeout(() => {\n this._transientShowingValue = true;\n this._startTransientRevertTimer();\n this._requestDisplayUpdate();\n }, this.appearDelay);\n };\n\n protected _handleClick = (): void => {\n if (this.mode === `label` && !this.disabled && !this._editing) {\n this._beginEdit();\n }\n };\n\n protected _handleFocus = (): void => {\n if (this.mode === `editor` && !this.disabled && !this._editing) {\n this._beginEdit();\n }\n };\n\n protected _handleBlur = (): void => {\n if (this._editing)\n this._tryCommit();\n };\n\n protected _handleKeydown = (e: KeyboardEvent): void => {\n if (!this._editing)\n return;\n if (e.key === `Enter`) {\n e.preventDefault();\n this._tryCommit();\n if (this.mode === `editor`)\n this._contentEl?.blur();\n } else if (e.key === `Escape`) {\n e.preventDefault();\n this._cancelEdit();\n if (this.mode === `editor`)\n this._contentEl?.blur();\n }\n };\n\n protected _handleBeforeInput = (e: InputEvent): void => {\n if (e.inputType !== `insertText` || !e.data)\n return;\n if (!this._isAllowedInput(e.data)) {\n e.preventDefault();\n }\n };\n\n protected _handleInput = (): void => {\n if (!this._editing)\n return;\n\n const raw = this._contentEl?.textContent?.trim() ?? ``;\n\n this.dispatchEvent(new CustomEvent<EditableLabelChangeDetail>(`input`, {\n detail: { value: raw },\n bubbles: true,\n composed: true,\n }));\n };\n\n // ── Core logic ───────────────────────────────────────────────────────────\n\n protected _beginEdit(): void {\n this._prevValue = this.value;\n this._editing = true;\n this.removeAttribute(`invalid`);\n }\n\n protected _tryCommit(): void {\n let raw = this._contentEl?.textContent?.trim() ?? ``;\n if (this.entryMode === `percent`)\n raw = raw.replaceAll(`%`, ``).trim();\n const validate = this.validator ?? this._defaultValidator.bind(this);\n if (validate(raw)) {\n this.removeAttribute(`invalid`);\n const prev = this.value;\n this.value = raw;\n this._editing = false;\n if (raw !== prev) {\n this.dispatchEvent(new CustomEvent<EditableLabelChangeDetail>(`change`, {\n detail: { value: raw },\n bubbles: true,\n composed: true,\n }));\n }\n } else {\n this._cancelEdit();\n }\n }\n\n protected _cancelEdit(): void {\n this.value = this._prevValue;\n this._editing = false;\n this.removeAttribute(`invalid`);\n }\n\n protected _getDisplayText(): string {\n const useDisplayText = this._shouldUseDisplayText();\n if (useDisplayText && this.displayText !== undefined && this.displayText !== ``) {\n return this.displayText;\n }\n if (!this.value)\n return ``;\n if (this.formatter)\n return this.formatter(this.value);\n if (this.entryMode === `percent`)\n return `${this.value}%`;\n return this.value;\n }\n\n protected _shouldUseDisplayText(): boolean {\n if (this.displayTextLogic === `hidden`)\n return false;\n if (this.displayTextLogic === `override`)\n return true;\n if (this.displayTextLogic === `show`) {\n if (this._editing)\n return false;\n return this._showModeWaitingToHide;\n }\n if (this.displayTextLogic === `transient`) {\n if (this._editing)\n return false;\n if (this._transientShowingValue)\n return false;\n return true;\n }\n return false;\n }\n\n protected _isAllowedInput(char: string): boolean {\n switch (this.entryMode) {\n case `text`: return /^[a-z\\s]$/i.test(char);\n case `number`: return /^[\\d.\\-]$/.test(char);\n case `percent`: return /^[\\d.%]$/.test(char);\n default: return true;\n }\n }\n\n private _defaultValidator(value: string): boolean {\n switch (this.entryMode) {\n case `text`: return /^[a-z\\s]*$/i.test(value);\n case `number`: return value === `` || /^-?\\d*(?:\\.\\d*)?$/.test(value);\n case `percent`: return value === `` || /^\\d*(?:\\.\\d*)?$/.test(value);\n default: return true;\n } // asdf\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n override render() {\n const isEditor = this.mode === `editor`;\n return html`<div\n class=\"content\"\n contenteditable=${this._editing ? `plaintext-only` : `false`}\n data-placeholder=${this.placeholder}\n tabindex=${isEditor && !this._editing ? `0` : nothing}\n @click=${this._handleClick}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n @keydown=${this._handleKeydown}\n @beforeinput=${this._handleBeforeInput}\n @input=${this._handleInput}\n ></div>`;\n }\n\n override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has(`_editing`) && this._editing) {\n const el = this._contentEl;\n if (el) {\n el.textContent = this.value;\n el.focus();\n _selectAll(el);\n }\n }\n // The text is never a Lit binding — `el.textContent = …` above would delete its\n // marker nodes and break the next render. It is managed imperatively (see _requestDisplayUpdate), so\n // a re-render alone does not refresh it. Refresh when display-affecting\n // properties change — e.g. a labelled wrapper toggling displayTextLogic\n // while its slider is dragged. _requestDisplayUpdate() no-ops while editing.\n if (\n (changed.has(`_editing`) && !this._editing)\n || changed.has(`displayTextLogic`)\n || changed.has(`displayText`)\n || changed.has(`formatter`)\n || changed.has(`value`)\n ) {\n this._requestDisplayUpdate();\n }\n }\n\n // ── Styles ───────────────────────────────────────────────────────────────\n\n static override styles: CSSResult[] = [themeFallbacks, css`\n :host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n --_font-size: var(--label-font-size, var(--text-m, 12px));\n --_font-family: var(--label-font-family, var(--font-family, system-ui, sans-serif));\n --_color: var(--label-color, var(--surface-2-text));\n --_muted: var(--label-muted-color, var(--surface-muted-text, oklch(55% 0.02 240)));\n --_padding: var(--label-padding, var(--space-xs, 3px) var(--space-s, 4px));\n --_radius: var(--label-radius, var(--radius-s, 3px));\n --_align: var(--label-align, center);\n --_min-width: var(--label-min-width, 1ch);\n }\n\n .content {\n box-sizing: border-box;\n width: 100%;\n text-align: var(--_align);\n outline: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: var(--_min-width);\n font-family: var(--_font-family);\n font-size: var(--_font-size);\n color: var(--_color);\n padding: var(--_padding);\n border: 1px solid transparent;\n border-radius: var(--_radius);\n cursor: pointer;\n transition:\n background var(--transition, 0.15s ease-out),\n border-color var(--transition, 0.15s ease-out);\n }\n\n /* Remove overflow clipping while editing so the cursor is never hidden */\n .content[contenteditable=\"plaintext-only\"] {\n overflow: visible;\n text-overflow: clip;\n }\n\n /* ── Label mode ── */\n :host([mode=\"label\"]) .content {\n background: transparent;\n }\n\n :host([mode=\"label\"]) .content[contenteditable=\"plaintext-only\"] {\n background: var(--surface-4, oklch(22% 0.02 240));\n border: var(--border, 1px solid oklch(25% 0.02 240));\n cursor: text;\n }\n\n /* ── Editor mode — always shows box ── */\n :host([mode=\"editor\"]) .content {\n background: var(--surface-4, oklch(22% 0.02 240));\n border: var(--border, 1px solid oklch(25% 0.02 240));\n }\n\n :host([mode=\"editor\"]) .content[contenteditable=\"plaintext-only\"] {\n border-color: var(--accent, oklch(60% 0.15 140));\n cursor: text;\n }\n\n /* ── Placeholder ── */\n .content:empty::before {\n content: attr(data-placeholder);\n color: var(--_muted);\n pointer-events: none;\n }\n\n /* ── Invalid ── */\n :host([invalid]) .content {\n border-color: var(--error, oklch(60% 0.15 20));\n }\n\n /* ── Disabled ── */\n :host([disabled]) .content {\n opacity: var(--disabled-opacity, 0.5);\n cursor: not-allowed;\n pointer-events: none;\n }\n `];\n}\n\nfunction _selectAll(el: HTMLElement): void {\n const range = document.createRange();\n range.selectNodeContents(el);\n const sel = window.getSelection();\n sel?.removeAllRanges();\n sel?.addRange(range);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-editable-label': EditableLabel;\n }\n}\n"],"mappings":";;;;;AA8CO,IAAM,gBAAN,MAAM,sBAAsB,WAAW;;;EACM,KAAA,OAAA;EAC2B,KAAA,YAAA;EACxC,KAAA,QAAA;EACkB,KAAA,WAAA;EAC7B,KAAA,cAAA;EAY0D,KAAA,mBAAA;EAGf,KAAA,cAAA;EAGM,KAAA,iBAAA;EAQ7C,KAAA,WAAA;EAOP,KAAA,aAAA;EAgBD,KAAA,YAAA;EACa,KAAA,yBAAA;EACa,KAAA,kBAAA,KAAA;EACb,KAAA,yBAAA;EASC,KAAA,sBAAA;GAClC,IAAI,KAAK,qBAAqB,aAC5B;GACF,KAAK,YAAY;GACjB,KAAK,qBAAqB;GAC1B,KAAK,kBAAkB,OAAO,iBAAiB;IAC7C,KAAK,yBAAyB;IAC9B,KAAK,sBAAsB;GAC7B,GAAG,KAAK,WAAW;EACrB;EAEoC,KAAA,sBAAA;GAClC,IAAI,KAAK,qBAAqB,aAC5B;GACF,KAAK,YAAY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,GAAA,cAAA,WAAA,eAAA,KAAA,CAAA;AAStC,WAAA,CAAA,SAAS,EAAE,WAAW,qBAAqB,CAAC,CAAA,GAAA,cAAA,WAAA,oBAAA,KAAA,CAAA;AAG5C,WAAA,CAAA,SAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAA,cAAA,WAAA,eAAA,KAAA,CAAA;AAGpD,WAAA,CAAA,SAAS;CAAE,MAAM;CAAQ,WAAW;AAAkB,CAAC,CAAA,GAAA,cAAA,WAAA,kBAAA,KAAA,CAAA;AAGvD,WAAA,CAAA,SAAS,EAAE,WAAW,MAAM,CAAC,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAG7B,WAAA,CAAA,SAAS,EAAE,WAAW,MAAM,CAAC,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAE7B,WAAA,CAAA,MAAM,CAAA,GAAA,cAAA,WAAA,YAAA,KAAA,CAAA;AAhCRA,gBAAAA,WAAAA,CAAAA,kBAAc,qBAAqB,CAAA,GAAA,aAAA;AAsYpC,SAAS,WAAW,IAAuB;CACzC,MAAM,QAAQ,SAAS,YAAY;CACnC,MAAM,mBAAmB,EAAE;CAC3B,MAAM,MAAM,OAAO,aAAa;CAChC,KAAK,gBAAgB;CACrB,KAAK,SAAS,KAAK;AACrB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./icon-DR_3rSyZ.js";
|
|
2
|
-
import { k as TreeDataModel } from "./tree-component-
|
|
3
|
-
import { o as TreeNode, r as TreeFilterPredicate, t as LoadChildrenCallback } from "./types-
|
|
2
|
+
import { k as TreeDataModel } from "./tree-component-Cj8V3uar.js";
|
|
3
|
+
import { o as TreeNode, r as TreeFilterPredicate, t as LoadChildrenCallback } from "./types-DQ7KOUIj.js";
|
|
4
4
|
import "./crumbs.js";
|
|
5
5
|
import { i as ListInteractionMode, l as ListSelectionMode } from "./list-selection-types-PjKdhF-a.js";
|
|
6
|
-
import { r as VerticalListElement } from "./vertical-list-
|
|
6
|
+
import { r as VerticalListElement } from "./vertical-list-CqBc-t8w.js";
|
|
7
7
|
import { LitElement, PropertyValues } from "lit";
|
|
8
8
|
//#region src/flat-list/types.d.ts
|
|
9
9
|
/** How branches and leaves are ordered within one level. */
|
|
@@ -26,13 +26,41 @@ type FlatListSelectDetail = {
|
|
|
26
26
|
type FlatListActivateDetail = {
|
|
27
27
|
readonly node: TreeNode;
|
|
28
28
|
};
|
|
29
|
+
type FlatListDropDetail = {
|
|
30
|
+
/** The row dropped on — a branch is *not* entered — or the current level's node for empty space. */
|
|
31
|
+
readonly node: TreeNode;
|
|
32
|
+
readonly dataTransfer: DataTransfer;
|
|
33
|
+
};
|
|
34
|
+
type FlatListContextMenuDetail = {
|
|
35
|
+
/** The row the menu was requested on (already selected). */
|
|
36
|
+
readonly node: TreeNode;
|
|
37
|
+
/** The whole selection, `node` included. */
|
|
38
|
+
readonly nodes: readonly TreeNode[];
|
|
39
|
+
readonly x: number;
|
|
40
|
+
readonly y: number;
|
|
41
|
+
};
|
|
42
|
+
type FlatListEditCommitDetail = {
|
|
43
|
+
readonly node: TreeNode;
|
|
44
|
+
readonly value: string;
|
|
45
|
+
};
|
|
46
|
+
type FlatListEditCancelDetail = {
|
|
47
|
+
readonly node: TreeNode;
|
|
48
|
+
};
|
|
29
49
|
type FlatListNavigateEvent = CustomEvent<FlatListNavigateDetail>;
|
|
30
50
|
type FlatListSelectEvent = CustomEvent<FlatListSelectDetail>;
|
|
31
51
|
type FlatListActivateEvent = CustomEvent<FlatListActivateDetail>;
|
|
52
|
+
type FlatListDropEvent = CustomEvent<FlatListDropDetail>;
|
|
53
|
+
type FlatListContextMenuEvent = CustomEvent<FlatListContextMenuDetail>;
|
|
54
|
+
type FlatListEditCommitEvent = CustomEvent<FlatListEditCommitDetail>;
|
|
55
|
+
type FlatListEditCancelEvent = CustomEvent<FlatListEditCancelDetail>;
|
|
32
56
|
interface FlatListElementEventMap {
|
|
33
57
|
'flat-list-navigate': FlatListNavigateEvent;
|
|
34
58
|
'flat-list-select': FlatListSelectEvent;
|
|
35
59
|
'flat-list-activate': FlatListActivateEvent;
|
|
60
|
+
'flat-list-drop': FlatListDropEvent;
|
|
61
|
+
'flat-list-context-menu': FlatListContextMenuEvent;
|
|
62
|
+
'flat-list-edit-commit': FlatListEditCommitEvent;
|
|
63
|
+
'flat-list-edit-cancel': FlatListEditCancelEvent;
|
|
36
64
|
}
|
|
37
65
|
//#endregion
|
|
38
66
|
//#region src/flat-list/flat-list.d.ts
|
|
@@ -64,6 +92,7 @@ interface FlatListElementEventMap {
|
|
|
64
92
|
* --flat-list-crumb-padding: var(--space-xs);
|
|
65
93
|
* --flat-list-crumb-font-size: var(--text-s);
|
|
66
94
|
* --flat-list-chevron-gap: 0.4em; // space after the branch chevron
|
|
95
|
+
* --flat-list-marked-bg / --flat-list-marked-bar: the `marked-key` row
|
|
67
96
|
* --flat-list-empty-text: var(--surface-muted-text);
|
|
68
97
|
*/
|
|
69
98
|
declare class FlatListElement extends LitElement {
|
|
@@ -83,6 +112,25 @@ declare class FlatListElement extends LitElement {
|
|
|
83
112
|
itemWrap: `stop` | `wrap`;
|
|
84
113
|
searchModes: string | undefined;
|
|
85
114
|
itemsDraggable: boolean;
|
|
115
|
+
/** Rows (and empty space) accept native drops. See `flat-list-drop`. */
|
|
116
|
+
itemsDroppable: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Refuse a drop before it is highlighted or reported. `node` is the row under
|
|
119
|
+
* the drag, or the current level's node over empty space.
|
|
120
|
+
*/
|
|
121
|
+
canDrop: ((node: TreeNode, dataTransfer: DataTransfer) => boolean) | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Opt in to in-place rename. Called with the typed text and the node when
|
|
124
|
+
* the user commits; return `false` to reject it. Without it nothing can be
|
|
125
|
+
* renamed and rows are plain text. Rows must also have `item.editable`.
|
|
126
|
+
*/
|
|
127
|
+
validateEdit: ((value: string, node: TreeNode) => boolean) | undefined;
|
|
128
|
+
/** Key of a node to keep visibly marked across level changes (unlike selection). */
|
|
129
|
+
markedKey: string | undefined;
|
|
130
|
+
/** Only render the visible rows. Needs `itemHeight`. See `ixfx-vertical-list`. */
|
|
131
|
+
virtualize: boolean;
|
|
132
|
+
/** Fixed row height in px, required for `virtualize`. */
|
|
133
|
+
itemHeight: number;
|
|
86
134
|
withUp: boolean;
|
|
87
135
|
hideRoot: boolean;
|
|
88
136
|
/** Shown when the current level has no children. */
|
|
@@ -97,6 +145,13 @@ declare class FlatListElement extends LitElement {
|
|
|
97
145
|
get registry(): VerticalListElement[`registry`];
|
|
98
146
|
/** Run a command on the inner list, e.g. `dispatch('list.search.filter')`. */
|
|
99
147
|
dispatch(commandId: string, args?: Record<string, unknown>): void;
|
|
148
|
+
/**
|
|
149
|
+
* Rename a row in place. Needs `validateEdit`, and only rows whose
|
|
150
|
+
* `item.editable` is true can be edited. Ends with `flat-list-edit-commit` or `flat-list-edit-cancel`; the
|
|
151
|
+
* label is not rewritten — update the tree in response. Returns false if
|
|
152
|
+
* the row is unknown, not editable, or not on screen.
|
|
153
|
+
*/
|
|
154
|
+
beginEdit(key: string): boolean;
|
|
100
155
|
/** The node whose children are listed. */
|
|
101
156
|
get currentNode(): TreeNode | undefined;
|
|
102
157
|
get selectedNodes(): ReadonlySet<TreeNode>;
|
|
@@ -122,5 +177,5 @@ interface FlatListElement {
|
|
|
122
177
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
123
178
|
}
|
|
124
179
|
//#endregion
|
|
125
|
-
export {
|
|
126
|
-
//# sourceMappingURL=flat-list-
|
|
180
|
+
export { FlatListSelectEvent as _, FlatListContextMenuDetail as a, FlatListDropEvent as c, FlatListEditCommitDetail as d, FlatListEditCommitEvent as f, FlatListSelectDetail as g, FlatListNavigateEvent as h, FlatListBranchOrder as i, FlatListEditCancelDetail as l, FlatListNavigateDetail as m, FlatListActivateDetail as n, FlatListContextMenuEvent as o, FlatListElementEventMap as p, FlatListActivateEvent as r, FlatListDropDetail as s, FlatListElement as t, FlatListEditCancelEvent as u };
|
|
181
|
+
//# sourceMappingURL=flat-list-DEDG6epz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flat-list-DEDG6epz.d.ts","names":[],"sources":["../src/flat-list/types.ts","../src/flat-list/flat-list.ts"],"mappings":";;;;;;;;;KAGY;KAEA;;WAED;;WAEA;;WAEA,MAAM;;WAEN;;KAGC;WACD,UAAU,YAAY;WACtB,cAAc;WACd,UAAU,YAAY;;KAGrB;WACD,MAAM;;KAGL;;WAED,MAAM;WACN,cAAc;;KAGb;;WAED,MAAM;;WAEN,gBAAgB;WAChB;WACA;;KAGC;WACD,MAAM;WACN;;KAGC;WACD,MAAM;;KAGL,wBAAwB,YAAY;KACpC,sBAAsB,YAAY;KAClC,wBAAwB,YAAY;KAEpC,oBAAoB,YAAY;KAChC,2BAA2B,YAAY;KACvC,0BAA0B,YAAY;KACtC,0BAA0B,YAAY;UAEjC;EACf,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,kBAAkB;EAClB,0BAA0B;EAC1B,yBAAyB;EACzB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCiFd,wBAAwB;;EAEnC,MAAM;EAGN,OAAO;;EAIP;;EAIA,cAAc;EAGd,iBAAiB;;EAIjB,QAAQ,GAAG,UAAU,GAAG;EAGxB,aAAa;EAGb,eAAe;EAGf,iBAAiB;EAGjB;EAGA;EAGA;;EAIA;;;;;EAOA,WAAW,MAAM,UAAU,cAAc;;;;;;EAQzC,gBAAgB,eAAe,MAAM;;EAIrC;;EAIA;;EAIA;EAGA;EAGA;;EAIA;;UAIQ;UAES;UACA;;MAcb,QAAQ;;MAKR,YAAY;;EAKhB,SAAS,mBAAmB,OAAO;;;;;;;EAUnC,UAAU;;MAQN,eAAe;MAIf,iBAAiB,YAAY;;EAWjC,WAAW;;EASX,aAAa;;EASb;EAqBS;YAQU,WAAW,SAAS;YAyBpB,QAAQ,SAAS;YAqSjB,wBAAM;SAoDT,sBAAM;;QAkFhB;YACI;IACR,kBAAkB;;;UAIL;EACf,iBAAiB,gBAAgB,yBAC/B,MAAM,GACN,WAAW,MAAM,iBAAiB,OAAO,wBAAwB,aACjE,oBAAoB;EAEtB,iBACE,cACA,UAAU,oCACV,oBAAoB"}
|
package/dist/flat-list.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type FlatListActivateDetail, type FlatListActivateEvent, type FlatListBranchOrder, FlatListElement, type FlatListElementEventMap, type FlatListNavigateDetail, type FlatListNavigateEvent, type FlatListSelectDetail, type FlatListSelectEvent };
|
|
1
|
+
import { _ as FlatListSelectEvent, a as FlatListContextMenuDetail, c as FlatListDropEvent, d as FlatListEditCommitDetail, f as FlatListEditCommitEvent, g as FlatListSelectDetail, h as FlatListNavigateEvent, i as FlatListBranchOrder, l as FlatListEditCancelDetail, m as FlatListNavigateDetail, n as FlatListActivateDetail, o as FlatListContextMenuEvent, p as FlatListElementEventMap, r as FlatListActivateEvent, s as FlatListDropDetail, t as FlatListElement, u as FlatListEditCancelEvent } from "./flat-list-DEDG6epz.js";
|
|
2
|
+
export { type FlatListActivateDetail, type FlatListActivateEvent, type FlatListBranchOrder, type FlatListContextMenuDetail, type FlatListContextMenuEvent, type FlatListDropDetail, type FlatListDropEvent, type FlatListEditCancelDetail, type FlatListEditCancelEvent, type FlatListEditCommitDetail, type FlatListEditCommitEvent, FlatListElement, type FlatListElementEventMap, type FlatListNavigateDetail, type FlatListNavigateEvent, type FlatListSelectDetail, type FlatListSelectEvent };
|
package/dist/flat-list.js
CHANGED
|
@@ -9,9 +9,13 @@ import "./vertical-list.js";
|
|
|
9
9
|
import { LitElement, css, html, nothing } from "lit";
|
|
10
10
|
import { property, state } from "lit/decorators.js";
|
|
11
11
|
//#region src/flat-list/flat-list.ts
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* A node with children, or whose children are still to be loaded.
|
|
14
|
+
* `isLeaf: false` forces a branch even when `children` is `[]` (an empty
|
|
15
|
+
* folder that can still be entered); `isLeaf: true` forces a leaf.
|
|
16
|
+
*/
|
|
13
17
|
function isBranch(node) {
|
|
14
|
-
return node.item.isLeaf !== true && node.children?.length !== 0;
|
|
18
|
+
return node.item.isLeaf === false || node.item.isLeaf !== true && node.children?.length !== 0;
|
|
15
19
|
}
|
|
16
20
|
function sameKeys(a, b) {
|
|
17
21
|
return a.length === b.length && a.every((k, i) => k === b[i]);
|
|
@@ -61,6 +65,9 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
61
65
|
this.interactionMode = `standard`;
|
|
62
66
|
this.itemWrap = `stop`;
|
|
63
67
|
this.itemsDraggable = false;
|
|
68
|
+
this.itemsDroppable = false;
|
|
69
|
+
this.virtualize = false;
|
|
70
|
+
this.itemHeight = 0;
|
|
64
71
|
this.withUp = true;
|
|
65
72
|
this.hideRoot = false;
|
|
66
73
|
this.emptyText = `Empty`;
|
|
@@ -70,6 +77,64 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
70
77
|
this.#lastPath = [];
|
|
71
78
|
this.#selected = /* @__PURE__ */ new Set();
|
|
72
79
|
this.#direction = `jump`;
|
|
80
|
+
this.#canDropOn = (el, dataTransfer) => {
|
|
81
|
+
const node = this.#nodeForElement(el);
|
|
82
|
+
return !!node && (this.canDrop?.(node, dataTransfer) ?? true);
|
|
83
|
+
};
|
|
84
|
+
this.#onListDragOver = (e) => {
|
|
85
|
+
if (this.itemsDroppable) e.preventDefault();
|
|
86
|
+
};
|
|
87
|
+
this.#onListDrop = (e) => {
|
|
88
|
+
const node = this.#nodeForKey(e.detail.key) ?? this.currentNode;
|
|
89
|
+
if (!node) return;
|
|
90
|
+
this.dispatchEvent(new CustomEvent(`flat-list-drop`, {
|
|
91
|
+
detail: {
|
|
92
|
+
node,
|
|
93
|
+
dataTransfer: e.detail.dataTransfer
|
|
94
|
+
},
|
|
95
|
+
bubbles: true,
|
|
96
|
+
composed: true
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
this.#onListContextMenu = (e) => {
|
|
100
|
+
const node = this.#nodeForKey(e.detail.key);
|
|
101
|
+
if (!node) return;
|
|
102
|
+
const nodes = [...e.detail.selectedKeys].map((k) => this.#nodeForKey(k)).filter((n) => n !== void 0);
|
|
103
|
+
if (!this.dispatchEvent(new CustomEvent(`flat-list-context-menu`, {
|
|
104
|
+
detail: {
|
|
105
|
+
node,
|
|
106
|
+
nodes,
|
|
107
|
+
x: e.detail.x,
|
|
108
|
+
y: e.detail.y
|
|
109
|
+
},
|
|
110
|
+
bubbles: true,
|
|
111
|
+
composed: true,
|
|
112
|
+
cancelable: true
|
|
113
|
+
}))) e.preventDefault();
|
|
114
|
+
};
|
|
115
|
+
this.#validateEditKey = (value, key) => {
|
|
116
|
+
const node = this.#nodeForKey(key);
|
|
117
|
+
return !!node && (this.validateEdit?.(value, node) ?? false);
|
|
118
|
+
};
|
|
119
|
+
this.#onListEditCommit = (e) => {
|
|
120
|
+
const node = this.#nodeForKey(e.detail.key);
|
|
121
|
+
if (node) this.dispatchEvent(new CustomEvent(`flat-list-edit-commit`, {
|
|
122
|
+
detail: {
|
|
123
|
+
node,
|
|
124
|
+
value: e.detail.value
|
|
125
|
+
},
|
|
126
|
+
bubbles: true,
|
|
127
|
+
composed: true
|
|
128
|
+
}));
|
|
129
|
+
};
|
|
130
|
+
this.#onListEditCancel = (e) => {
|
|
131
|
+
const node = this.#nodeForKey(e.detail.key);
|
|
132
|
+
if (node) this.dispatchEvent(new CustomEvent(`flat-list-edit-cancel`, {
|
|
133
|
+
detail: { node },
|
|
134
|
+
bubbles: true,
|
|
135
|
+
composed: true
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
73
138
|
this.#onListSelect = (e) => {
|
|
74
139
|
const previous = this.#selected;
|
|
75
140
|
const nodes = [...e.detail.selectedKeys].map((k) => this.#nodeForKey(k)).filter((n) => n !== void 0);
|
|
@@ -134,11 +199,8 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
134
199
|
if (sameLevel) this.#settleList();
|
|
135
200
|
}
|
|
136
201
|
};
|
|
137
|
-
this.#
|
|
138
|
-
|
|
139
|
-
const textColor = appearanceColor(node.item.textColor);
|
|
140
|
-
return html`<span class="label" style=${textColor ? `color:${textColor}` : nothing}>${node.item.label}</span>`;
|
|
141
|
-
};
|
|
202
|
+
this.#renderPlainRow = (row) => this.#renderRow(row, false);
|
|
203
|
+
this.#renderEditableRow = (row) => this.#renderRow(row, true);
|
|
142
204
|
this.#renderIcon = (row) => {
|
|
143
205
|
const { node } = row;
|
|
144
206
|
return node.item.icon ? html`<ixfx-icon name=${node.item.icon}></ixfx-icon>` : void 0;
|
|
@@ -178,6 +240,17 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
178
240
|
dispatch(commandId, args) {
|
|
179
241
|
this.list?.dispatch(commandId, args);
|
|
180
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Rename a row in place. Needs `validateEdit`, and only rows whose
|
|
245
|
+
* `item.editable` is true can be edited. Ends with `flat-list-edit-commit` or `flat-list-edit-cancel`; the
|
|
246
|
+
* label is not rewritten — update the tree in response. Returns false if
|
|
247
|
+
* the row is unknown, not editable, or not on screen.
|
|
248
|
+
*/
|
|
249
|
+
beginEdit(key) {
|
|
250
|
+
const node = this.#nodeForKey(key);
|
|
251
|
+
if (!this.validateEdit || !node?.item.editable) return false;
|
|
252
|
+
return this.list?.beginEdit(key) ?? false;
|
|
253
|
+
}
|
|
181
254
|
/** The node whose children are listed. */
|
|
182
255
|
get currentNode() {
|
|
183
256
|
return resolvePath(this.#root, this.path).at(-1);
|
|
@@ -267,6 +340,7 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
267
340
|
}
|
|
268
341
|
}
|
|
269
342
|
if (changed.has(`_rows`)) this.#settleList();
|
|
343
|
+
if (changed.has(`_rows`) || changed.has(`markedKey`)) this.#applyMarked();
|
|
270
344
|
}
|
|
271
345
|
/** Recompute the level's rows, loading children first when they are not yet known. */
|
|
272
346
|
#refreshRows(reload) {
|
|
@@ -318,12 +392,30 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
318
392
|
e.stopPropagation();
|
|
319
393
|
this.navigateInto(node.item.key);
|
|
320
394
|
}
|
|
395
|
+
#nodeForElement(el) {
|
|
396
|
+
return el ? this.#nodeForKey(el.getAttribute(`data-key`) ?? void 0) : this.currentNode;
|
|
397
|
+
}
|
|
398
|
+
#canDropOn;
|
|
399
|
+
/** Accept every drag that got past `canDrop`; the consumer only hears about the drop. */
|
|
400
|
+
#onListDragOver;
|
|
401
|
+
#onListDrop;
|
|
402
|
+
#onListContextMenu;
|
|
403
|
+
#validateEditKey;
|
|
404
|
+
#onListEditCommit;
|
|
405
|
+
#onListEditCancel;
|
|
321
406
|
#onListSelect;
|
|
322
407
|
#onListActivate;
|
|
323
408
|
#syncFocusVisible;
|
|
324
409
|
#onKeyDown;
|
|
325
410
|
/** A crumb was chosen (or the Up button used): go to that node, or to its parent and select it if it is a leaf. */
|
|
326
411
|
#onCrumbSelect;
|
|
412
|
+
/** Flag the marked row. Rows are rebuilt with the level, so this runs after each rebuild. */
|
|
413
|
+
async #applyMarked() {
|
|
414
|
+
const list = this.list;
|
|
415
|
+
if (!list) return;
|
|
416
|
+
await list.updateComplete;
|
|
417
|
+
for (const row of list.querySelectorAll(`li[data-key]`)) row.toggleAttribute(`data-marked`, row.getAttribute(`data-key`) === this.markedKey);
|
|
418
|
+
}
|
|
327
419
|
/** After the inner list has rebuilt, place the cursor / selection / focus. */
|
|
328
420
|
async #settleList() {
|
|
329
421
|
const list = this.list;
|
|
@@ -338,7 +430,15 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
338
430
|
if (focusKey !== void 0) list.focusKey(focusKey);
|
|
339
431
|
if (hadFocus) list.focus();
|
|
340
432
|
}
|
|
341
|
-
|
|
433
|
+
/** Two stable formatters, so toggling `validateEdit` rebuilds the rows with or without edit hooks. */
|
|
434
|
+
#renderPlainRow;
|
|
435
|
+
#renderEditableRow;
|
|
436
|
+
#renderRow(row, editingEnabled) {
|
|
437
|
+
const { node } = row;
|
|
438
|
+
const textColor = appearanceColor(node.item.textColor);
|
|
439
|
+
const editable = editingEnabled && node.item.editable === true;
|
|
440
|
+
return html`<span class="label" data-edit-label=${editable ? `` : nothing} data-edit-value=${editable ? node.item.label : nothing} style=${textColor ? `color:${textColor}` : nothing}>${node.item.label}</span>`;
|
|
441
|
+
}
|
|
342
442
|
#renderIcon;
|
|
343
443
|
#renderBadge;
|
|
344
444
|
render() {
|
|
@@ -360,7 +460,7 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
360
460
|
<div class="body">
|
|
361
461
|
<ixfx-vertical-list
|
|
362
462
|
.items=${this._rows}
|
|
363
|
-
.formatter=${this.#
|
|
463
|
+
.formatter=${this.validateEdit ? this.#renderEditableRow : this.#renderPlainRow}
|
|
364
464
|
.icon=${this.#renderIcon}
|
|
365
465
|
.iconColor=${(row) => appearanceColor(row.node.item.iconColor)}
|
|
366
466
|
.badge=${this.#renderBadge}
|
|
@@ -370,6 +470,16 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
370
470
|
.itemWrap=${this.itemWrap}
|
|
371
471
|
.searchModes=${this.searchModes}
|
|
372
472
|
?items-draggable=${this.itemsDraggable}
|
|
473
|
+
?items-droppable=${this.itemsDroppable}
|
|
474
|
+
.canDrop=${this.#canDropOn}
|
|
475
|
+
.editValidator=${this.#validateEditKey}
|
|
476
|
+
.virtualize=${this.virtualize}
|
|
477
|
+
.itemHeight=${this.itemHeight}
|
|
478
|
+
@list-drag-over=${this.#onListDragOver}
|
|
479
|
+
@list-drop=${this.#onListDrop}
|
|
480
|
+
@list-context-menu=${this.#onListContextMenu}
|
|
481
|
+
@list-edit-commit=${this.#onListEditCommit}
|
|
482
|
+
@list-edit-cancel=${this.#onListEditCancel}
|
|
373
483
|
@list-select=${this.#onListSelect}
|
|
374
484
|
@list-activate=${this.#onListActivate}
|
|
375
485
|
@keydown=${this.#onKeyDown}
|
|
@@ -434,6 +544,11 @@ let FlatListElement = class FlatListElement extends LitElement {
|
|
|
434
544
|
color: var(--flat-list-empty-text, var(--surface-muted-text));
|
|
435
545
|
}
|
|
436
546
|
|
|
547
|
+
li[data-marked] {
|
|
548
|
+
background: var(--flat-list-marked-bg, color-mix(in srgb, var(--accent) 18%, transparent));
|
|
549
|
+
box-shadow: inset 3px 0 0 var(--flat-list-marked-bar, var(--accent));
|
|
550
|
+
}
|
|
551
|
+
|
|
437
552
|
.label {
|
|
438
553
|
flex: 1;
|
|
439
554
|
overflow: hidden;
|
|
@@ -491,6 +606,26 @@ __decorate([property({
|
|
|
491
606
|
attribute: `items-draggable`,
|
|
492
607
|
reflect: true
|
|
493
608
|
})], FlatListElement.prototype, "itemsDraggable", void 0);
|
|
609
|
+
__decorate([property({
|
|
610
|
+
type: Boolean,
|
|
611
|
+
attribute: `items-droppable`,
|
|
612
|
+
reflect: true
|
|
613
|
+
})], FlatListElement.prototype, "itemsDroppable", void 0);
|
|
614
|
+
__decorate([property({ attribute: false })], FlatListElement.prototype, "canDrop", void 0);
|
|
615
|
+
__decorate([property({ attribute: false })], FlatListElement.prototype, "validateEdit", void 0);
|
|
616
|
+
__decorate([property({
|
|
617
|
+
type: String,
|
|
618
|
+
attribute: `marked-key`,
|
|
619
|
+
reflect: true
|
|
620
|
+
})], FlatListElement.prototype, "markedKey", void 0);
|
|
621
|
+
__decorate([property({
|
|
622
|
+
type: Boolean,
|
|
623
|
+
reflect: true
|
|
624
|
+
})], FlatListElement.prototype, "virtualize", void 0);
|
|
625
|
+
__decorate([property({
|
|
626
|
+
type: Number,
|
|
627
|
+
attribute: `item-height`
|
|
628
|
+
})], FlatListElement.prototype, "itemHeight", void 0);
|
|
494
629
|
__decorate([property({
|
|
495
630
|
type: Boolean,
|
|
496
631
|
attribute: `with-up`,
|