onekijs-ui 0.19.4 → 0.19.6
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/index.js +24 -18
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +25 -19
- package/dist/index.module.js.map +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/flex.d.ts +1 -1
- package/dist/styles/typography.d.ts +2 -2
- package/package.json +3 -3
- package/src/components/button/SubmitButton.tsx +14 -7
- package/src/components/card/FormCard.tsx +6 -4
- package/src/components/field/util.ts +1 -1
- package/src/components/select/components/SelectTokensComponent.tsx +3 -5
- package/src/components/table/displayers/DefaultCellDisplayer.tsx +0 -3
- package/src/components/wizard/components/FormStep.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -1495,11 +1495,12 @@ const TooltipContent = ({ code, fields }) => {
|
|
|
1495
1495
|
if (code <= onekijsFramework.ValidationCode.Error) {
|
|
1496
1496
|
return (React.createElement(React.Fragment, null,
|
|
1497
1497
|
React.createElement("div", null,
|
|
1498
|
-
"Some fields are
|
|
1498
|
+
"Some fields are ",
|
|
1499
1499
|
code === onekijsFramework.ValidationCode.Error ? 'in error' : 'loading'),
|
|
1500
1500
|
Object.keys(fields).map((fieldName, index) => (React.createElement("div", { key: `error-${index}` },
|
|
1501
|
-
React.createElement(
|
|
1502
|
-
|
|
1501
|
+
fieldName !== onekijsFramework.FORM_GLOBAL_VALIDATION_KEY ? React.createElement(React.Fragment, null,
|
|
1502
|
+
React.createElement("b", null, "fieldName"),
|
|
1503
|
+
":") : '',
|
|
1503
1504
|
fields[fieldName])))));
|
|
1504
1505
|
}
|
|
1505
1506
|
return null;
|
|
@@ -1508,19 +1509,26 @@ const SubmitButton = React.memo((opts) => {
|
|
|
1508
1509
|
const { submitting, code, fields } = onekijsFramework.useSubmit();
|
|
1509
1510
|
const { showErrors, type = 'submit', ...props } = opts;
|
|
1510
1511
|
let disabled = props.disabled || false;
|
|
1512
|
+
let loading = false;
|
|
1513
|
+
let kind = props.kind || 'primary';
|
|
1511
1514
|
let errors = [];
|
|
1512
1515
|
if (code <= onekijsFramework.ValidationCode.Error) {
|
|
1513
1516
|
disabled = true;
|
|
1514
1517
|
if (showErrors) {
|
|
1515
1518
|
errors = Object.keys(fields);
|
|
1516
1519
|
}
|
|
1520
|
+
kind = 'danger';
|
|
1521
|
+
}
|
|
1522
|
+
if (code === onekijsFramework.ValidationCode.Loading) {
|
|
1523
|
+
loading = true;
|
|
1524
|
+
kind = 'dark';
|
|
1517
1525
|
}
|
|
1518
1526
|
// eslint-disable-next-line react/prop-types
|
|
1519
|
-
if (submitting) {
|
|
1527
|
+
if (submitting || loading) {
|
|
1520
1528
|
disabled = true;
|
|
1521
1529
|
}
|
|
1522
|
-
return (React.createElement(Tooltip, { content: errors.length > 0 ? React.createElement(TooltipContent, { code: code, fields: fields }) : undefined, placement: "top", kind:
|
|
1523
|
-
React.createElement(Button, { ...props, disabled: disabled, type: type, loading: submitting }, props.children ? props.children : 'Submit')));
|
|
1530
|
+
return (React.createElement(Tooltip, { content: errors.length > 0 && !loading ? React.createElement(TooltipContent, { code: code, fields: fields }) : undefined, placement: "top", kind: kind, delayHide: 0 },
|
|
1531
|
+
React.createElement(Button, { ...props, kind: kind, disabled: disabled, type: type, loading: submitting || loading }, props.children ? props.children : 'Submit')));
|
|
1524
1532
|
});
|
|
1525
1533
|
SubmitButton.displayName = 'SubmitButton';
|
|
1526
1534
|
|
|
@@ -1673,7 +1681,7 @@ const FormCardDisplayer = styled(FormCardDisplayerComponent) `
|
|
|
1673
1681
|
${formCardDisplayerStyle}
|
|
1674
1682
|
`;
|
|
1675
1683
|
|
|
1676
|
-
const FormCard = ({ name,
|
|
1684
|
+
const FormCard = ({ name, ...cardProps }) => {
|
|
1677
1685
|
const decorator = onekijsFramework.useFormDecorator(name, {
|
|
1678
1686
|
Displayer: (displayerProps) => {
|
|
1679
1687
|
return React.createElement(FormCardDisplayer, { ...displayerProps, name: typeof cardProps.title === 'string' ? cardProps.title : titlelize(name) });
|
|
@@ -1686,8 +1694,10 @@ const FormCard = ({ name, disabled, visible, ...cardProps }) => {
|
|
|
1686
1694
|
});
|
|
1687
1695
|
const { hide, show, disable, enable } = fieldContainer;
|
|
1688
1696
|
React.useEffect(() => {
|
|
1689
|
-
|
|
1690
|
-
|
|
1697
|
+
const visible = metadata.visible ?? true;
|
|
1698
|
+
const disabled = metadata.disabled ?? false;
|
|
1699
|
+
if (!visible) {
|
|
1700
|
+
if (disabled) {
|
|
1691
1701
|
disable();
|
|
1692
1702
|
}
|
|
1693
1703
|
else {
|
|
@@ -1697,7 +1707,7 @@ const FormCard = ({ name, disabled, visible, ...cardProps }) => {
|
|
|
1697
1707
|
}
|
|
1698
1708
|
else {
|
|
1699
1709
|
show();
|
|
1700
|
-
if (
|
|
1710
|
+
if (disabled) {
|
|
1701
1711
|
disable();
|
|
1702
1712
|
}
|
|
1703
1713
|
else {
|
|
@@ -2273,7 +2283,7 @@ const extractFieldLayoutProps = (props) => {
|
|
|
2273
2283
|
];
|
|
2274
2284
|
const fieldOptionsKeys = [
|
|
2275
2285
|
'defaultValue',
|
|
2276
|
-
'
|
|
2286
|
+
'touchOn',
|
|
2277
2287
|
'disabled',
|
|
2278
2288
|
'visible',
|
|
2279
2289
|
'editable',
|
|
@@ -6348,18 +6358,17 @@ SelectTokenComponent.displayName = 'SelectTokenComponent';
|
|
|
6348
6358
|
var SelectTokenComponent$1 = React.memo(SelectTokenComponent);
|
|
6349
6359
|
|
|
6350
6360
|
const SelectTokensComponent = ({ tokens, onRemove, maxDisplayTokens, }) => {
|
|
6351
|
-
const widthRef = React.useRef();
|
|
6352
6361
|
const onExiting = (node) => {
|
|
6353
6362
|
node.style.width = '0';
|
|
6354
6363
|
node.style.opacity = '0';
|
|
6355
6364
|
};
|
|
6356
6365
|
const onEntering = (node) => {
|
|
6357
|
-
|
|
6366
|
+
const width = node.getBoundingClientRect().width;
|
|
6358
6367
|
node.style.width = '0px';
|
|
6359
6368
|
node.style.opacity = '0';
|
|
6360
6369
|
node.style.transition = 'all 150ms';
|
|
6361
6370
|
setTimeout(() => {
|
|
6362
|
-
node.style.width = `${
|
|
6371
|
+
node.style.width = `${width}px`;
|
|
6363
6372
|
node.style.opacity = '1';
|
|
6364
6373
|
}, 0);
|
|
6365
6374
|
};
|
|
@@ -10366,9 +10375,6 @@ const DefaultFormCellDisplayer = (props) => {
|
|
|
10366
10375
|
if (props.column) {
|
|
10367
10376
|
const name = props.column.id ? `${props.rowName}.${props.column.id}` : `${props.rowName}`;
|
|
10368
10377
|
const field = form.fields[name];
|
|
10369
|
-
if (props.column.id === 'value') {
|
|
10370
|
-
console.log(field);
|
|
10371
|
-
}
|
|
10372
10378
|
if (field && field.Displayer) {
|
|
10373
10379
|
const Component = field.Displayer;
|
|
10374
10380
|
return React.createElement(Component, { name: name, label: props.column.id ? props.column.title : '', Displayer: field.Displayer, children: {}, index: 0, first: true, last: true, format: props.format });
|
|
@@ -11292,7 +11298,7 @@ const Step = ({ title, active = false, disabled = false, visible = true, closabl
|
|
|
11292
11298
|
children)));
|
|
11293
11299
|
};
|
|
11294
11300
|
|
|
11295
|
-
const FormStep = ({ name, disabled, visible, ...stepProps }) => {
|
|
11301
|
+
const FormStep = ({ name, disabled = false, visible = true, ...stepProps }) => {
|
|
11296
11302
|
const decorator = onekijsFramework.useFormDecorator(name, {
|
|
11297
11303
|
Displayer: (displayerProps) => {
|
|
11298
11304
|
const total = Object.values(displayerProps.children ?? {}).length;
|