@adcops/autocore-react 3.5.11 → 3.5.15
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/components/varpick/VariableInput.d.ts.map +1 -1
- package/dist/components/varpick/VariableInput.js +1 -1
- package/package.json +2 -1
- package/src/components/varpick/VariableInput.tsx +9 -2
- package/tools/tests/dist/{TestFieldDialog-C4mKVh7q.js → TestFieldDialog-BvHAr2GQ.js} +158 -2
- package/tools/tests/dist/tis-editor.entry.js +1 -1
- package/tools/tests/dist/varpick.entry.js +1 -1
- package/tools/tests/varpick.test.mjs +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableInput.d.ts","sourceRoot":"","sources":["../../../src/components/varpick/VariableInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"VariableInput.d.ts","sourceRoot":"","sources":["../../../src/components/varpick/VariableInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAGH,KAAK,OAAO,EACZ,KAAK,UAAU,EAElB,MAAM,0BAA0B,CAAC;AAElC,OAAO,eAAe,CAAC;AAEvB,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;OAIG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0EtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import*as React from"react";import{Button}from"primereact/button";import{InputText}from"primereact/inputtext";import{applyInsert,queryFromCaret}from"@adcops/autocore-varpick";import{VariablePicker}from"./VariablePicker";import"./varpick.css";export const VariableInput=({value:e,onChange:t,catalog:a,mode:r="replace",pickerTitle:
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import*as React from"react";import{Button}from"primereact/button";import{InputText}from"primereact/inputtext";import{Variable}from"lucide-react";import{applyInsert,queryFromCaret}from"@adcops/autocore-varpick";import{VariablePicker}from"./VariablePicker";import"./varpick.css";export const VariableInput=({value:e,onChange:t,catalog:a,mode:r="replace",pickerTitle:i,pickerHint:n,ariaLabel:c,placeholder:s,className:l,disabled:o,invalid:u})=>{const p=React.useRef(null),m=React.useRef({start:0,end:0}),[d,b]=React.useState(!1),[x,v]=React.useState([]),f=()=>{const e=p.current;e&&(m.current={start:e.selectionStart??e.value.length,end:e.selectionEnd??e.value.length})};return _jsxs("div",{className:"ac-varpick__input",children:[_jsx(InputText,{ref:p,value:e,placeholder:s,disabled:o,className:`${l??""}${u?" p-invalid":""}`,onChange:e=>t(e.target.value),onSelect:f,onFocus:f}),_jsx(Button,{type:"button","aria-label":c,disabled:o,className:"p-button-outlined",onClick:()=>{v(a()),b(!0)},children:_jsx(Variable,{size:16,"aria-hidden":!0})}),d&&_jsx(VariablePicker,{visible:!0,catalog:x,title:i,hint:n,initialQuery:"caret"===r?queryFromCaret(e,m.current.start,m.current.end):"",onCancel:()=>b(!1),onPick:a=>{const{start:i,end:n}=m.current,c=applyInsert(e,a,r,i,n);t(c.value),b(!1),requestAnimationFrame(()=>{const e=p.current;e&&(e.focus(),e.setSelectionRange(c.caret,c.caret),m.current={start:c.caret,end:c.caret})})}})]})};export default VariableInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adcops/autocore-react",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.15",
|
|
4
4
|
"description": "A React component library for industrial user interfaces.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"chartjs-plugin-annotation": "^3.1.0",
|
|
64
64
|
"chartjs-plugin-zoom": "^2.2.0",
|
|
65
65
|
"clsx": "^2.1.1",
|
|
66
|
+
"lucide-react": "^1.16.0",
|
|
66
67
|
"numerable": "^0.3.15",
|
|
67
68
|
"react-blockly": "^8.1.2",
|
|
68
69
|
"react-chartjs-2": "^5.3.0",
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { Button } from 'primereact/button';
|
|
14
14
|
import { InputText } from 'primereact/inputtext';
|
|
15
|
+
// The same glyph the sequence editor puts on the same control (its
|
|
16
|
+
// `IconVariables`). These two pickers sit one tab apart in the same
|
|
17
|
+
// application, so a different icon for the identical action reads as a
|
|
18
|
+
// different feature. Lucide rather than a PrimeIcon because that is the set
|
|
19
|
+
// autocore-ui uses, so the 4.0 port is an import path and not a redraw.
|
|
20
|
+
import { Variable } from 'lucide-react';
|
|
15
21
|
import {
|
|
16
22
|
applyInsert,
|
|
17
23
|
queryFromCaret,
|
|
@@ -98,12 +104,13 @@ export const VariableInput: React.FC<VariableInputProps> = ({
|
|
|
98
104
|
/>
|
|
99
105
|
<Button
|
|
100
106
|
type="button"
|
|
101
|
-
icon="pi pi-list"
|
|
102
107
|
aria-label={ariaLabel}
|
|
103
108
|
disabled={disabled}
|
|
104
109
|
className="p-button-outlined"
|
|
105
110
|
onClick={() => { setBuilt(catalog()); setOpen(true); }}
|
|
106
|
-
|
|
111
|
+
>
|
|
112
|
+
<Variable size={16} aria-hidden />
|
|
113
|
+
</Button>
|
|
107
114
|
{open && (
|
|
108
115
|
<VariablePicker
|
|
109
116
|
visible
|
|
@@ -31580,6 +31580,159 @@ var VariablePicker = ({ visible, catalog, title, hint, initialQuery, onCancel, o
|
|
|
31580
31580
|
});
|
|
31581
31581
|
};
|
|
31582
31582
|
//#endregion
|
|
31583
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
31584
|
+
/**
|
|
31585
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31586
|
+
*
|
|
31587
|
+
* This source code is licensed under the ISC license.
|
|
31588
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31589
|
+
*/
|
|
31590
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
31591
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
31592
|
+
}).join(" ").trim();
|
|
31593
|
+
//#endregion
|
|
31594
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
31595
|
+
/**
|
|
31596
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31597
|
+
*
|
|
31598
|
+
* This source code is licensed under the ISC license.
|
|
31599
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31600
|
+
*/
|
|
31601
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
31602
|
+
//#endregion
|
|
31603
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
|
|
31604
|
+
/**
|
|
31605
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31606
|
+
*
|
|
31607
|
+
* This source code is licensed under the ISC license.
|
|
31608
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31609
|
+
*/
|
|
31610
|
+
var toCamelCase = (string) => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase());
|
|
31611
|
+
//#endregion
|
|
31612
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs
|
|
31613
|
+
/**
|
|
31614
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31615
|
+
*
|
|
31616
|
+
* This source code is licensed under the ISC license.
|
|
31617
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31618
|
+
*/
|
|
31619
|
+
var toPascalCase = (string) => {
|
|
31620
|
+
const camelCase = toCamelCase(string);
|
|
31621
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
31622
|
+
};
|
|
31623
|
+
//#endregion
|
|
31624
|
+
//#region node_modules/lucide-react/dist/esm/defaultAttributes.mjs
|
|
31625
|
+
/**
|
|
31626
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31627
|
+
*
|
|
31628
|
+
* This source code is licensed under the ISC license.
|
|
31629
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31630
|
+
*/
|
|
31631
|
+
var defaultAttributes = {
|
|
31632
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31633
|
+
width: 24,
|
|
31634
|
+
height: 24,
|
|
31635
|
+
viewBox: "0 0 24 24",
|
|
31636
|
+
fill: "none",
|
|
31637
|
+
stroke: "currentColor",
|
|
31638
|
+
strokeWidth: 2,
|
|
31639
|
+
strokeLinecap: "round",
|
|
31640
|
+
strokeLinejoin: "round"
|
|
31641
|
+
};
|
|
31642
|
+
//#endregion
|
|
31643
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
31644
|
+
/**
|
|
31645
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31646
|
+
*
|
|
31647
|
+
* This source code is licensed under the ISC license.
|
|
31648
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31649
|
+
*/
|
|
31650
|
+
var hasA11yProp = (props) => {
|
|
31651
|
+
for (const prop in props) if (prop.startsWith("aria-") || prop === "role" || prop === "title") return true;
|
|
31652
|
+
return false;
|
|
31653
|
+
};
|
|
31654
|
+
//#endregion
|
|
31655
|
+
//#region node_modules/lucide-react/dist/esm/context.mjs
|
|
31656
|
+
/**
|
|
31657
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31658
|
+
*
|
|
31659
|
+
* This source code is licensed under the ISC license.
|
|
31660
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31661
|
+
*/
|
|
31662
|
+
var LucideContext = (0, import_react.createContext)({});
|
|
31663
|
+
var useLucideContext = () => (0, import_react.useContext)(LucideContext);
|
|
31664
|
+
//#endregion
|
|
31665
|
+
//#region node_modules/lucide-react/dist/esm/Icon.mjs
|
|
31666
|
+
/**
|
|
31667
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31668
|
+
*
|
|
31669
|
+
* This source code is licensed under the ISC license.
|
|
31670
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31671
|
+
*/
|
|
31672
|
+
var Icon = (0, import_react.forwardRef)(({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
|
|
31673
|
+
const { size: contextSize = 24, strokeWidth: contextStrokeWidth = 2, absoluteStrokeWidth: contextAbsoluteStrokeWidth = false, color: contextColor = "currentColor", className: contextClass = "" } = useLucideContext() ?? {};
|
|
31674
|
+
const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
|
|
31675
|
+
return (0, import_react.createElement)("svg", {
|
|
31676
|
+
ref,
|
|
31677
|
+
...defaultAttributes,
|
|
31678
|
+
width: size ?? contextSize ?? defaultAttributes.width,
|
|
31679
|
+
height: size ?? contextSize ?? defaultAttributes.height,
|
|
31680
|
+
stroke: color ?? contextColor,
|
|
31681
|
+
strokeWidth: calculatedStrokeWidth,
|
|
31682
|
+
className: mergeClasses("lucide", contextClass, className),
|
|
31683
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
31684
|
+
...rest
|
|
31685
|
+
}, [...iconNode.map(([tag, attrs]) => (0, import_react.createElement)(tag, attrs)), ...Array.isArray(children) ? children : [children]]);
|
|
31686
|
+
});
|
|
31687
|
+
//#endregion
|
|
31688
|
+
//#region node_modules/lucide-react/dist/esm/createLucideIcon.mjs
|
|
31689
|
+
/**
|
|
31690
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31691
|
+
*
|
|
31692
|
+
* This source code is licensed under the ISC license.
|
|
31693
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31694
|
+
*/
|
|
31695
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
31696
|
+
const Component = (0, import_react.forwardRef)(({ className, ...props }, ref) => (0, import_react.createElement)(Icon, {
|
|
31697
|
+
ref,
|
|
31698
|
+
iconNode,
|
|
31699
|
+
className: mergeClasses(`lucide-${toKebabCase(toPascalCase(iconName))}`, `lucide-${iconName}`, className),
|
|
31700
|
+
...props
|
|
31701
|
+
}));
|
|
31702
|
+
Component.displayName = toPascalCase(iconName);
|
|
31703
|
+
return Component;
|
|
31704
|
+
};
|
|
31705
|
+
/**
|
|
31706
|
+
* @license lucide-react v1.39.0 - ISC
|
|
31707
|
+
*
|
|
31708
|
+
* This source code is licensed under the ISC license.
|
|
31709
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31710
|
+
*/
|
|
31711
|
+
var Variable = createLucideIcon("variable", [
|
|
31712
|
+
["path", {
|
|
31713
|
+
d: "M8 21s-4-3-4-9 4-9 4-9",
|
|
31714
|
+
key: "uto9ud"
|
|
31715
|
+
}],
|
|
31716
|
+
["path", {
|
|
31717
|
+
d: "M16 3s4 3 4 9-4 9-4 9",
|
|
31718
|
+
key: "4w2vsq"
|
|
31719
|
+
}],
|
|
31720
|
+
["line", {
|
|
31721
|
+
x1: "15",
|
|
31722
|
+
x2: "9",
|
|
31723
|
+
y1: "9",
|
|
31724
|
+
y2: "15",
|
|
31725
|
+
key: "f7djnv"
|
|
31726
|
+
}],
|
|
31727
|
+
["line", {
|
|
31728
|
+
x1: "9",
|
|
31729
|
+
x2: "15",
|
|
31730
|
+
y1: "9",
|
|
31731
|
+
y2: "15",
|
|
31732
|
+
key: "1shsy8"
|
|
31733
|
+
}]
|
|
31734
|
+
]);
|
|
31735
|
+
//#endregion
|
|
31583
31736
|
//#region src/components/varpick/VariableInput.tsx
|
|
31584
31737
|
/**
|
|
31585
31738
|
* VariableInput — a text input with a picker button.
|
|
@@ -31638,14 +31791,17 @@ var VariableInput = ({ value, onChange, catalog, mode = "replace", pickerTitle,
|
|
|
31638
31791
|
}),
|
|
31639
31792
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
31640
31793
|
type: "button",
|
|
31641
|
-
icon: "pi pi-list",
|
|
31642
31794
|
"aria-label": ariaLabel,
|
|
31643
31795
|
disabled,
|
|
31644
31796
|
className: "p-button-outlined",
|
|
31645
31797
|
onClick: () => {
|
|
31646
31798
|
setBuilt(catalog());
|
|
31647
31799
|
setOpen(true);
|
|
31648
|
-
}
|
|
31800
|
+
},
|
|
31801
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Variable, {
|
|
31802
|
+
size: 16,
|
|
31803
|
+
"aria-hidden": true
|
|
31804
|
+
})
|
|
31649
31805
|
}),
|
|
31650
31806
|
open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VariablePicker, {
|
|
31651
31807
|
visible: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as useMergeProps, B as PrimeReact$2, C as Portal, D as ComponentBase, E as IconBase, F as useUnmountEffect, G as IconUtils, H as ariaLabel$2, I as useUpdateEffect, J as ZIndexUtils, K as ObjectUtils, L as FilterMatchMode$2, M as useOverlayListener, N as usePrevious, O as useHandleStyle, P as useStyle, Q as __toESM, R as FilterOperator, S as Tooltip, T as SpinnerIcon, U as localeOption, V as PrimeReactContext, W as DomHandler, X as require_client, Y as classNames, Z as require_react, _ as OverlayService, b as InputNumber, c as useEditDraft, d as require_jsx_runtime, f as Button, g as CSSTransition, h as VirtualScroller, i as chartFieldCatalog, j as useMountEffect, k as useEventListener, l as FormRow, m as CheckIcon, p as Dropdown, q as UniqueComponentId, s as VariableInput, t as TestFieldDialog, u as Dialog, v as TimesIcon, w as Ripple, x as InputText, y as ChevronDownIcon, z as FilterService } from "./TestFieldDialog-
|
|
1
|
+
import { A as useMergeProps, B as PrimeReact$2, C as Portal, D as ComponentBase, E as IconBase, F as useUnmountEffect, G as IconUtils, H as ariaLabel$2, I as useUpdateEffect, J as ZIndexUtils, K as ObjectUtils, L as FilterMatchMode$2, M as useOverlayListener, N as usePrevious, O as useHandleStyle, P as useStyle, Q as __toESM, R as FilterOperator, S as Tooltip, T as SpinnerIcon, U as localeOption, V as PrimeReactContext, W as DomHandler, X as require_client, Y as classNames, Z as require_react, _ as OverlayService, b as InputNumber, c as useEditDraft, d as require_jsx_runtime, f as Button, g as CSSTransition, h as VirtualScroller, i as chartFieldCatalog, j as useMountEffect, k as useEventListener, l as FormRow, m as CheckIcon, p as Dropdown, q as UniqueComponentId, s as VariableInput, t as TestFieldDialog, u as Dialog, v as TimesIcon, w as Ripple, x as InputText, y as ChevronDownIcon, z as FilterService } from "./TestFieldDialog-BvHAr2GQ.js";
|
|
2
2
|
//#region node_modules/primereact/icons/arrowdown/index.esm.js
|
|
3
3
|
var import_client = require_client();
|
|
4
4
|
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Q as __toESM, X as require_client, Z as require_react, a as configSourceCatalog, d as require_jsx_runtime, i as chartFieldCatalog, n as AuthoringContext, o as cycleSourceCatalog, r as boundCatalog, t as TestFieldDialog } from "./TestFieldDialog-
|
|
1
|
+
import { Q as __toESM, X as require_client, Z as require_react, a as configSourceCatalog, d as require_jsx_runtime, i as chartFieldCatalog, n as AuthoringContext, o as cycleSourceCatalog, r as boundCatalog, t as TestFieldDialog } from "./TestFieldDialog-BvHAr2GQ.js";
|
|
2
2
|
//#region src/hooks/useSequenceProducers.ts
|
|
3
3
|
var import_client = require_client();
|
|
4
4
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
@@ -158,6 +158,13 @@ const buttonLabelled = (root, text) =>
|
|
|
158
158
|
ok('every field dialog input still renders', inputIn('Source') !== undefined);
|
|
159
159
|
ok('Source has a picker button',
|
|
160
160
|
pickerButtonIn('Source')?.getAttribute('aria-label') === 'Choose a source for this field');
|
|
161
|
+
// The Lucide glyph, matching the sequence editor's button for the same action.
|
|
162
|
+
// PrimeReact's Button takes an `icon` STRING for PrimeIcons, so the icon is
|
|
163
|
+
// passed as a child instead — worth asserting, because a Button that silently
|
|
164
|
+
// dropped its children would leave an unlabelled empty square.
|
|
165
|
+
ok('the picker button renders the variable icon',
|
|
166
|
+
pickerButtonIn('Source')?.querySelector('svg.lucide-variable') !== null,
|
|
167
|
+
pickerButtonIn('Source')?.innerHTML?.slice(0, 120));
|
|
161
168
|
|
|
162
169
|
// -- a cycle field picks a SEQUENCE producer, which clears Source ------------
|
|
163
170
|
setValue(inputIn('Source'), 'gm.stale_binding');
|