@arcgis/common-components 5.2.0-next.64 → 5.2.0-next.66
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/dist/cdn/27EUJ42B.js +2 -0
- package/dist/cdn/{WLDOB2AM.js → 2NC4IS67.js} +1 -1
- package/dist/cdn/2W6L7MWA.js +2 -0
- package/dist/cdn/2YGG7LXT.js +2 -0
- package/dist/cdn/4BK7PZE3.js +2 -0
- package/dist/cdn/{BMAH7QBK.js → 7KADEPAK.js} +1 -1
- package/dist/cdn/{NNP2GXAL.js → 7NUOY4MH.js} +1 -1
- package/dist/cdn/{TO6WMMK4.js → CA7QB7UT.js} +1 -1
- package/dist/cdn/CH6HYVI6.js +2 -0
- package/dist/cdn/FBLD2E3Y.js +2 -0
- package/dist/cdn/{I6VYJHWH.js → FJAIY6NX.js} +1 -1
- package/dist/cdn/{G3IYOM43.js → GPWZ4YLQ.js} +1 -1
- package/dist/cdn/JJY3CFBU.js +2 -0
- package/dist/cdn/{7SJH7FOK.js → OVZV6YGZ.js} +1 -1
- package/dist/cdn/{6DGHVYTV.js → PHM5ZZMN.js} +1 -1
- package/dist/cdn/PTJVWB67.js +2 -0
- package/dist/cdn/{ADYTRVI3.js → SJFYZOCS.js} +1 -1
- package/dist/cdn/{EJYLPUWU.js → TJOSKSQ7.js} +1 -1
- package/dist/cdn/{UI52HM3O.js → UK2G5LXU.js} +1 -1
- package/dist/cdn/VCZLD7ZT.js +2 -0
- package/dist/cdn/VOBBBIYC.js +2 -0
- package/dist/cdn/{L5RQNCAS.js → WVOAAHEV.js} +1 -1
- package/dist/cdn/{PFBJ5AAH.js → XQRXHSM5.js} +1 -1
- package/dist/cdn/XW5YJXMI.js +2 -0
- package/dist/cdn/YCQN4TJE.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/element-reference-controller.js +17 -0
- package/dist/chunks/utils.js +69 -0
- package/dist/chunks/utils2.js +20 -0
- package/dist/chunks/utils3.js +7 -0
- package/dist/components/arcgis-toolbar/customElement.d.ts +47 -0
- package/dist/components/arcgis-toolbar/customElement.js +82 -0
- package/dist/components/arcgis-toolbar/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar/index.js +2 -0
- package/dist/components/arcgis-toolbar/types.d.ts +10 -0
- package/dist/components/arcgis-toolbar-action/customElement.d.ts +97 -0
- package/dist/components/arcgis-toolbar-action/customElement.js +57 -0
- package/dist/components/arcgis-toolbar-action/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar-action/index.js +3 -0
- package/dist/components/arcgis-toolbar-group/customElement.d.ts +38 -0
- package/dist/components/arcgis-toolbar-group/customElement.js +47 -0
- package/dist/components/arcgis-toolbar-group/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar-group/index.js +2 -0
- package/dist/components/arcgis-toolbar-item/customElement.d.ts +83 -0
- package/dist/components/arcgis-toolbar-item/customElement.js +42 -0
- package/dist/components/arcgis-toolbar-item/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar-item/index.js +4 -0
- package/dist/components/arcgis-toolbar-more-button/customElement.d.ts +52 -0
- package/dist/components/arcgis-toolbar-more-button/customElement.js +68 -0
- package/dist/components/arcgis-toolbar-more-button/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar-more-button/index.js +6 -0
- package/dist/components/arcgis-toolbar-split-button/customElement.d.ts +51 -0
- package/dist/components/arcgis-toolbar-split-button/customElement.js +66 -0
- package/dist/components/arcgis-toolbar-split-button/index.d.ts +1 -0
- package/dist/components/arcgis-toolbar-split-button/index.js +6 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +36 -0
- package/dist/loader.js +8 -2
- package/dist/types/lumina.d.ts +33 -0
- package/dist/types/preact.d.ts +39 -0
- package/dist/types/react.d.ts +45 -0
- package/dist/types/stencil.d.ts +33 -0
- package/package.json +4 -4
- package/dist/cdn/4S3TDYPJ.js +0 -2
- package/dist/cdn/DWUHV2MR.js +0 -2
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement, JsxNode } from "@arcgis/lumina";
|
|
3
|
+
import type { Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
4
|
+
import type { MeasurementContext, RenderContext } from "../arcgis-toolbar/types.js";
|
|
5
|
+
import type { Action as Action } from "@esri/calcite-components/components/calcite-action";
|
|
6
|
+
import type { DropdownItem as DropdownItem } from "@esri/calcite-components/components/calcite-dropdown-item";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A configuration for an `arcgis-toolbar` action.
|
|
10
|
+
*
|
|
11
|
+
* This is a non-rendering element; it will have no effect unless used
|
|
12
|
+
* correctly within an `arcgis-toolbar-group`.
|
|
13
|
+
*
|
|
14
|
+
* Notes:
|
|
15
|
+
*
|
|
16
|
+
* - there is no `scale` for this element; rendered scale is controlled
|
|
17
|
+
* exclusively by the host `arcgis-toolbar`
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export abstract class ArcgisToolbarItem extends LitElement {
|
|
22
|
+
get actionElement(): Action | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Whether or not this action is shown in an 'active'/selected state.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
accessor active: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Determines if the action should be rendered in a disabled state.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
accessor disabled: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The icon to show in the rendered action. For best user experience, this should not be ommitted.
|
|
37
|
+
*
|
|
38
|
+
* @default "question-mark"
|
|
39
|
+
*/
|
|
40
|
+
accessor icon: Icon["icon"];
|
|
41
|
+
/**
|
|
42
|
+
* Determines if icon is flipped in RTL direction
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
accessor iconFlipRtl: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Text to show in the primary label field; do not depend on this ever being visible to the user.
|
|
49
|
+
*
|
|
50
|
+
* @default ""
|
|
51
|
+
*/
|
|
52
|
+
accessor labelText: string;
|
|
53
|
+
/** @internal */
|
|
54
|
+
accessor lastActivated: Date | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Determines if action renders a loading spinner if possible
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
accessor loading: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Text to show in the tooltip for the action.
|
|
63
|
+
*
|
|
64
|
+
* @default ""
|
|
65
|
+
*/
|
|
66
|
+
accessor tooltipText: string;
|
|
67
|
+
/**
|
|
68
|
+
* @param parameter0
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
measure(parameter0: MeasurementContext): number[];
|
|
72
|
+
/**
|
|
73
|
+
* @param context
|
|
74
|
+
* @param mode
|
|
75
|
+
* @param selected
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
proxiedRender(context: RenderContext, mode: "collapsed-action" | "dropdown-item" | "expanded-action", selected?: boolean): JsxNode;
|
|
79
|
+
readonly arcgisItemSelected: import("@arcgis/lumina").TargetedEvent<this, { element: Action | DropdownItem | undefined; }>;
|
|
80
|
+
readonly "@eventTypes": {
|
|
81
|
+
arcgisItemSelected: ArcgisToolbarItem["arcgisItemSelected"]["detail"];
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as p } from "../../chunks/runtime.js";
|
|
3
|
+
import { html as n } from "lit";
|
|
4
|
+
import { ref as f } from "lit/directives/ref.js";
|
|
5
|
+
import { LitElement as $, createEvent as g, nothing as c, safeClassMap as v } from "@arcgis/lumina";
|
|
6
|
+
import { W as s } from "../../chunks/utils.js";
|
|
7
|
+
import { E as b } from "../../chunks/element-reference-controller.js";
|
|
8
|
+
import { g as u } from "../../chunks/utils2.js";
|
|
9
|
+
class x extends $ {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this._active = !1, this._elementReferenceController = new b(this), this.icon = "question-mark", this.tooltipText = "", this.labelText = "", this.disabled = !1, this.loading = !1, this.iconFlipRtl = !1, this.arcgisItemSelected = g();
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
this.properties = { icon: 3, lastActivated: 0, active: 7, tooltipText: 1, labelText: 3, disabled: 7, loading: 7, iconFlipRtl: 7, actionElement: 32 };
|
|
15
|
+
}
|
|
16
|
+
get active() {
|
|
17
|
+
return this._active;
|
|
18
|
+
}
|
|
19
|
+
set active(t) {
|
|
20
|
+
t !== this._active && (this._active = t, t && (this.lastActivated = /* @__PURE__ */ new Date()));
|
|
21
|
+
}
|
|
22
|
+
get actionElement() {
|
|
23
|
+
return this._elementReferenceController.element;
|
|
24
|
+
}
|
|
25
|
+
measure({ scale: t }) {
|
|
26
|
+
return [s.action[t] + s.actionPadding[t]];
|
|
27
|
+
}
|
|
28
|
+
proxiedRender(t, i, r) {
|
|
29
|
+
const l = t.tooltipAppearance, a = this._elementReferenceController.element, m = l !== "native" && i === "collapsed-action", d = l === "calcite-dark" ? "calcite-mode-dark" : void 0, h = u(t), e = this.tooltipText || this.labelText;
|
|
30
|
+
return i === "dropdown-item" ? n`<calcite-dropdown-item .disabled=${this.disabled} icon-start=${this.icon ?? c} .iconFlipRtl=${this.iconFlipRtl ? "both" : void 0} .label=${e} @click=${(o) => this._handleDropdownItemClick(o)} .selected=${this.active || r} title=${e ?? c}>${this.labelText}</calcite-dropdown-item>` : n`<calcite-action .active=${this.active} .disabled=${this.disabled} .icon=${this.icon} .iconFlipRtl=${this.iconFlipRtl} .label=${e} .loading=${this.loading} @click=${(o) => this._handleActionClick(o)} .scale=${t.scale} .text=${this.labelText} .textEnabled=${i === "expanded-action"} title=${(l === "native" ? e : void 0) ?? c} ${f(this._elementReferenceController.ref)}></calcite-action>${m && a ? n`<calcite-tooltip class=${v(d)} overlay-positioning=fixed .placement=${h} .referenceElement=${a}><span>${e}</span></calcite-tooltip>` : void 0}`;
|
|
31
|
+
}
|
|
32
|
+
_handleActionClick(t) {
|
|
33
|
+
this.isConnected && this.arcgisItemSelected?.emit({ element: t.currentTarget });
|
|
34
|
+
}
|
|
35
|
+
_handleDropdownItemClick(t) {
|
|
36
|
+
this.isConnected && this.arcgisItemSelected?.emit({ element: t.currentTarget });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
p("arcgis-toolbar-item", x);
|
|
40
|
+
export {
|
|
41
|
+
x as ArcgisToolbarItem
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement, JsxNode } from "@arcgis/lumina";
|
|
3
|
+
import type { MeasurementContext, RenderContext } from "../arcgis-toolbar/types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for a series of items that will be collapsed behind a 'more' overflow button
|
|
7
|
+
* depending on available space. This will render either all of the items in a flat list,
|
|
8
|
+
* or with an action that exposes an overflow list.
|
|
9
|
+
*
|
|
10
|
+
* This element does not apply any styling; unless there is overflow, it should not
|
|
11
|
+
* be visually evident at all.
|
|
12
|
+
*
|
|
13
|
+
* This element is only compatible with `arcgis-toolbar-item` elements,
|
|
14
|
+
* because it needs elements with consistent size and properties to support dynamic
|
|
15
|
+
* sizing and rendering behavior.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export abstract class ArcgisToolbarMoreButton extends LitElement {
|
|
20
|
+
/**
|
|
21
|
+
* Controls the appearance of the menu
|
|
22
|
+
*
|
|
23
|
+
* @default "action-menu"
|
|
24
|
+
*/
|
|
25
|
+
accessor menuAppearance: "action-menu" | "dropdown";
|
|
26
|
+
/**
|
|
27
|
+
* Label used for the overflow action trigger and its tooltip.
|
|
28
|
+
*
|
|
29
|
+
* @default "More actions"
|
|
30
|
+
*/
|
|
31
|
+
accessor overflowActionLabel: string;
|
|
32
|
+
/**
|
|
33
|
+
* Controls layout priority, which determines space allocation and layout behavior.
|
|
34
|
+
* Setting this to ForceCollapse will result in a split-button appearance even with
|
|
35
|
+
* ample space for all managed items. Setting to NeverCollapse will reserve space for
|
|
36
|
+
* all items (no visible split button) even if that would require scrolling.
|
|
37
|
+
*
|
|
38
|
+
* @default 100
|
|
39
|
+
*/
|
|
40
|
+
accessor priority: number;
|
|
41
|
+
/**
|
|
42
|
+
* @param context
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
measure(context: MeasurementContext): number[];
|
|
46
|
+
/**
|
|
47
|
+
* @param context
|
|
48
|
+
* @param budget
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
proxiedRender(context: RenderContext, budget: number): JsxNode;
|
|
52
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as A } from "../../chunks/runtime.js";
|
|
3
|
+
import { ref as f } from "lit/directives/ref.js";
|
|
4
|
+
import { html as m } from "lit";
|
|
5
|
+
import { LitElement as C, nothing as v, safeClassMap as $ } from "@arcgis/lumina";
|
|
6
|
+
import { L as u } from "../../chunks/utils.js";
|
|
7
|
+
import { E as w } from "../../chunks/element-reference-controller.js";
|
|
8
|
+
import { a as g, u as _, g as y } from "../../chunks/utils2.js";
|
|
9
|
+
import { b as L } from "../../chunks/utils3.js";
|
|
10
|
+
class R extends C {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this._elementReferenceController = new w(this), this._childrenObserver = new MutationObserver(() => {
|
|
13
|
+
this._syncChildren();
|
|
14
|
+
}), this.priority = u.Medium, this.menuAppearance = "action-menu", this.overflowActionLabel = "More actions";
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
this.properties = { _children: 16, priority: 9, menuAppearance: 1, overflowActionLabel: 1 };
|
|
18
|
+
}
|
|
19
|
+
measure(e) {
|
|
20
|
+
const t = this._children?.length ?? 0;
|
|
21
|
+
if (!t)
|
|
22
|
+
return [0];
|
|
23
|
+
const i = g(e), l = t * i;
|
|
24
|
+
if (!(this.priority < u.NeverCollapse && t > 2))
|
|
25
|
+
return [l];
|
|
26
|
+
const s = Math.min(t, 2) * i, o = [s];
|
|
27
|
+
if (t <= 2 || this.priority <= u.ForceCollapse)
|
|
28
|
+
return o;
|
|
29
|
+
for (let n = 1; n < t - 1; n++)
|
|
30
|
+
o.push(s + i * n);
|
|
31
|
+
return _(o);
|
|
32
|
+
}
|
|
33
|
+
proxiedRender(e, t) {
|
|
34
|
+
const i = this._children;
|
|
35
|
+
if (!i)
|
|
36
|
+
return;
|
|
37
|
+
const { visible: l, hidden: r } = this._resolveActionsFromBudget(i, e, t), s = "hamburger", o = this.overflowActionLabel, n = e.tooltipAppearance, c = n !== "native", a = this._elementReferenceController.element, p = n === "calcite-dark" ? "calcite-mode-dark" : void 0, h = y(e), b = this.menuAppearance === "action-menu" ? m`<calcite-action-menu .label=${o} overlay-positioning=fixed .placement=${h}><calcite-action .icon=${s} .scale=${e.scale} slot=trigger .text=${o} title=${(n === "native" ? o : "") ?? v} ${f(this._elementReferenceController.ref)}></calcite-action>${r.map((d) => d.proxiedRender(e, "expanded-action"))}</calcite-action-menu>` : m`<calcite-dropdown overlay-positioning=fixed .placement=${h}><calcite-action .icon=${s} .scale=${e.scale} slot=trigger .text=${o} title=${(n === "native" ? o : "") ?? v} ${f(this._elementReferenceController.ref)}></calcite-action><calcite-dropdown-group selection-mode=none>${r.map((d) => d.proxiedRender(e, "dropdown-item"))}</calcite-dropdown-group></calcite-dropdown>`;
|
|
38
|
+
return m`${l.map((d) => d.proxiedRender(e, "collapsed-action"))}${r.length ? b : void 0}${r.length && c ? m`<calcite-tooltip class=${$(p)} overlay-positioning=fixed .placement=${h} .referenceElement=${a}><span>${o}</span></calcite-tooltip>` : void 0}`;
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
super.connectedCallback(), this._childrenObserver.observe(this.el, { childList: !0 }), this._syncChildren();
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
this._childrenObserver.disconnect(), super.disconnectedCallback();
|
|
45
|
+
}
|
|
46
|
+
_syncChildren() {
|
|
47
|
+
this._componentWaitAbortController?.abort();
|
|
48
|
+
const e = Array.from(this.el.querySelectorAll("arcgis-toolbar-item")), t = new AbortController();
|
|
49
|
+
this._componentWaitAbortController = t, Promise.all(e.map((i) => i.componentOnReady())).then(() => {
|
|
50
|
+
!this.isConnected || t.signal.aborted || (this._children = e);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
_resolveActionsFromBudget(e, t, i) {
|
|
54
|
+
const l = e.find((a) => a.active) ?? e?.toSorted(L)?.at(0), r = Math.floor(i / g(t));
|
|
55
|
+
if (r >= e.length)
|
|
56
|
+
return { visible: [...e], hidden: [] };
|
|
57
|
+
const o = r - 1, n = e.slice(0, o), c = e.slice(o);
|
|
58
|
+
if (l && c.includes(l)) {
|
|
59
|
+
const [a] = c.splice(c.indexOf(l), 1), p = n.pop();
|
|
60
|
+
n.push(a), p && c.unshift(p);
|
|
61
|
+
}
|
|
62
|
+
return { visible: n, hidden: c };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
A("arcgis-toolbar-more-button", R);
|
|
66
|
+
export {
|
|
67
|
+
R as ArcgisToolbarMoreButton
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "@esri/calcite-components/components/calcite-action-menu";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-action";
|
|
3
|
+
import "@esri/calcite-components/components/calcite-dropdown";
|
|
4
|
+
import "@esri/calcite-components/components/calcite-dropdown-group";
|
|
5
|
+
import "@esri/calcite-components/components/calcite-tooltip";
|
|
6
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement, JsxNode } from "@arcgis/lumina";
|
|
3
|
+
import type { MeasurementContext, RenderContext } from "../arcgis-toolbar/types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for a split button. Split button will either render all actions
|
|
7
|
+
* flat, or collapse all actions with a single element shown + a dropdown menu.
|
|
8
|
+
*
|
|
9
|
+
* This element styles the rendered actions in the collapsed case to look like
|
|
10
|
+
* a split button.
|
|
11
|
+
*
|
|
12
|
+
* This element is only compatible with `arcgis-toolbar-item` elements,
|
|
13
|
+
* because it needs elements with consistent size and properties to support dynamic
|
|
14
|
+
* sizing and rendering behavior.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export abstract class ArcgisToolbarSplitButton extends LitElement {
|
|
19
|
+
/**
|
|
20
|
+
* Controls the appearance of the menu.
|
|
21
|
+
*
|
|
22
|
+
* @default "dropdown"
|
|
23
|
+
*/
|
|
24
|
+
accessor menuAppearance: "action-menu" | "dropdown";
|
|
25
|
+
/**
|
|
26
|
+
* Label used for the overflow action trigger and its tooltip.
|
|
27
|
+
*
|
|
28
|
+
* @default "More actions"
|
|
29
|
+
*/
|
|
30
|
+
accessor overflowActionLabel: string;
|
|
31
|
+
/**
|
|
32
|
+
* Controls layout priority, which determines space allocation and layout behavior.
|
|
33
|
+
* Setting this to ForceCollapse will result in a split-button appearance even with
|
|
34
|
+
* ample space for all managed items. Setting to NeverCollapse will reserve space for
|
|
35
|
+
* all items (no visible split button) even if that would require scrolling.
|
|
36
|
+
*
|
|
37
|
+
* @default 100
|
|
38
|
+
*/
|
|
39
|
+
accessor priority: number;
|
|
40
|
+
/**
|
|
41
|
+
* @param context
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
measure(context: MeasurementContext): number[];
|
|
45
|
+
/**
|
|
46
|
+
* @param context
|
|
47
|
+
* @param budget
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
proxiedRender(context: RenderContext, budget: number): JsxNode;
|
|
51
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as y } from "../../chunks/runtime.js";
|
|
3
|
+
import { ref as b } from "lit/directives/ref.js";
|
|
4
|
+
import { html as d } from "lit";
|
|
5
|
+
import { LitElement as _, nothing as h, safeClassMap as a } from "@arcgis/lumina";
|
|
6
|
+
import { E as L } from "../../chunks/element-reference-controller.js";
|
|
7
|
+
import { L as f, W as R } from "../../chunks/utils.js";
|
|
8
|
+
import { a as $, u as E, g as k } from "../../chunks/utils2.js";
|
|
9
|
+
import { b as O } from "../../chunks/utils3.js";
|
|
10
|
+
class S extends _ {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this._elementReferenceController = new L(this), this._childrenObserver = new MutationObserver(() => this._syncChildren()), this.priority = f.Medium, this.menuAppearance = "dropdown", this.overflowActionLabel = "More actions";
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
this.properties = { _children: 16, priority: 9, menuAppearance: 1, overflowActionLabel: 1 };
|
|
16
|
+
}
|
|
17
|
+
measure(e) {
|
|
18
|
+
const { priority: n, _children: i } = this, r = i?.length ?? 0;
|
|
19
|
+
if (!r)
|
|
20
|
+
return [0];
|
|
21
|
+
const o = $(e), s = r * o;
|
|
22
|
+
if (!(n < f.NeverCollapse) || r <= 1)
|
|
23
|
+
return [s];
|
|
24
|
+
const l = o + M(e);
|
|
25
|
+
return n <= f.ForceCollapse ? [l] : E([l, s]);
|
|
26
|
+
}
|
|
27
|
+
proxiedRender(e, n) {
|
|
28
|
+
const i = this._children;
|
|
29
|
+
if (!i)
|
|
30
|
+
return;
|
|
31
|
+
const { visible: r, hidden: o } = this._resolveActionsFromBudget(i, e, n, this.menuAppearance === "dropdown"), s = W(e), t = this.overflowActionLabel, l = e.tooltipAppearance, m = l !== "native", C = this._elementReferenceController.element, A = l === "calcite-dark" ? "calcite-mode-dark" : void 0, g = "split-anchor", v = o.length ? "split-menu" : "", u = k(e), w = this.menuAppearance === "action-menu" ? d`<calcite-action-menu .label=${t} overlay-positioning=fixed .placement=${u} class=${a(v)}><calcite-action .icon=${s} .scale=${e.scale} class=${a(g)} data-layout=${e.layout ?? h} slot=trigger title=${t ?? h} .label=${t} .text=${t} ${b(this._elementReferenceController.ref)}></calcite-action>${o.map((c) => c.proxiedRender(e, "expanded-action"))}</calcite-action-menu>` : d`<calcite-dropdown overlay-positioning=fixed .placement=${u} .scale=${e.scale} class=${a(v)}><calcite-action class=${a(g)} data-layout=${e.layout ?? h} .icon=${s} .label=${t} .scale=${e.scale} slot=trigger .text=${l === "native" ? t : ""} title=${t ?? h} ${b(this._elementReferenceController.ref)}></calcite-action><calcite-dropdown-group selection-mode=single>${o.map((c) => c.proxiedRender(e, "dropdown-item", c === r.at(0)))}</calcite-dropdown-group></calcite-dropdown>`;
|
|
32
|
+
return d`<div class="split-host">${r.map((c) => c.proxiedRender(e, "collapsed-action"))}${o.length ? w : void 0}${o.length && m ? d`<calcite-tooltip class=${a(A)} overlay-positioning=fixed .placement=${u} .referenceElement=${C}><span>${t}</span></calcite-tooltip>` : void 0}</div>`;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback(), this._childrenObserver.observe(this.el, { childList: !0 }), this._syncChildren();
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
this._childrenObserver.disconnect(), super.disconnectedCallback();
|
|
39
|
+
}
|
|
40
|
+
_resolveActionsFromBudget(e, n, i, r) {
|
|
41
|
+
const o = e.find((m) => m.active) ?? e?.toSorted(O)?.at(0);
|
|
42
|
+
if (Math.floor(i / $(n)) >= e.length)
|
|
43
|
+
return { visible: [...e], hidden: [] };
|
|
44
|
+
if (r)
|
|
45
|
+
return { visible: [o ?? e[0]], hidden: [...e] };
|
|
46
|
+
const t = [...e];
|
|
47
|
+
return { visible: t.splice(t.indexOf(o), 1), hidden: t };
|
|
48
|
+
}
|
|
49
|
+
_syncChildren() {
|
|
50
|
+
this._componentWaitAbortController?.abort();
|
|
51
|
+
const e = Array.from(this.el.querySelectorAll("arcgis-toolbar-item")), n = new AbortController();
|
|
52
|
+
this._componentWaitAbortController = n, Promise.all(e.map((i) => i.componentOnReady())).then(() => {
|
|
53
|
+
!this.isConnected || n.signal.aborted || (this._children = e);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function W({ layout: p, relativePosition: e }) {
|
|
58
|
+
return p === "horizontal" ? e.startsWith("top") ? "chevron-down" : "chevron-up" : e.endsWith("left") ? "chevron-right" : "chevron-left";
|
|
59
|
+
}
|
|
60
|
+
function M({ layout: p, scale: e }) {
|
|
61
|
+
return R.splitButtonPart[p][e];
|
|
62
|
+
}
|
|
63
|
+
y("arcgis-toolbar-split-button", S);
|
|
64
|
+
export {
|
|
65
|
+
S as ArcgisToolbarSplitButton
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "@esri/calcite-components/components/calcite-action-menu";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-action";
|
|
3
|
+
import "@esri/calcite-components/components/calcite-dropdown";
|
|
4
|
+
import "@esri/calcite-components/components/calcite-dropdown-group";
|
|
5
|
+
import "@esri/calcite-components/components/calcite-tooltip";
|
|
6
|
+
export * from "./customElement.js";
|