@asymmetric-effort/specifyjs 0.2.172 → 0.3.7
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/esm/components-barrel.js +405 -38
- package/dist/specifyjs-components.cjs.js +4 -3
- package/dist/specifyjs-components.esm.js +405 -38
- package/dist/types/components/form/buildable-list/src/BuildableList.d.ts +21 -0
- package/dist/types/components/form/buildable-list/src/index.d.ts +2 -0
- package/dist/types/components/layout/draggable-window/src/DraggableWindow.d.ts +3 -0
- package/dist/types/components/layout/draggable-window/src/StatusBar.d.ts +23 -0
- package/dist/types/components/layout/draggable-window/src/index.d.ts +2 -0
- package/dist/types/components/page/unity-desktop/src/UnityApp.d.ts +3 -0
- package/dist/types/components/page/unity-desktop/src/UnityDesktop.d.ts +10 -0
- package/dist/types/core/src/components-barrel.d.ts +1 -0
- package/package.json +1 -1
|
@@ -13830,6 +13830,99 @@ function DesktopBackground(props) {
|
|
|
13830
13830
|
return backgroundEl;
|
|
13831
13831
|
}
|
|
13832
13832
|
|
|
13833
|
+
// ../components/layout/draggable-window/src/StatusBar.ts
|
|
13834
|
+
function StatusBar(props) {
|
|
13835
|
+
const {
|
|
13836
|
+
items,
|
|
13837
|
+
backgroundColor = "#007acc",
|
|
13838
|
+
color = "#ffffff",
|
|
13839
|
+
height = 22
|
|
13840
|
+
} = props;
|
|
13841
|
+
const leftItems = items.filter((item) => item.align !== "right");
|
|
13842
|
+
const rightItems = items.filter((item) => item.align === "right");
|
|
13843
|
+
const containerStyle3 = {
|
|
13844
|
+
display: "flex",
|
|
13845
|
+
alignItems: "center",
|
|
13846
|
+
justifyContent: "space-between",
|
|
13847
|
+
height: `${height}px`,
|
|
13848
|
+
backgroundColor,
|
|
13849
|
+
color,
|
|
13850
|
+
fontSize: "12px",
|
|
13851
|
+
flexShrink: "0",
|
|
13852
|
+
padding: "0 8px",
|
|
13853
|
+
overflow: "hidden",
|
|
13854
|
+
userSelect: "none"
|
|
13855
|
+
};
|
|
13856
|
+
function renderItem(item) {
|
|
13857
|
+
const isClickable = typeof item.onClick === "function";
|
|
13858
|
+
const itemStyle = {
|
|
13859
|
+
display: "inline-flex",
|
|
13860
|
+
alignItems: "center",
|
|
13861
|
+
gap: "4px",
|
|
13862
|
+
padding: "0 6px",
|
|
13863
|
+
height: "100%",
|
|
13864
|
+
whiteSpace: "nowrap",
|
|
13865
|
+
cursor: isClickable ? "pointer" : "default"
|
|
13866
|
+
};
|
|
13867
|
+
const children = [];
|
|
13868
|
+
if (item.icon) {
|
|
13869
|
+
children.push(
|
|
13870
|
+
createElement("span", {
|
|
13871
|
+
className: "status-bar__item-icon",
|
|
13872
|
+
style: { fontSize: "12px", lineHeight: "1" }
|
|
13873
|
+
}, item.icon)
|
|
13874
|
+
);
|
|
13875
|
+
}
|
|
13876
|
+
children.push(
|
|
13877
|
+
createElement("span", {
|
|
13878
|
+
className: "status-bar__item-label"
|
|
13879
|
+
}, item.label)
|
|
13880
|
+
);
|
|
13881
|
+
const itemProps = {
|
|
13882
|
+
key: item.key,
|
|
13883
|
+
className: `status-bar__item${isClickable ? " status-bar__item--clickable" : ""}`,
|
|
13884
|
+
style: itemStyle
|
|
13885
|
+
};
|
|
13886
|
+
if (isClickable) {
|
|
13887
|
+
itemProps.onClick = item.onClick;
|
|
13888
|
+
itemProps.onMouseEnter = (e) => {
|
|
13889
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.15)";
|
|
13890
|
+
};
|
|
13891
|
+
itemProps.onMouseLeave = (e) => {
|
|
13892
|
+
e.currentTarget.style.backgroundColor = "";
|
|
13893
|
+
};
|
|
13894
|
+
}
|
|
13895
|
+
return createElement("span", itemProps, ...children);
|
|
13896
|
+
}
|
|
13897
|
+
const leftGroup = createElement(
|
|
13898
|
+
"div",
|
|
13899
|
+
{
|
|
13900
|
+
className: "status-bar__left",
|
|
13901
|
+
style: { display: "flex", alignItems: "center", height: "100%", overflow: "hidden" }
|
|
13902
|
+
},
|
|
13903
|
+
...leftItems.map(renderItem)
|
|
13904
|
+
);
|
|
13905
|
+
const rightGroup = createElement(
|
|
13906
|
+
"div",
|
|
13907
|
+
{
|
|
13908
|
+
className: "status-bar__right",
|
|
13909
|
+
style: { display: "flex", alignItems: "center", height: "100%", overflow: "hidden" }
|
|
13910
|
+
},
|
|
13911
|
+
...rightItems.map(renderItem)
|
|
13912
|
+
);
|
|
13913
|
+
return createElement(
|
|
13914
|
+
"div",
|
|
13915
|
+
{
|
|
13916
|
+
className: "status-bar",
|
|
13917
|
+
style: containerStyle3,
|
|
13918
|
+
role: "status",
|
|
13919
|
+
"aria-label": "Status bar"
|
|
13920
|
+
},
|
|
13921
|
+
leftGroup,
|
|
13922
|
+
rightGroup
|
|
13923
|
+
);
|
|
13924
|
+
}
|
|
13925
|
+
|
|
13833
13926
|
// ../components/layout/draggable-window/src/DraggableWindow.ts
|
|
13834
13927
|
var DEFAULT_MIN_SIZE = { width: 200, height: 150 };
|
|
13835
13928
|
var DEFAULT_POSITION = { x: 50, y: 50 };
|
|
@@ -13866,6 +13959,7 @@ function DraggableWindow(props) {
|
|
|
13866
13959
|
onFocus,
|
|
13867
13960
|
onMove,
|
|
13868
13961
|
onResize,
|
|
13962
|
+
statusBar,
|
|
13869
13963
|
children
|
|
13870
13964
|
} = props;
|
|
13871
13965
|
const [posX, setPosX] = useState(defaultPosition.x);
|
|
@@ -13928,9 +14022,10 @@ function DraggableWindow(props) {
|
|
|
13928
14022
|
const handleTitleBarDblClick = useCallback(
|
|
13929
14023
|
(e) => {
|
|
13930
14024
|
if (e.target.closest("button")) return;
|
|
14025
|
+
if (!resizable) return;
|
|
13931
14026
|
if (onMaximize) onMaximize();
|
|
13932
14027
|
},
|
|
13933
|
-
[onMaximize]
|
|
14028
|
+
[onMaximize, resizable]
|
|
13934
14029
|
);
|
|
13935
14030
|
useEffect(() => {
|
|
13936
14031
|
if (!isDragging) return;
|
|
@@ -14203,23 +14298,19 @@ function DraggableWindow(props) {
|
|
|
14203
14298
|
title
|
|
14204
14299
|
)
|
|
14205
14300
|
);
|
|
14206
|
-
const
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
},
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
if (onMinimize) onMinimize();
|
|
14220
|
-
}
|
|
14221
|
-
}),
|
|
14222
|
-
createElement("button", {
|
|
14301
|
+
const controlButtons = [];
|
|
14302
|
+
controlButtons.push(createElement("button", {
|
|
14303
|
+
type: "button",
|
|
14304
|
+
"aria-label": "Minimize",
|
|
14305
|
+
className: "draggable-window__btn-minimize",
|
|
14306
|
+
style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-minimize, #f39c12)" },
|
|
14307
|
+
onClick: (e) => {
|
|
14308
|
+
e.stopPropagation();
|
|
14309
|
+
if (onMinimize) onMinimize();
|
|
14310
|
+
}
|
|
14311
|
+
}));
|
|
14312
|
+
if (resizable) {
|
|
14313
|
+
controlButtons.push(createElement("button", {
|
|
14223
14314
|
type: "button",
|
|
14224
14315
|
"aria-label": isMaximized ? "Restore" : "Maximize",
|
|
14225
14316
|
className: "draggable-window__btn-maximize",
|
|
@@ -14228,17 +14319,25 @@ function DraggableWindow(props) {
|
|
|
14228
14319
|
e.stopPropagation();
|
|
14229
14320
|
if (onMaximize) onMaximize();
|
|
14230
14321
|
}
|
|
14231
|
-
})
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
}
|
|
14322
|
+
}));
|
|
14323
|
+
}
|
|
14324
|
+
controlButtons.push(createElement("button", {
|
|
14325
|
+
type: "button",
|
|
14326
|
+
"aria-label": "Close",
|
|
14327
|
+
className: "draggable-window__btn-close",
|
|
14328
|
+
style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-close, #e74c3c)" },
|
|
14329
|
+
onClick: (e) => {
|
|
14330
|
+
e.stopPropagation();
|
|
14331
|
+
if (onClose) onClose();
|
|
14332
|
+
}
|
|
14333
|
+
}));
|
|
14334
|
+
const controlsContainer = createElement(
|
|
14335
|
+
"div",
|
|
14336
|
+
{
|
|
14337
|
+
style: { display: "flex", alignItems: "center", flexShrink: "0" },
|
|
14338
|
+
className: "draggable-window__controls"
|
|
14339
|
+
},
|
|
14340
|
+
...controlButtons
|
|
14242
14341
|
);
|
|
14243
14342
|
titleBarChildren.push(controlsContainer);
|
|
14244
14343
|
const resizeHandles = [];
|
|
@@ -14361,6 +14460,9 @@ function DraggableWindow(props) {
|
|
|
14361
14460
|
children
|
|
14362
14461
|
)
|
|
14363
14462
|
);
|
|
14463
|
+
if (statusBar && statusBar !== false) {
|
|
14464
|
+
windowChildren.push(createElement(StatusBar, statusBar));
|
|
14465
|
+
}
|
|
14364
14466
|
const result = [
|
|
14365
14467
|
createElement(
|
|
14366
14468
|
"div",
|
|
@@ -15469,7 +15571,7 @@ var statusItemStyle = {
|
|
|
15469
15571
|
borderRadius: "3px",
|
|
15470
15572
|
transition: "background-color 0.15s"
|
|
15471
15573
|
};
|
|
15472
|
-
function
|
|
15574
|
+
function StatusBar2(props) {
|
|
15473
15575
|
const renderItems = (items) => items.map(
|
|
15474
15576
|
(item, i) => createElement(
|
|
15475
15577
|
"span",
|
|
@@ -15818,7 +15920,7 @@ function IDE(props) {
|
|
|
15818
15920
|
})
|
|
15819
15921
|
),
|
|
15820
15922
|
// Status Bar
|
|
15821
|
-
createElement(
|
|
15923
|
+
createElement(StatusBar2, {
|
|
15822
15924
|
items: [
|
|
15823
15925
|
{ label: "\u2387 main" },
|
|
15824
15926
|
{ label: "0 errors" },
|
|
@@ -20457,11 +20559,13 @@ function UnityDesktopInner(props) {
|
|
|
20457
20559
|
icon: app.icon,
|
|
20458
20560
|
x: 60 + prev.length * 30,
|
|
20459
20561
|
y: 40 + prev.length * 30,
|
|
20460
|
-
width: 600,
|
|
20461
|
-
height: 400,
|
|
20562
|
+
width: app.defaultSize?.width ?? 600,
|
|
20563
|
+
height: app.defaultSize?.height ?? 400,
|
|
20462
20564
|
zIndex: maxZ,
|
|
20463
20565
|
focused: true,
|
|
20464
|
-
windowState: "normal"
|
|
20566
|
+
windowState: "normal",
|
|
20567
|
+
resizable: app.resizable !== false,
|
|
20568
|
+
statusBar: app.statusBar
|
|
20465
20569
|
};
|
|
20466
20570
|
return [...prev.map((w) => ({ ...w, focused: false })), newWin];
|
|
20467
20571
|
});
|
|
@@ -20532,11 +20636,13 @@ function UnityDesktopInner(props) {
|
|
|
20532
20636
|
icon: app.icon,
|
|
20533
20637
|
x: 60 + prev.length * 30,
|
|
20534
20638
|
y: 40 + prev.length * 30,
|
|
20535
|
-
width: 600,
|
|
20536
|
-
height: 400,
|
|
20639
|
+
width: app.defaultSize?.width ?? 600,
|
|
20640
|
+
height: app.defaultSize?.height ?? 400,
|
|
20537
20641
|
zIndex: maxZ,
|
|
20538
20642
|
focused: true,
|
|
20539
|
-
windowState: "normal"
|
|
20643
|
+
windowState: "normal",
|
|
20644
|
+
resizable: app.resizable !== false,
|
|
20645
|
+
statusBar: app.statusBar
|
|
20540
20646
|
};
|
|
20541
20647
|
if (appId === "files") {
|
|
20542
20648
|
wmRef.current.setMenuBar("files", {
|
|
@@ -20680,6 +20786,8 @@ function UnityDesktopInner(props) {
|
|
|
20680
20786
|
icon: w.icon,
|
|
20681
20787
|
defaultPosition: { x: w.x, y: w.y },
|
|
20682
20788
|
defaultSize: { width: w.width, height: w.height },
|
|
20789
|
+
resizable: w.resizable,
|
|
20790
|
+
statusBar: w.statusBar,
|
|
20683
20791
|
zIndex: w.zIndex,
|
|
20684
20792
|
focused: w.focused,
|
|
20685
20793
|
windowState: w.windowState,
|
|
@@ -20981,6 +21089,7 @@ function UnityApp(props) {
|
|
|
20981
21089
|
resizable = true,
|
|
20982
21090
|
onClose,
|
|
20983
21091
|
menuBar,
|
|
21092
|
+
statusBar,
|
|
20984
21093
|
onActivate,
|
|
20985
21094
|
onDeactivate,
|
|
20986
21095
|
children
|
|
@@ -21063,6 +21172,7 @@ function UnityApp(props) {
|
|
|
21063
21172
|
onResize: handleResize,
|
|
21064
21173
|
onMinimize: handleMinimize,
|
|
21065
21174
|
onMaximize: handleMaximize,
|
|
21175
|
+
statusBar,
|
|
21066
21176
|
children
|
|
21067
21177
|
})
|
|
21068
21178
|
);
|
|
@@ -21109,6 +21219,263 @@ function validateNameForNesting(name, targetContainer, excludeId) {
|
|
|
21109
21219
|
return validateNameInScope(name, targetContainer, excludeId);
|
|
21110
21220
|
}
|
|
21111
21221
|
|
|
21222
|
+
// ../components/form/buildable-list/src/BuildableList.ts
|
|
21223
|
+
function BuildableList(props) {
|
|
21224
|
+
const {
|
|
21225
|
+
value,
|
|
21226
|
+
onChange,
|
|
21227
|
+
orientation = "vertical",
|
|
21228
|
+
inputPosition = "below",
|
|
21229
|
+
delimiter: delimiterProp,
|
|
21230
|
+
placeholder = "Add item...",
|
|
21231
|
+
disabled = false,
|
|
21232
|
+
label,
|
|
21233
|
+
maxItems
|
|
21234
|
+
} = props;
|
|
21235
|
+
const delimiter = delimiterProp ?? (orientation === "horizontal" ? ", " : "\n");
|
|
21236
|
+
const items = useMemo(() => Array.from(new Set(value)), [value]);
|
|
21237
|
+
const [mode, setMode] = useState({ type: "closed" });
|
|
21238
|
+
const [inputValue, setInputValue] = useState("");
|
|
21239
|
+
const [duplicate, setDuplicate] = useState(false);
|
|
21240
|
+
const inputRef = useRef(null);
|
|
21241
|
+
const openAdd = useCallback(() => {
|
|
21242
|
+
if (disabled) return;
|
|
21243
|
+
if (maxItems !== void 0 && items.length >= maxItems) return;
|
|
21244
|
+
setMode({ type: "add" });
|
|
21245
|
+
setInputValue("");
|
|
21246
|
+
setDuplicate(false);
|
|
21247
|
+
}, [disabled, maxItems, items.length]);
|
|
21248
|
+
const openEdit = useCallback(
|
|
21249
|
+
(index) => {
|
|
21250
|
+
if (disabled) return;
|
|
21251
|
+
setMode({ type: "edit", index, original: items[index] });
|
|
21252
|
+
setInputValue(items[index]);
|
|
21253
|
+
setDuplicate(false);
|
|
21254
|
+
},
|
|
21255
|
+
[disabled, items]
|
|
21256
|
+
);
|
|
21257
|
+
const closeInput = useCallback(() => {
|
|
21258
|
+
setMode({ type: "closed" });
|
|
21259
|
+
setInputValue("");
|
|
21260
|
+
setDuplicate(false);
|
|
21261
|
+
}, []);
|
|
21262
|
+
const handleConfirm = useCallback(() => {
|
|
21263
|
+
const trimmed = inputValue.trim();
|
|
21264
|
+
if (!trimmed) return;
|
|
21265
|
+
if (mode.type === "add") {
|
|
21266
|
+
if (items.includes(trimmed)) {
|
|
21267
|
+
setDuplicate(true);
|
|
21268
|
+
setInputValue("");
|
|
21269
|
+
return;
|
|
21270
|
+
}
|
|
21271
|
+
onChange([...items, trimmed]);
|
|
21272
|
+
setInputValue("");
|
|
21273
|
+
setDuplicate(false);
|
|
21274
|
+
} else if (mode.type === "edit") {
|
|
21275
|
+
if (trimmed === mode.original) {
|
|
21276
|
+
closeInput();
|
|
21277
|
+
return;
|
|
21278
|
+
}
|
|
21279
|
+
if (items.includes(trimmed)) {
|
|
21280
|
+
setDuplicate(true);
|
|
21281
|
+
return;
|
|
21282
|
+
}
|
|
21283
|
+
const next = items.slice();
|
|
21284
|
+
next[mode.index] = trimmed;
|
|
21285
|
+
onChange(next);
|
|
21286
|
+
closeInput();
|
|
21287
|
+
}
|
|
21288
|
+
}, [inputValue, mode, items, onChange, closeInput]);
|
|
21289
|
+
const handleDelete = useCallback(() => {
|
|
21290
|
+
if (mode.type === "edit") {
|
|
21291
|
+
const next = items.filter((_, i) => i !== mode.index);
|
|
21292
|
+
onChange(next);
|
|
21293
|
+
closeInput();
|
|
21294
|
+
}
|
|
21295
|
+
}, [mode, items, onChange, closeInput]);
|
|
21296
|
+
const handleInputKeyDown = useCallback(
|
|
21297
|
+
(e) => {
|
|
21298
|
+
const key = e.key;
|
|
21299
|
+
if (key === "Enter") {
|
|
21300
|
+
e.preventDefault();
|
|
21301
|
+
handleConfirm();
|
|
21302
|
+
} else if (key === "Escape") {
|
|
21303
|
+
e.preventDefault();
|
|
21304
|
+
closeInput();
|
|
21305
|
+
}
|
|
21306
|
+
},
|
|
21307
|
+
[handleConfirm, closeInput]
|
|
21308
|
+
);
|
|
21309
|
+
const handleContainerKeyDown = useCallback(
|
|
21310
|
+
(e) => {
|
|
21311
|
+
if (disabled) return;
|
|
21312
|
+
const key = e.key;
|
|
21313
|
+
if (key === "+" && mode.type === "closed") {
|
|
21314
|
+
e.preventDefault();
|
|
21315
|
+
openAdd();
|
|
21316
|
+
}
|
|
21317
|
+
},
|
|
21318
|
+
[disabled, mode, openAdd]
|
|
21319
|
+
);
|
|
21320
|
+
const containerStyle3 = {
|
|
21321
|
+
display: "flex",
|
|
21322
|
+
flexDirection: "column",
|
|
21323
|
+
gap: "4px"
|
|
21324
|
+
};
|
|
21325
|
+
const listContainerStyle = {
|
|
21326
|
+
display: "flex",
|
|
21327
|
+
flexDirection: orientation === "vertical" ? "column" : "row",
|
|
21328
|
+
flexWrap: orientation === "horizontal" ? "wrap" : "nowrap",
|
|
21329
|
+
gap: orientation === "vertical" ? "2px" : "0",
|
|
21330
|
+
alignItems: orientation === "horizontal" ? "center" : "stretch"
|
|
21331
|
+
};
|
|
21332
|
+
const itemStyle = {
|
|
21333
|
+
padding: "4px 8px",
|
|
21334
|
+
cursor: disabled ? "default" : "pointer",
|
|
21335
|
+
borderRadius: "4px",
|
|
21336
|
+
fontSize: "14px",
|
|
21337
|
+
color: "#1f2937",
|
|
21338
|
+
backgroundColor: "transparent",
|
|
21339
|
+
transition: "background-color 0.1s",
|
|
21340
|
+
border: "1px solid transparent",
|
|
21341
|
+
userSelect: "none"
|
|
21342
|
+
};
|
|
21343
|
+
const buttonBase = {
|
|
21344
|
+
display: "inline-flex",
|
|
21345
|
+
alignItems: "center",
|
|
21346
|
+
justifyContent: "center",
|
|
21347
|
+
border: "1px solid #d1d5db",
|
|
21348
|
+
borderRadius: "6px",
|
|
21349
|
+
backgroundColor: "#ffffff",
|
|
21350
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
21351
|
+
fontSize: "16px",
|
|
21352
|
+
fontWeight: "700",
|
|
21353
|
+
lineHeight: "1",
|
|
21354
|
+
padding: "4px 10px",
|
|
21355
|
+
color: "#374151",
|
|
21356
|
+
transition: "background-color 0.15s, border-color 0.15s"
|
|
21357
|
+
};
|
|
21358
|
+
const inputRowStyle = {
|
|
21359
|
+
display: "flex",
|
|
21360
|
+
alignItems: "center",
|
|
21361
|
+
gap: "4px"
|
|
21362
|
+
};
|
|
21363
|
+
const inputStyle = buildInputStyle({}, { focused: false, error: duplicate });
|
|
21364
|
+
const listItems = [];
|
|
21365
|
+
for (let i = 0; i < items.length; i++) {
|
|
21366
|
+
const item = items[i];
|
|
21367
|
+
if (orientation === "horizontal" && i > 0) {
|
|
21368
|
+
listItems.push(
|
|
21369
|
+
createElement("span", {
|
|
21370
|
+
key: `delim-${i}`,
|
|
21371
|
+
style: { color: "#9ca3af", fontSize: "14px", userSelect: "none" },
|
|
21372
|
+
"aria-hidden": "true"
|
|
21373
|
+
}, delimiter)
|
|
21374
|
+
);
|
|
21375
|
+
}
|
|
21376
|
+
listItems.push(
|
|
21377
|
+
createElement("span", {
|
|
21378
|
+
key: `item-${i}`,
|
|
21379
|
+
role: "listitem",
|
|
21380
|
+
tabIndex: disabled ? -1 : 0,
|
|
21381
|
+
style: itemStyle,
|
|
21382
|
+
onClick: disabled ? void 0 : () => openEdit(i),
|
|
21383
|
+
onKeyDown: disabled ? void 0 : (e) => {
|
|
21384
|
+
if (e.key === "Enter") openEdit(i);
|
|
21385
|
+
}
|
|
21386
|
+
}, item)
|
|
21387
|
+
);
|
|
21388
|
+
}
|
|
21389
|
+
const listEl = createElement(
|
|
21390
|
+
"div",
|
|
21391
|
+
{ role: "list", style: listContainerStyle },
|
|
21392
|
+
...listItems
|
|
21393
|
+
);
|
|
21394
|
+
const addBtnDisabled = disabled || maxItems !== void 0 && items.length >= maxItems;
|
|
21395
|
+
const addButton = createElement("button", {
|
|
21396
|
+
type: "button",
|
|
21397
|
+
"aria-label": "Add item",
|
|
21398
|
+
style: {
|
|
21399
|
+
...buttonBase,
|
|
21400
|
+
opacity: addBtnDisabled ? "0.5" : "1",
|
|
21401
|
+
cursor: addBtnDisabled ? "not-allowed" : "pointer"
|
|
21402
|
+
},
|
|
21403
|
+
disabled: addBtnDisabled,
|
|
21404
|
+
onClick: addBtnDisabled ? void 0 : openAdd
|
|
21405
|
+
}, "+");
|
|
21406
|
+
let inputRow = null;
|
|
21407
|
+
if (mode.type !== "closed") {
|
|
21408
|
+
const okBtn = createElement("button", {
|
|
21409
|
+
type: "button",
|
|
21410
|
+
"aria-label": "Confirm",
|
|
21411
|
+
style: { ...buttonBase, fontSize: "13px", padding: "4px 8px" },
|
|
21412
|
+
onClick: handleConfirm
|
|
21413
|
+
}, "OK");
|
|
21414
|
+
const deleteBtn = mode.type === "edit" ? createElement("button", {
|
|
21415
|
+
type: "button",
|
|
21416
|
+
"aria-label": "Delete",
|
|
21417
|
+
style: { ...buttonBase, fontSize: "13px", padding: "4px 8px", color: "#ef4444" },
|
|
21418
|
+
onClick: handleDelete
|
|
21419
|
+
}, "X") : null;
|
|
21420
|
+
inputRow = createElement(
|
|
21421
|
+
"div",
|
|
21422
|
+
{ style: inputRowStyle, className: "buildable-list__input-row" },
|
|
21423
|
+
createElement("input", {
|
|
21424
|
+
ref: inputRef,
|
|
21425
|
+
type: "text",
|
|
21426
|
+
value: inputValue,
|
|
21427
|
+
placeholder,
|
|
21428
|
+
"aria-label": mode.type === "edit" ? "Edit item" : "New item",
|
|
21429
|
+
style: { ...inputStyle, flex: "1", minWidth: "0" },
|
|
21430
|
+
autoFocus: true,
|
|
21431
|
+
onInput: (e) => {
|
|
21432
|
+
setInputValue(e.target.value);
|
|
21433
|
+
setDuplicate(false);
|
|
21434
|
+
},
|
|
21435
|
+
onKeyDown: handleInputKeyDown
|
|
21436
|
+
}),
|
|
21437
|
+
okBtn,
|
|
21438
|
+
deleteBtn
|
|
21439
|
+
);
|
|
21440
|
+
}
|
|
21441
|
+
const bodyParts = [];
|
|
21442
|
+
if (mode.type !== "closed" && inputPosition === "above") {
|
|
21443
|
+
bodyParts.push(inputRow);
|
|
21444
|
+
}
|
|
21445
|
+
bodyParts.push(
|
|
21446
|
+
createElement(
|
|
21447
|
+
"div",
|
|
21448
|
+
{
|
|
21449
|
+
style: {
|
|
21450
|
+
display: "flex",
|
|
21451
|
+
alignItems: "flex-start",
|
|
21452
|
+
gap: "8px"
|
|
21453
|
+
}
|
|
21454
|
+
},
|
|
21455
|
+
listEl,
|
|
21456
|
+
addButton
|
|
21457
|
+
)
|
|
21458
|
+
);
|
|
21459
|
+
if (mode.type !== "closed" && inputPosition === "below") {
|
|
21460
|
+
bodyParts.push(inputRow);
|
|
21461
|
+
}
|
|
21462
|
+
const body = createElement(
|
|
21463
|
+
"div",
|
|
21464
|
+
{
|
|
21465
|
+
style: containerStyle3,
|
|
21466
|
+
tabIndex: 0,
|
|
21467
|
+
onKeyDown: handleContainerKeyDown,
|
|
21468
|
+
className: "buildable-list"
|
|
21469
|
+
},
|
|
21470
|
+
...bodyParts
|
|
21471
|
+
);
|
|
21472
|
+
return createElement(
|
|
21473
|
+
FormFieldWrapper,
|
|
21474
|
+
{ label, disabled },
|
|
21475
|
+
body
|
|
21476
|
+
);
|
|
21477
|
+
}
|
|
21478
|
+
|
|
21112
21479
|
// ../components/form/button/src/Button.ts
|
|
21113
21480
|
var SIZE_MAP6 = {
|
|
21114
21481
|
sm: { padding: "3px 10px", fontSize: "12px", borderRadius: "4px" },
|
|
@@ -30241,6 +30608,7 @@ export {
|
|
|
30241
30608
|
BoxPlot,
|
|
30242
30609
|
Breadcrumb,
|
|
30243
30610
|
BubbleChart,
|
|
30611
|
+
BuildableList,
|
|
30244
30612
|
Button,
|
|
30245
30613
|
CARD_TYPE_OPTIONS,
|
|
30246
30614
|
COL_COMMENT,
|
|
@@ -30327,7 +30695,6 @@ export {
|
|
|
30327
30695
|
Slider,
|
|
30328
30696
|
Spinner,
|
|
30329
30697
|
Splitter,
|
|
30330
|
-
StatusBar,
|
|
30331
30698
|
Stepper,
|
|
30332
30699
|
Sunburst,
|
|
30333
30700
|
SystemTray,
|