onekijs-ui 0.19.2 → 0.19.4
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/card/FormCardDisplayer.d.ts +3 -0
- package/dist/components/card/components/FormCardDisplayerComponent.d.ts +4 -0
- package/dist/components/card/style.d.ts +2 -0
- package/dist/components/field/FieldDisplayer.d.ts +3 -0
- package/dist/components/field/FieldHelp.d.ts +2 -2
- package/dist/components/field/components/FieldDisplayerComponent.d.ts +4 -0
- package/dist/components/field/hoc/defaultFIeldDisplayer.d.ts +4 -0
- package/dist/components/field/style.d.ts +2 -1
- package/dist/components/field/typings.d.ts +10 -2
- package/dist/components/icon/HideIcon.d.ts +4 -0
- package/dist/components/icon/ShowIcon.d.ts +4 -0
- package/dist/components/input/typings.d.ts +3 -2
- package/dist/components/password/Password.d.ts +3 -0
- package/dist/components/password/components/PasswordComponent.d.ts +4 -0
- package/dist/components/password/style.d.ts +4 -0
- package/dist/components/password/typings.d.ts +4 -0
- package/dist/components/select/SelectService.d.ts +3 -3
- package/dist/components/table/columns/enumColumn.d.ts +1 -1
- package/dist/components/table/columns/inputColumn.d.ts +1 -1
- package/dist/components/table/displayers/DefaultCellDisplayer.d.ts +4 -0
- package/dist/components/table/displayers/FormTableItemDisplayer.d.ts +4 -0
- package/dist/components/table/displayers/FormTableValueDisplayer.d.ts +4 -0
- package/dist/components/table/typings.d.ts +37 -2
- package/dist/components/wizard/WizardSummary.d.ts +3 -0
- package/dist/components/wizard/components/FormStep.d.ts +2 -2
- package/dist/components/wizard/components/WizardSummaryComponent.d.ts +4 -0
- package/dist/components/wizard/style.d.ts +1 -0
- package/dist/components/wizard/typings.d.ts +1 -0
- package/dist/index.d.ts +23 -9
- package/dist/index.js +592 -132
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +573 -131
- package/dist/index.module.js.map +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/typography.d.ts +2 -2
- package/dist/utils/misc.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/card/FormCard.tsx +40 -8
- package/src/components/card/FormCardDisplayer.tsx +9 -0
- package/src/components/card/components/FormCardDisplayerComponent.tsx +18 -0
- package/src/components/card/style.ts +17 -2
- package/src/components/checkbox/FormCheckbox.tsx +30 -3
- package/src/components/field/FieldDisplayer.tsx +9 -0
- package/src/components/field/FieldHelp.tsx +2 -2
- package/src/components/field/components/FieldDisplayerComponent.tsx +36 -0
- package/src/components/field/hoc/defaultFIeldDisplayer.tsx +25 -0
- package/src/components/field/style.ts +50 -3
- package/src/components/field/typings.ts +11 -1
- package/src/components/field/util.ts +20 -4
- package/src/components/icon/HideIcon.tsx +31 -0
- package/src/components/icon/ShowIcon.tsx +30 -0
- package/src/components/input/FormInput.tsx +35 -10
- package/src/components/input/typings.ts +3 -1
- package/src/components/password/Password.tsx +9 -0
- package/src/components/password/components/PasswordComponent.tsx +26 -0
- package/src/components/password/style.ts +26 -0
- package/src/components/password/typings.ts +5 -0
- package/src/components/select/FormSelect.tsx +63 -4
- package/src/components/select/components/ControlledTreeSelectComponent.tsx +1 -1
- package/src/components/table/FormTable.tsx +40 -7
- package/src/components/table/columns/checkboxColumn.ts +2 -0
- package/src/components/table/columns/enumColumn.tsx +3 -1
- package/src/components/table/columns/inputColumn.ts +3 -1
- package/src/components/table/columns/numberColumn.ts +2 -0
- package/src/components/table/columns/selectColumn.ts +2 -0
- package/src/components/table/columns/textColumn.ts +2 -0
- package/src/components/table/columns/textareaColumn.ts +2 -0
- package/src/components/table/displayers/DefaultCellDisplayer.tsx +29 -0
- package/src/components/table/displayers/FormTableItemDisplayer.tsx +49 -0
- package/src/components/table/displayers/FormTableValueDisplayer.tsx +43 -0
- package/src/components/table/typings.ts +41 -1
- package/src/components/textarea/FormTextarea.tsx +33 -9
- package/src/components/wizard/WizardSummary.tsx +9 -0
- package/src/components/wizard/components/FormStep.tsx +77 -11
- package/src/components/wizard/components/Step.tsx +11 -23
- package/src/components/wizard/components/WizardSummaryComponent.tsx +19 -0
- package/src/components/wizard/style.ts +16 -1
- package/src/components/wizard/typings.ts +1 -0
- package/src/index.ts +31 -11
- package/src/utils/misc.ts +5 -0
package/dist/index.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css, keyframes, ThemeContext, ThemeProvider } from 'styled-components';
|
|
2
|
-
import { reducer, service, DefaultService, lcfirst, toKebabCase, useService, get, useTryRouter, ucfirst, toArray, useThrottle, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect$1, useLazyRef, useSubmit, ValidationCode, useFormDecorator, useForm, useFormMetadata, useTrySetting, extractValidators, useField, useValidation, isTrue, set, isFalse, isMobile, saga, SagaEffect, useEventListener, useCollectionInitialState, useCollectionProxy, CollectionService, LoadingStatus, isItemFetching, last, isCollectionInitializing, isCollection, eventLocks, useNotificationService, NotificationLevel, useNotifications, isSameFilter, shallowEqual, clone, ensureFieldValue, defaultComparator, isNull, isItemLoading, isCollectionLoading, isCollectionFetching, first, ValidationStatus, DefaultCollectionBroker, formatFilter, applyFilter, applySearch, applySortBy, formatSortBy, applySort, generateUniqueId, asyncHttp, HttpMethod, applyMixins, useLogger, ContainerValidation, isQueryFilterCriteria, Link,
|
|
2
|
+
import { reducer, service, DefaultService, lcfirst, toKebabCase, useService, get, useTryRouter, ucfirst, toArray, useThrottle, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect$1, useLazyRef, useSubmit, ValidationCode, useFormDecorator, useForm, useFormMetadata, useFieldContainer, FormContext, useTrySetting, extractValidators, useField, useValidation, isTrue, set, isFalse, isMobile, saga, SagaEffect, useEventListener, useCollectionInitialState, useCollectionProxy, CollectionService, LoadingStatus, isItemFetching, last, isCollectionInitializing, isCollection, eventLocks, useNotificationService, NotificationLevel, useNotifications, isSameFilter, shallowEqual, clone, ensureFieldValue, defaultComparator, isNull, isItemLoading, isCollectionLoading, isCollectionFetching, first, ValidationStatus, DefaultCollectionBroker, formatFilter, applyFilter, applySearch, applySortBy, formatSortBy, applySort, generateUniqueId, asyncHttp, HttpMethod, applyMixins, useLogger, ContainerValidation, isQueryFilterCriteria, Link, simpleMergeDeep } from 'onekijs-framework';
|
|
3
3
|
import React, { useContext, useId, useEffect, useState, useRef, useCallback, useMemo, useReducer } from 'react';
|
|
4
4
|
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
@@ -716,7 +716,7 @@ const fill = cssProperty(null, colorFormatter('fill'));
|
|
|
716
716
|
const stroke = cssProperty(null, colorFormatter('stroke'));
|
|
717
717
|
const strokeWidth = cssProperty('stroke-width');
|
|
718
718
|
|
|
719
|
-
const IconComponent$
|
|
719
|
+
const IconComponent$a = ({ className }) => {
|
|
720
720
|
return (React.createElement("i", { className: addClassname('o-icon-loading-container', className) },
|
|
721
721
|
React.createElement("svg", { className: "o-icon-loading-svg", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" },
|
|
722
722
|
React.createElement("circle", { className: "o-icon-loading-svg-circle", cx: "50", cy: "50", r: "45" }))));
|
|
@@ -767,7 +767,7 @@ const iconStyle = ({ width: cssWidth = '16px', height: cssHeight = '16px', color
|
|
|
767
767
|
}
|
|
768
768
|
`;
|
|
769
769
|
};
|
|
770
|
-
var LoadingIcon = styled(IconComponent$
|
|
770
|
+
var LoadingIcon = styled(IconComponent$a) `
|
|
771
771
|
${iconStyle}
|
|
772
772
|
`;
|
|
773
773
|
|
|
@@ -783,7 +783,7 @@ const toDegree = (position) => {
|
|
|
783
783
|
return '0';
|
|
784
784
|
}
|
|
785
785
|
};
|
|
786
|
-
const IconComponent$
|
|
786
|
+
const IconComponent$9 = ({ className, onClick, open, loading, model = 'arrow', closeArrowPosition = 'e', openArrowPosition = 's', }) => {
|
|
787
787
|
const iconClassName = addClassname('o-toggler-icon-container', className);
|
|
788
788
|
if (!loading) {
|
|
789
789
|
return (React.createElement("div", { className: iconClassName, onClick: onClick },
|
|
@@ -799,7 +799,7 @@ const IconComponent$7 = ({ className, onClick, open, loading, model = 'arrow', c
|
|
|
799
799
|
React.createElement(LoadingIcon, null)));
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
|
-
const TogglerIcon = styled(IconComponent$
|
|
802
|
+
const TogglerIcon = styled(IconComponent$9) `
|
|
803
803
|
${({ width = '24px', height = '24px', color: cssColor = 'inherit', visible = true }) => css `
|
|
804
804
|
width: ${width};
|
|
805
805
|
height: ${height};
|
|
@@ -1635,19 +1635,79 @@ const cardStyle = ({ theme, collapsable = true, animate = 150, bordered = true,
|
|
|
1635
1635
|
}
|
|
1636
1636
|
`;
|
|
1637
1637
|
};
|
|
1638
|
+
const formCardDisplayerStyle = () => {
|
|
1639
|
+
return css `
|
|
1640
|
+
.o-displayer-card-title {
|
|
1641
|
+
${borderBottomColor('primary')}
|
|
1642
|
+
${borderBottomWidth('1px')}
|
|
1643
|
+
${borderBottomStyle('solid')}
|
|
1644
|
+
${paddingBottom('sm')}
|
|
1645
|
+
${marginTop('xl')}
|
|
1646
|
+
${fontWeight('bold')}
|
|
1647
|
+
${color('primary')}
|
|
1648
|
+
}
|
|
1649
|
+
`;
|
|
1650
|
+
};
|
|
1638
1651
|
|
|
1639
1652
|
const Card = styled(CardComponent) `
|
|
1640
1653
|
${cardStyle}
|
|
1641
1654
|
`;
|
|
1642
1655
|
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1656
|
+
const titlelize = (value) => {
|
|
1657
|
+
return value.split('_').map((v) => ucfirst(v)).join(' ');
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1660
|
+
const FormCardDisplayerComponent = (displayerProps) => {
|
|
1661
|
+
const total = Object.values(displayerProps.children ?? {}).length;
|
|
1662
|
+
return (React.createElement("div", { className: addClassname('o-displayer-card', displayerProps.className) },
|
|
1663
|
+
React.createElement("div", { className: "o-displayer-card-title" }, displayerProps.name),
|
|
1664
|
+
Object.values(displayerProps.children ?? {}).map((field, index) => {
|
|
1665
|
+
const Displayer = field.Displayer;
|
|
1666
|
+
return React.createElement(Displayer, { ...field, index: index, key: `field-${index}`, first: index === 0, last: index === total - 1, format: displayerProps.format });
|
|
1667
|
+
})));
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
const FormCardDisplayer = styled(FormCardDisplayerComponent) `
|
|
1671
|
+
${formCardDisplayerStyle}
|
|
1672
|
+
`;
|
|
1673
|
+
|
|
1674
|
+
const FormCard = ({ name, disabled, visible, ...cardProps }) => {
|
|
1675
|
+
const decorator = useFormDecorator(name, {
|
|
1676
|
+
Displayer: (displayerProps) => {
|
|
1677
|
+
return React.createElement(FormCardDisplayer, { ...displayerProps, name: typeof cardProps.title === 'string' ? cardProps.title : titlelize(name) });
|
|
1678
|
+
},
|
|
1679
|
+
});
|
|
1645
1680
|
const form = useForm();
|
|
1646
1681
|
const metadata = useFormMetadata(decorator.name);
|
|
1682
|
+
const fieldContainer = useFieldContainer({
|
|
1683
|
+
container: name,
|
|
1684
|
+
});
|
|
1685
|
+
const { hide, show, disable, enable } = fieldContainer;
|
|
1686
|
+
useEffect(() => {
|
|
1687
|
+
if (!metadata.visible) {
|
|
1688
|
+
if (metadata.disabled) {
|
|
1689
|
+
disable();
|
|
1690
|
+
}
|
|
1691
|
+
else {
|
|
1692
|
+
enable();
|
|
1693
|
+
}
|
|
1694
|
+
hide();
|
|
1695
|
+
}
|
|
1696
|
+
else {
|
|
1697
|
+
show();
|
|
1698
|
+
if (metadata.disabled) {
|
|
1699
|
+
disable();
|
|
1700
|
+
}
|
|
1701
|
+
else {
|
|
1702
|
+
enable();
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}, [metadata.visible, metadata.disabled, hide, show, disable, enable]);
|
|
1647
1706
|
if (metadata.visible === false) {
|
|
1648
1707
|
return null;
|
|
1649
1708
|
}
|
|
1650
|
-
return (React.createElement(
|
|
1709
|
+
return (React.createElement(FormContext.Provider, { value: fieldContainer.context },
|
|
1710
|
+
React.createElement(Card, { ...cardProps, open: !metadata.disabled, onToggle: () => (metadata.disabled ? form.enable(decorator.name) : form.disable(decorator.name)) })));
|
|
1651
1711
|
};
|
|
1652
1712
|
|
|
1653
1713
|
const CheckboxComponent = ({ label, className = '', onChange, value = false, bordered = true, status, ...checkboxProps }) => {
|
|
@@ -1866,35 +1926,23 @@ const Row = styled(RowComponent) `
|
|
|
1866
1926
|
${rowStyle}
|
|
1867
1927
|
`;
|
|
1868
1928
|
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
React.createElement("
|
|
1872
|
-
React.createElement(
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
display: inline-block;
|
|
1884
|
-
stroke-width: 0;
|
|
1885
|
-
stroke: currentColor;
|
|
1886
|
-
fill: currentColor;
|
|
1929
|
+
const FieldDisplayerComponent = ({ className, label, value, format }) => {
|
|
1930
|
+
if (format === 'form_summary') {
|
|
1931
|
+
return (React.createElement(Row, { marginBottom: "md", className: addClassname('o-field-displayer-form-summary', className) },
|
|
1932
|
+
React.createElement(Col, { size: 12, md: 4, lg: 3, xl: 2, className: "o-field-displayer-form-summary-label-container" },
|
|
1933
|
+
React.createElement("div", { className: "o-field-displayer-form-summary-label" },
|
|
1934
|
+
React.createElement("span", null, label))),
|
|
1935
|
+
React.createElement(Col, { size: 12, md: 8, lg: 9, xl: 10, className: "o-field-displayer-form-summary-value" }, value)));
|
|
1936
|
+
}
|
|
1937
|
+
if (format === 'form_summary_table') {
|
|
1938
|
+
return (React.createElement("div", { className: addClassname('o-field-displayer-form-summary-table', className) },
|
|
1939
|
+
label && React.createElement("span", { className: "o-field-displayer-form-summary-table-label" },
|
|
1940
|
+
label,
|
|
1941
|
+
":"),
|
|
1942
|
+
React.createElement("span", { className: "o-field-displayer-form-summary-table-value" }, value)));
|
|
1887
1943
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
const FieldHelpComponent = React.memo(({ className, content, visible = true, size = 'medium' }) => {
|
|
1892
|
-
const classNames = addClassname(`o-helper-icon o-helper-icon-${size}`, className);
|
|
1893
|
-
return (React.createElement("div", { className: classNames },
|
|
1894
|
-
React.createElement(Tooltip, { content: content, placement: "top" },
|
|
1895
|
-
React.createElement(HelpIcon, { style: { visibility: visible ? 'visible' : 'hidden' } }))));
|
|
1896
|
-
});
|
|
1897
|
-
FieldHelpComponent.displayName = 'FieldHelpComponent';
|
|
1944
|
+
return null;
|
|
1945
|
+
};
|
|
1898
1946
|
|
|
1899
1947
|
const fieldStyle = () => {
|
|
1900
1948
|
return css `
|
|
@@ -1954,12 +2002,90 @@ const fieldDescriptionStyle = ({ theme, layout }) => {
|
|
|
1954
2002
|
}
|
|
1955
2003
|
`;
|
|
1956
2004
|
};
|
|
2005
|
+
const fieldDisplayerStyle = ({ theme, last }) => {
|
|
2006
|
+
const t = theme.label;
|
|
2007
|
+
return css `
|
|
2008
|
+
${display('flex')}
|
|
2009
|
+
${alignItems('stretch')}
|
|
2010
|
+
&.o-field-displayer-form-summary {
|
|
2011
|
+
${borderBottomWidth(!last ? '1px' : 0)}
|
|
2012
|
+
${borderBottomColor('lighter')}
|
|
2013
|
+
${borderBottomStyle('solid')}
|
|
2014
|
+
}
|
|
2015
|
+
.o-field-displayer-form-summary-label-container {
|
|
2016
|
+
${display('start')}
|
|
2017
|
+
${alignItems('stretch')}
|
|
2018
|
+
${paddingX('md')}
|
|
2019
|
+
${paddingY('xs')}
|
|
2020
|
+
${backgroundColor('lightest')}
|
|
2021
|
+
}
|
|
2022
|
+
.o-field-displayer-form-summary-label {
|
|
2023
|
+
${display('flex')}
|
|
2024
|
+
${alignItems('center')}
|
|
2025
|
+
${fontWeight(t.fontWeight)}
|
|
2026
|
+
${color(t.fontColor)}
|
|
2027
|
+
${fontSize(t.fontSize)}
|
|
2028
|
+
${letterSpacing(t.letterSpacing)}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
.o-field-displayer-form-summary-value {
|
|
2032
|
+
${paddingY('xs')}
|
|
2033
|
+
${paddingX('md')}
|
|
2034
|
+
${fontFamily('Consolas, Monaco, Courier, monospace')}
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
.o-field-displayer-form-summary-table-label {
|
|
2038
|
+
${display('flex')}
|
|
2039
|
+
${fontWeight(t.fontWeight)}
|
|
2040
|
+
${paddingRight('xs')}
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
.o-helper-icon {
|
|
2044
|
+
${fontSize('xl')}
|
|
2045
|
+
${marginLeft(t.helperMarginLeft)}
|
|
2046
|
+
}
|
|
2047
|
+
`;
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
const FieldDisplayer = styled(FieldDisplayerComponent) `
|
|
2051
|
+
${fieldDisplayerStyle}
|
|
2052
|
+
`;
|
|
2053
|
+
|
|
2054
|
+
const IconComponent$8 = ({ className, onClick, style }) => {
|
|
2055
|
+
return (React.createElement("div", { className: addClassname('o-icon-help', className), onClick: onClick, style: style },
|
|
2056
|
+
React.createElement("svg", { className: "o-icon-help-svg", viewBox: "0 0 512 512" },
|
|
2057
|
+
React.createElement("path", { d: "M256 90c44.3 0 86 17.3 117.4 48.6C404.7 170 422 211.7 422 256s-17.3 86-48.6 117.4C342 404.7 300.3 422 256 422s-86-17.3-117.4-48.6C107.3 342 90 300.3 90 256s17.3-86 48.6-117.4C170 107.3 211.7 90 256 90m0-42C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48z" }),
|
|
2058
|
+
React.createElement("path", { d: "M235 339h42v42h-42zM276.8 318h-41.6c0-67 62.4-62.2 62.4-103.8 0-22.9-18.7-41.7-41.6-41.7S214.4 192 214.4 214h-41.6c0-46 37.2-83 83.2-83s83.2 37.1 83.2 83.1c0 52-62.4 57.9-62.4 103.9z" }))));
|
|
2059
|
+
};
|
|
2060
|
+
var HelpIcon = styled(IconComponent$8) `
|
|
2061
|
+
${({ width = '24px', height = '24px', color: cssColor = 'inherit' }) => css `
|
|
2062
|
+
width: ${width};
|
|
2063
|
+
height: ${height};
|
|
2064
|
+
${display('flex')};
|
|
2065
|
+
${alignItems('center')};
|
|
2066
|
+
${color(cssColor)}
|
|
2067
|
+
.o-icon-help-svg {
|
|
2068
|
+
display: inline-block;
|
|
2069
|
+
stroke-width: 0;
|
|
2070
|
+
stroke: currentColor;
|
|
2071
|
+
fill: currentColor;
|
|
2072
|
+
}
|
|
2073
|
+
`}
|
|
2074
|
+
`;
|
|
2075
|
+
|
|
2076
|
+
const FieldHelpComponent = React.memo(({ className, content, visible = true, size = 'medium' }) => {
|
|
2077
|
+
const classNames = addClassname(`o-helper-icon o-helper-icon-${size}`, className);
|
|
2078
|
+
return (React.createElement("div", { className: classNames },
|
|
2079
|
+
React.createElement(Tooltip, { content: content, placement: "top" },
|
|
2080
|
+
React.createElement(HelpIcon, { style: { visibility: visible ? 'visible' : 'hidden' } }))));
|
|
2081
|
+
});
|
|
2082
|
+
FieldHelpComponent.displayName = 'FieldHelpComponent';
|
|
1957
2083
|
|
|
1958
|
-
const
|
|
2084
|
+
const FieldHelp = styled(FieldHelpComponent) `
|
|
1959
2085
|
${fieldHelpStyle}
|
|
1960
2086
|
`;
|
|
1961
2087
|
|
|
1962
|
-
const LabelComponent = React.memo(({ className, htmlFor, help, HelpComponent =
|
|
2088
|
+
const LabelComponent = React.memo(({ className, htmlFor, help, HelpComponent = FieldHelp, layout = 'vertical', required, text, size }) => {
|
|
1963
2089
|
const classNames = addClassname(`o-label o-label-${layout}${size ? ` o-label-${size}` : ''}`, className);
|
|
1964
2090
|
const labelProps = {
|
|
1965
2091
|
className: 'o-label-text',
|
|
@@ -2108,6 +2234,17 @@ const FieldLayout = styled(FieldLayoutComponent) `
|
|
|
2108
2234
|
${fieldStyle}
|
|
2109
2235
|
`;
|
|
2110
2236
|
|
|
2237
|
+
const defaultFieldDisplayer = (props) => {
|
|
2238
|
+
const Component = (displayerProps) => {
|
|
2239
|
+
const form = useForm();
|
|
2240
|
+
let value = form.getValue(displayerProps.name) ?? '';
|
|
2241
|
+
const ValueDisplayer = props.ValueDisplayer ?? (() => React.createElement(React.Fragment, null,
|
|
2242
|
+
React.createElement(React.Fragment, null, `${value || ''}`)));
|
|
2243
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { value: value }), format: displayerProps.format }));
|
|
2244
|
+
};
|
|
2245
|
+
return Component;
|
|
2246
|
+
};
|
|
2247
|
+
|
|
2111
2248
|
// extract validators from props
|
|
2112
2249
|
const extractFieldLayoutProps = (props) => {
|
|
2113
2250
|
const [validators, nonValidatorProps] = extractValidators(props);
|
|
@@ -2132,18 +2269,31 @@ const extractFieldLayoutProps = (props) => {
|
|
|
2132
2269
|
'lgLabelWidth',
|
|
2133
2270
|
'xlLabelWidth',
|
|
2134
2271
|
];
|
|
2135
|
-
const fieldOptionsKeys = [
|
|
2272
|
+
const fieldOptionsKeys = [
|
|
2273
|
+
'defaultValue',
|
|
2274
|
+
'touchedOn',
|
|
2275
|
+
'disabled',
|
|
2276
|
+
'visible',
|
|
2277
|
+
'editable',
|
|
2278
|
+
'protected',
|
|
2279
|
+
'isUndefined',
|
|
2280
|
+
'Displayer',
|
|
2281
|
+
'containers',
|
|
2282
|
+
'ValueDisplayer',
|
|
2283
|
+
'label',
|
|
2284
|
+
];
|
|
2136
2285
|
Object.keys(nonValidatorProps).forEach((k) => {
|
|
2286
|
+
if (!fieldLayoutKeys.includes(k) && !fieldOptionsKeys.includes(k)) {
|
|
2287
|
+
fieldProps[k] = props[k];
|
|
2288
|
+
}
|
|
2137
2289
|
if (fieldLayoutKeys.includes(k)) {
|
|
2138
2290
|
fieldLayoutProps[k] = props[k];
|
|
2139
2291
|
}
|
|
2140
|
-
|
|
2292
|
+
if (fieldOptionsKeys.includes(k)) {
|
|
2141
2293
|
fieldOptions[k] = props[k];
|
|
2142
2294
|
}
|
|
2143
|
-
else if (k !== 'name') {
|
|
2144
|
-
fieldProps[k] = props[k];
|
|
2145
|
-
}
|
|
2146
2295
|
});
|
|
2296
|
+
fieldOptions.Displayer = fieldOptions.Displayer ?? defaultFieldDisplayer(props);
|
|
2147
2297
|
return {
|
|
2148
2298
|
name: props.name,
|
|
2149
2299
|
validators,
|
|
@@ -2180,11 +2330,53 @@ const useFieldLayout = (props) => {
|
|
|
2180
2330
|
];
|
|
2181
2331
|
};
|
|
2182
2332
|
|
|
2333
|
+
const RemoveIcon = ({ className, onClick }) => {
|
|
2334
|
+
return (React.createElement("div", { className: className, onClick: onClick },
|
|
2335
|
+
React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: "0 0 16 16", width: "100%", height: "100%" },
|
|
2336
|
+
React.createElement("path", { fill: "currentColor", d: "M15.854 12.854c-0-0-0-0-0-0l-4.854-4.854 4.854-4.854c0-0 0-0 0-0 0.052-0.052 0.090-0.113 0.114-0.178 0.066-0.178 0.028-0.386-0.114-0.529l-2.293-2.293c-0.143-0.143-0.351-0.181-0.529-0.114-0.065 0.024-0.126 0.062-0.178 0.114 0 0-0 0-0 0l-4.854 4.854-4.854-4.854c-0-0-0-0-0-0-0.052-0.052-0.113-0.090-0.178-0.114-0.178-0.066-0.386-0.029-0.529 0.114l-2.293 2.293c-0.143 0.143-0.181 0.351-0.114 0.529 0.024 0.065 0.062 0.126 0.114 0.178 0 0 0 0 0 0l4.854 4.854-4.854 4.854c-0 0-0 0-0 0-0.052 0.052-0.090 0.113-0.114 0.178-0.066 0.178-0.029 0.386 0.114 0.529l2.293 2.293c0.143 0.143 0.351 0.181 0.529 0.114 0.065-0.024 0.126-0.062 0.178-0.114 0-0 0-0 0-0l4.854-4.854 4.854 4.854c0 0 0 0 0 0 0.052 0.052 0.113 0.090 0.178 0.114 0.178 0.066 0.386 0.029 0.529-0.114l2.293-2.293c0.143-0.143 0.181-0.351 0.114-0.529-0.024-0.065-0.062-0.126-0.114-0.178z" }))));
|
|
2337
|
+
};
|
|
2338
|
+
var RemoveIcon$1 = styled(RemoveIcon) `
|
|
2339
|
+
${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => css `
|
|
2340
|
+
width: ${width};
|
|
2341
|
+
height: ${height};
|
|
2342
|
+
${display('flex')};
|
|
2343
|
+
${alignItems('center')};
|
|
2344
|
+
${color(cssColor)}
|
|
2345
|
+
`}
|
|
2346
|
+
`;
|
|
2347
|
+
|
|
2348
|
+
const SuccessIconComponent = (props) => {
|
|
2349
|
+
return (React.createElement("div", { ...props },
|
|
2350
|
+
React.createElement("svg", { className: "o-icon-success-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 16", fill: "currentColor" },
|
|
2351
|
+
React.createElement("path", { fillRule: "evenodd", d: "M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z" }))));
|
|
2352
|
+
};
|
|
2353
|
+
var SuccessIcon = styled(SuccessIconComponent) `
|
|
2354
|
+
${({ width = '16px', height = '16px', color: cssColor = 'success' }) => css `
|
|
2355
|
+
width: ${width};
|
|
2356
|
+
height: ${height};
|
|
2357
|
+
${display('flex')};
|
|
2358
|
+
${alignItems('center')};
|
|
2359
|
+
${color(cssColor)}
|
|
2360
|
+
.o-icon-success-svg {
|
|
2361
|
+
display: inline-block;
|
|
2362
|
+
fill: currentColor;
|
|
2363
|
+
}
|
|
2364
|
+
`}
|
|
2365
|
+
`;
|
|
2366
|
+
|
|
2367
|
+
const FormCheckboxValueDisplayer = ({ value }) => {
|
|
2368
|
+
return (React.createElement("div", { style: { display: 'flex', alignItems: 'center', marginTop: value ? '2px' : '4px' } }, value ? React.createElement(SuccessIcon, null) : React.createElement(RemoveIcon$1, { color: "red", width: "14px", height: "14px" })));
|
|
2369
|
+
};
|
|
2183
2370
|
const FormCheckbox = React.memo((props) => {
|
|
2184
|
-
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({
|
|
2185
|
-
defaultValue: props.defaultValue !== true ? false : true,
|
|
2186
|
-
}, props, {
|
|
2371
|
+
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({}, props, {
|
|
2187
2372
|
isUndefined: (value) => value !== true && value !== false,
|
|
2373
|
+
defaultValue: props.defaultValue !== true ? false : true,
|
|
2374
|
+
Displayer: props.Displayer === undefined ? ((displayerProps) => {
|
|
2375
|
+
const form = useForm();
|
|
2376
|
+
let value = form.getValue(displayerProps.name) ?? false;
|
|
2377
|
+
const ValueDisplayer = props.ValueDisplayer ?? FormCheckboxValueDisplayer;
|
|
2378
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { value: value }), format: displayerProps.format }));
|
|
2379
|
+
}) : props.Displayer,
|
|
2188
2380
|
}));
|
|
2189
2381
|
const Component = props.FieldComponent || Checkbox;
|
|
2190
2382
|
return (React.createElement(FieldLayout, { ...fieldLayoutProps, required: props.required },
|
|
@@ -3549,14 +3741,14 @@ const DashboardLeft = dashboardVerticalPanel('left');
|
|
|
3549
3741
|
|
|
3550
3742
|
const DashboardRight = dashboardVerticalPanel('right');
|
|
3551
3743
|
|
|
3552
|
-
const IconComponent$
|
|
3744
|
+
const IconComponent$7 = (props) => {
|
|
3553
3745
|
return (React.createElement("div", { ...props },
|
|
3554
3746
|
React.createElement("svg", { className: "o-icon-menu-svg", viewBox: "0 0 100 100" },
|
|
3555
3747
|
React.createElement("rect", { width: "100", height: "15", rx: "15", ry: "15" }),
|
|
3556
3748
|
React.createElement("rect", { y: "40", width: "100", height: "15", rx: "15", ry: "15" }),
|
|
3557
3749
|
React.createElement("rect", { y: "80", width: "100", height: "15", rx: "15", ry: "15" }))));
|
|
3558
3750
|
};
|
|
3559
|
-
var MenuIcon = styled(IconComponent$
|
|
3751
|
+
var MenuIcon = styled(IconComponent$7) `
|
|
3560
3752
|
${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => css `
|
|
3561
3753
|
width: ${width};
|
|
3562
3754
|
height: ${height};
|
|
@@ -3603,13 +3795,13 @@ const useDashoardBodyPanel = () => {
|
|
|
3603
3795
|
return state.body;
|
|
3604
3796
|
};
|
|
3605
3797
|
|
|
3606
|
-
const IconComponent$
|
|
3798
|
+
const IconComponent$6 = ({ className, onClick }) => {
|
|
3607
3799
|
return (React.createElement("div", { className: className, onClick: onClick },
|
|
3608
3800
|
React.createElement("svg", { className: "o-icon-close-all-svg", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
|
|
3609
3801
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.621 8.086l-.707-.707L6.5 8.793 5.086 7.379l-.707.707L5.793 9.5l-1.414 1.414.707.707L6.5 10.207l1.414 1.414.707-.707L7.207 9.5l1.414-1.414z" }),
|
|
3610
3802
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5 3l1-1h7l1 1v7l-1 1h-2v2l-1 1H3l-1-1V6l1-1h2V3zm1 2h4l1 1v4h2V3H6v2zm4 1H3v7h7V6z" }))));
|
|
3611
3803
|
};
|
|
3612
|
-
var CloseAllIcon = styled(IconComponent$
|
|
3804
|
+
var CloseAllIcon = styled(IconComponent$6) `
|
|
3613
3805
|
${({ width, height, color: cssColor = 'inherit' }) => css `
|
|
3614
3806
|
width: ${width};
|
|
3615
3807
|
height: ${height};
|
|
@@ -3624,12 +3816,12 @@ var CloseAllIcon = styled(IconComponent$4) `
|
|
|
3624
3816
|
|
|
3625
3817
|
//#region -- system import
|
|
3626
3818
|
//#endregion
|
|
3627
|
-
const IconComponent$
|
|
3819
|
+
const IconComponent$5 = ({ className }) => {
|
|
3628
3820
|
return (React.createElement("div", { className: className },
|
|
3629
3821
|
React.createElement("svg", { className: "o-icon-close-svg", viewBox: "0 0 100 100" },
|
|
3630
3822
|
React.createElement("path", { d: "M35.6 34.4L28 26.8l7.6-7.6c.2-.2.2-.5 0-.7l-.5-.5c-.2-.2-.5-.2-.7 0l-7.6 7.6-7.5-7.6c-.2-.2-.5-.2-.7 0l-.6.6c-.2.2-.2.5 0 .7l7.6 7.6-7.6 7.5c-.2.2-.2.5 0 .7l.5.5c.2.2.5.2.7 0l7.6-7.6 7.6 7.6c.2.2.5.2.7 0l.5-.5c.2-.2.2-.5 0-.7z" }))));
|
|
3631
3823
|
};
|
|
3632
|
-
const CrossIcon = styled(IconComponent$
|
|
3824
|
+
const CrossIcon = styled(IconComponent$5) `
|
|
3633
3825
|
width: ${(props) => props.width || '32px'};
|
|
3634
3826
|
height: ${(props) => props.height || '32px'};
|
|
3635
3827
|
.o-icon-close-svg {
|
|
@@ -3662,13 +3854,13 @@ var ErrorIcon = styled(ErrorIconComponent) `
|
|
|
3662
3854
|
`}
|
|
3663
3855
|
`;
|
|
3664
3856
|
|
|
3665
|
-
const IconComponent$
|
|
3857
|
+
const IconComponent$4 = (props) => {
|
|
3666
3858
|
const className = addClassname('o-icon-file', props.className);
|
|
3667
3859
|
return (React.createElement("div", { ...props, className: className },
|
|
3668
3860
|
React.createElement("svg", { className: "o-icon-file-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024", width: "16px", height: "16px" },
|
|
3669
3861
|
React.createElement("path", { d: "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z" }))));
|
|
3670
3862
|
};
|
|
3671
|
-
var FileIcon = styled(IconComponent$
|
|
3863
|
+
var FileIcon = styled(IconComponent$4) `
|
|
3672
3864
|
${({ width = '16px', height = '16px', color: cssColor = 'currentColor' }) => css `
|
|
3673
3865
|
width: ${width};
|
|
3674
3866
|
height: ${height};
|
|
@@ -3681,13 +3873,13 @@ var FileIcon = styled(IconComponent$2) `
|
|
|
3681
3873
|
`}
|
|
3682
3874
|
`;
|
|
3683
3875
|
|
|
3684
|
-
const IconComponent$
|
|
3876
|
+
const IconComponent$3 = (props) => {
|
|
3685
3877
|
const className = addClassname('o-icon-folder', props.className);
|
|
3686
3878
|
return (React.createElement("div", { ...props, className: className },
|
|
3687
3879
|
React.createElement("svg", { className: "o-icon-folder-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24px", height: "24px" },
|
|
3688
3880
|
React.createElement("path", { d: "M20,6h-8l-2-2H4C2.9,4,2,4.9,2,6v12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8C22,6.9,21.1,6,20,6z" }))));
|
|
3689
3881
|
};
|
|
3690
|
-
var FolderIcon = styled(IconComponent$
|
|
3882
|
+
var FolderIcon = styled(IconComponent$3) `
|
|
3691
3883
|
${({ width = '24px', height = '24px', color: cssColor = 'currentColor' }) => css `
|
|
3692
3884
|
width: ${width};
|
|
3693
3885
|
height: ${height};
|
|
@@ -3700,12 +3892,12 @@ var FolderIcon = styled(IconComponent$1) `
|
|
|
3700
3892
|
`}
|
|
3701
3893
|
`;
|
|
3702
3894
|
|
|
3703
|
-
const IconComponent = ({ className, onClick }) => {
|
|
3895
|
+
const IconComponent$2 = ({ className, onClick }) => {
|
|
3704
3896
|
return (React.createElement("div", { className: className, onClick: onClick },
|
|
3705
3897
|
React.createElement("svg", { className: "o-icon-search-svg", viewBox: "0 0 118.783 118.783" },
|
|
3706
3898
|
React.createElement("path", { d: "M115.97,101.597L88.661,74.286c4.64-7.387,7.333-16.118,7.333-25.488c0-26.509-21.49-47.996-47.998-47.996\n\t\tS0,22.289,0,48.798c0,26.51,21.487,47.995,47.996,47.995c10.197,0,19.642-3.188,27.414-8.605l26.984,26.986\n\t\tc1.875,1.873,4.333,2.806,6.788,2.806c2.458,0,4.913-0.933,6.791-2.806C119.72,111.423,119.72,105.347,115.97,101.597z\n\t\t M47.996,81.243c-17.917,0-32.443-14.525-32.443-32.443s14.526-32.444,32.443-32.444c17.918,0,32.443,14.526,32.443,32.444\n\t\tS65.914,81.243,47.996,81.243z" }))));
|
|
3707
3899
|
};
|
|
3708
|
-
var SearchIcon = styled(IconComponent) `
|
|
3900
|
+
var SearchIcon = styled(IconComponent$2) `
|
|
3709
3901
|
${({ width, height, color: cssColor = 'inherit' }) => css `
|
|
3710
3902
|
width: ${width};
|
|
3711
3903
|
height: ${height};
|
|
@@ -3721,25 +3913,6 @@ var SearchIcon = styled(IconComponent) `
|
|
|
3721
3913
|
`}
|
|
3722
3914
|
`;
|
|
3723
3915
|
|
|
3724
|
-
const SuccessIconComponent = (props) => {
|
|
3725
|
-
return (React.createElement("div", { ...props },
|
|
3726
|
-
React.createElement("svg", { className: "o-icon-success-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 16", fill: "currentColor" },
|
|
3727
|
-
React.createElement("path", { fillRule: "evenodd", d: "M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z" }))));
|
|
3728
|
-
};
|
|
3729
|
-
var SuccessIcon = styled(SuccessIconComponent) `
|
|
3730
|
-
${({ width = '16px', height = '16px', color: cssColor = 'success' }) => css `
|
|
3731
|
-
width: ${width};
|
|
3732
|
-
height: ${height};
|
|
3733
|
-
${display('flex')};
|
|
3734
|
-
${alignItems('center')};
|
|
3735
|
-
${color(cssColor)}
|
|
3736
|
-
.o-icon-success-svg {
|
|
3737
|
-
display: inline-block;
|
|
3738
|
-
fill: currentColor;
|
|
3739
|
-
}
|
|
3740
|
-
`}
|
|
3741
|
-
`;
|
|
3742
|
-
|
|
3743
3916
|
const InputComponent = (props) => {
|
|
3744
3917
|
const { className, size = 'medium', status, PrefixComponent, SuffixComponent, onFocus: forwardFocus, onBlur: forwardBlur, onChange: forwardChange, value, ...inputProps } = props;
|
|
3745
3918
|
const [focus, setFocus] = useState(false);
|
|
@@ -3846,12 +4019,96 @@ const Input = styled(InputComponent) `
|
|
|
3846
4019
|
${inputStyle}
|
|
3847
4020
|
`;
|
|
3848
4021
|
|
|
4022
|
+
const IconComponent$1 = (props) => {
|
|
4023
|
+
const className = addClassname('o-icon-hide', props.className);
|
|
4024
|
+
return (React.createElement("div", { ...props, className: className },
|
|
4025
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "o-icon-hide-svg", viewBox: "0 0 1024 1024" },
|
|
4026
|
+
React.createElement("path", { d: "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z" }),
|
|
4027
|
+
React.createElement("path", { d: "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z" }))));
|
|
4028
|
+
};
|
|
4029
|
+
var HideIcon = styled(IconComponent$1) `
|
|
4030
|
+
${({ width = '16px', height = '16px', color: cssColor = 'currentColor' }) => css `
|
|
4031
|
+
width: ${width};
|
|
4032
|
+
height: ${height};
|
|
4033
|
+
${display('flex')};
|
|
4034
|
+
${alignItems('center')};
|
|
4035
|
+
.o-icon-hide-svg {
|
|
4036
|
+
display: inline-block;
|
|
4037
|
+
fill: ${cssColor};
|
|
4038
|
+
}
|
|
4039
|
+
`}
|
|
4040
|
+
`;
|
|
4041
|
+
|
|
4042
|
+
const IconComponent = (props) => {
|
|
4043
|
+
const className = addClassname('o-icon-show', props.className);
|
|
4044
|
+
return (React.createElement("div", { ...props, className: className },
|
|
4045
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "o-icon-show-svg", viewBox: "0 0 1024 1024" },
|
|
4046
|
+
React.createElement("path", { d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" }))));
|
|
4047
|
+
};
|
|
4048
|
+
var ShowIcon = styled(IconComponent) `
|
|
4049
|
+
${({ width = '16px', height = '16px', color: cssColor = 'currentColor' }) => css `
|
|
4050
|
+
width: ${width};
|
|
4051
|
+
height: ${height};
|
|
4052
|
+
${display('flex')};
|
|
4053
|
+
${alignItems('center')};
|
|
4054
|
+
.o-icon-show-svg {
|
|
4055
|
+
display: inline-block;
|
|
4056
|
+
fill: ${cssColor};
|
|
4057
|
+
}
|
|
4058
|
+
`}
|
|
4059
|
+
`;
|
|
4060
|
+
|
|
4061
|
+
const PasswordComponent = ({ className, value }) => {
|
|
4062
|
+
const [show, setShow] = useState(false);
|
|
4063
|
+
if (show) {
|
|
4064
|
+
return (React.createElement("span", { className: addClassname('o-password', className) },
|
|
4065
|
+
React.createElement("span", { className: "o-password-text" }, value),
|
|
4066
|
+
React.createElement(HideIcon, { onClick: () => setShow(false) })));
|
|
4067
|
+
}
|
|
4068
|
+
return (React.createElement("span", { className: addClassname('o-password o-password-obfuscated', className) },
|
|
4069
|
+
React.createElement("span", { className: "o-password-text" }, value),
|
|
4070
|
+
React.createElement(ShowIcon, { onClick: () => setShow(true) })));
|
|
4071
|
+
};
|
|
4072
|
+
|
|
4073
|
+
const passwordStyle = () => {
|
|
4074
|
+
return css `
|
|
4075
|
+
${display('flex')}
|
|
4076
|
+
${alignItems('center')}
|
|
4077
|
+
.g-icon-obfuscated-password {
|
|
4078
|
+
${fontSize('xl')}
|
|
4079
|
+
${marginBottom('-8px')}
|
|
4080
|
+
}
|
|
4081
|
+
.g-icon-show-password {
|
|
4082
|
+
${color('primary')}
|
|
4083
|
+
${marginLeft('sm')}
|
|
4084
|
+
${cursor('pointer')}
|
|
4085
|
+
}
|
|
4086
|
+
`;
|
|
4087
|
+
};
|
|
4088
|
+
|
|
4089
|
+
const Password = styled(PasswordComponent) `
|
|
4090
|
+
${passwordStyle}
|
|
4091
|
+
`;
|
|
4092
|
+
|
|
4093
|
+
const FormInputValueDisplayer = ({ value }) => {
|
|
4094
|
+
return React.createElement("span", { className: "o-input-displayer-value" }, value ?? '');
|
|
4095
|
+
};
|
|
3849
4096
|
const FormInput = React.memo((props) => {
|
|
3850
|
-
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({
|
|
4097
|
+
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({}, props, {
|
|
3851
4098
|
defaultValue: props.defaultValue === undefined ? '' : props.defaultValue,
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
4099
|
+
isUndefined: props.isUndefined === undefined ? (value) => value === undefined || value === null : props.isUndefined,
|
|
4100
|
+
protected: props.protected === undefined ? props.type === 'password' : props.protected,
|
|
4101
|
+
Displayer: props.Displayer === undefined
|
|
4102
|
+
? (displayerProps) => {
|
|
4103
|
+
const form = useForm();
|
|
4104
|
+
let value = form.getValue(displayerProps.name) ?? '';
|
|
4105
|
+
if (props.type === 'password' && value !== '') {
|
|
4106
|
+
value = React.createElement(Password, { value: value });
|
|
4107
|
+
}
|
|
4108
|
+
const ValueDisplayer = props.ValueDisplayer ?? FormInputValueDisplayer;
|
|
4109
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { value: value }), format: displayerProps.format }));
|
|
4110
|
+
}
|
|
4111
|
+
: props.Displayer,
|
|
3855
4112
|
}));
|
|
3856
4113
|
const Component = props.FieldComponent || Input;
|
|
3857
4114
|
return (React.createElement(FieldLayout, { ...fieldLayoutProps, required: props.required },
|
|
@@ -7219,10 +7476,51 @@ const Select = styled(SelectComponent$1) `
|
|
|
7219
7476
|
${selectStyle}
|
|
7220
7477
|
`;
|
|
7221
7478
|
|
|
7479
|
+
const FormSelectValueDisplayer = ({ value }) => {
|
|
7480
|
+
if (Array.isArray(value)) {
|
|
7481
|
+
return (React.createElement(React.Fragment, null, value.map((v, index) => React.createElement("div", { key: `item-${index}`, className: "o-select-displayer-value" }, v ?? ''))));
|
|
7482
|
+
}
|
|
7483
|
+
return React.createElement("span", { className: "o-select-displayer-value" }, value ?? '');
|
|
7484
|
+
};
|
|
7222
7485
|
const FormSelect = (props) => {
|
|
7486
|
+
const service = props.controller ? props.controller.asService() : undefined;
|
|
7223
7487
|
const defaultValue = props.defaultValue === undefined ? (props.multiple ? [] : null) : props.defaultValue;
|
|
7224
7488
|
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({}, props, {
|
|
7225
7489
|
defaultValue,
|
|
7490
|
+
Displayer: props.Displayer ?? ((displayerProps) => {
|
|
7491
|
+
const form = useForm();
|
|
7492
|
+
let value = form.getValue(displayerProps.name) ?? '';
|
|
7493
|
+
const adapter = props.adapter;
|
|
7494
|
+
if (value === undefined || value === null) {
|
|
7495
|
+
value = '';
|
|
7496
|
+
}
|
|
7497
|
+
else if (service) {
|
|
7498
|
+
if (Array.isArray(value)) {
|
|
7499
|
+
value = value.map((v) => {
|
|
7500
|
+
const adaptee = service.adapt(v);
|
|
7501
|
+
return adaptee.text ?? `${value}`;
|
|
7502
|
+
});
|
|
7503
|
+
}
|
|
7504
|
+
else {
|
|
7505
|
+
const adaptee = service.adapt(value);
|
|
7506
|
+
value = adaptee.text ?? `${value}`;
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
else if (adapter) {
|
|
7510
|
+
if (Array.isArray(value)) {
|
|
7511
|
+
value = value.map((v) => {
|
|
7512
|
+
const adaptee = adapter(v);
|
|
7513
|
+
return adaptee.text ?? `${value}`;
|
|
7514
|
+
});
|
|
7515
|
+
}
|
|
7516
|
+
else {
|
|
7517
|
+
const adaptee = adapter(value);
|
|
7518
|
+
value = adaptee.text ?? `${value}`;
|
|
7519
|
+
}
|
|
7520
|
+
}
|
|
7521
|
+
const ValueDisplayer = props.ValueDisplayer ?? FormSelectValueDisplayer;
|
|
7522
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { value: value }), format: displayerProps.format }));
|
|
7523
|
+
}),
|
|
7226
7524
|
}));
|
|
7227
7525
|
const Component = props.FieldComponent || Select;
|
|
7228
7526
|
return (React.createElement(FieldLayout, { ...fieldLayoutProps, required: props.required },
|
|
@@ -9173,7 +9471,7 @@ const DefaultTableHeaderTitleComponent = ({ column, sort }) => {
|
|
|
9173
9471
|
};
|
|
9174
9472
|
return (React.createElement("div", { onClick: isSortable ? onSort : undefined, style: { display: 'flex', alignItems: 'center' } },
|
|
9175
9473
|
React.createElement("span", { className: "o-table-header-title" }, column.title),
|
|
9176
|
-
column.help && React.createElement(
|
|
9474
|
+
column.help && React.createElement(FieldHelp, { content: column.help, size: "small" }),
|
|
9177
9475
|
isSortable && React.createElement(TableSortComponent, { sort: sort, column: column })));
|
|
9178
9476
|
};
|
|
9179
9477
|
const TableHeaderTitleComponent = React.memo((props) => {
|
|
@@ -9852,21 +10150,6 @@ const Table = styled(TableComponent) `
|
|
|
9852
10150
|
${tableStyle}
|
|
9853
10151
|
`;
|
|
9854
10152
|
|
|
9855
|
-
const RemoveIcon = ({ className, onClick }) => {
|
|
9856
|
-
return (React.createElement("div", { className: className, onClick: onClick },
|
|
9857
|
-
React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: "0 0 16 16", width: "100%", height: "100%" },
|
|
9858
|
-
React.createElement("path", { fill: "currentColor", d: "M15.854 12.854c-0-0-0-0-0-0l-4.854-4.854 4.854-4.854c0-0 0-0 0-0 0.052-0.052 0.090-0.113 0.114-0.178 0.066-0.178 0.028-0.386-0.114-0.529l-2.293-2.293c-0.143-0.143-0.351-0.181-0.529-0.114-0.065 0.024-0.126 0.062-0.178 0.114 0 0-0 0-0 0l-4.854 4.854-4.854-4.854c-0-0-0-0-0-0-0.052-0.052-0.113-0.090-0.178-0.114-0.178-0.066-0.386-0.029-0.529 0.114l-2.293 2.293c-0.143 0.143-0.181 0.351-0.114 0.529 0.024 0.065 0.062 0.126 0.114 0.178 0 0 0 0 0 0l4.854 4.854-4.854 4.854c-0 0-0 0-0 0-0.052 0.052-0.090 0.113-0.114 0.178-0.066 0.178-0.029 0.386 0.114 0.529l2.293 2.293c0.143 0.143 0.351 0.181 0.529 0.114 0.065-0.024 0.126-0.062 0.178-0.114 0-0 0-0 0-0l4.854-4.854 4.854 4.854c0 0 0 0 0 0 0.052 0.052 0.113 0.090 0.178 0.114 0.178 0.066 0.386 0.029 0.529-0.114l2.293-2.293c0.143-0.143 0.181-0.351 0.114-0.529-0.024-0.065-0.062-0.126-0.114-0.178z" }))));
|
|
9859
|
-
};
|
|
9860
|
-
var RemoveIcon$1 = styled(RemoveIcon) `
|
|
9861
|
-
${({ width = '16px', height = '16px', color: cssColor = 'inherit' }) => css `
|
|
9862
|
-
width: ${width};
|
|
9863
|
-
height: ${height};
|
|
9864
|
-
${display('flex')};
|
|
9865
|
-
${alignItems('center')};
|
|
9866
|
-
${color(cssColor)}
|
|
9867
|
-
`}
|
|
9868
|
-
`;
|
|
9869
|
-
|
|
9870
10153
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9871
10154
|
const DefaultFormTableContext = React.createContext(null);
|
|
9872
10155
|
const useFormTableContext = () => {
|
|
@@ -9994,6 +10277,42 @@ const FormTableComponent = React.memo(({ addLabel = 'add', controller, value, on
|
|
|
9994
10277
|
});
|
|
9995
10278
|
FormTableComponent.displayName = 'FormTable';
|
|
9996
10279
|
|
|
10280
|
+
const FormTableItemDisplayer = ({ value, columns, first, last, className, format, name, index, }) => {
|
|
10281
|
+
const userColumns = columns.filter((c) => !c.id.startsWith('system.'));
|
|
10282
|
+
const monoColumnTable = userColumns.length === 1 && !userColumns[0].id;
|
|
10283
|
+
const classNames = monoColumnTable
|
|
10284
|
+
? 'o-form-mono-column-table-item-displayer'
|
|
10285
|
+
: `o-form-table-item-displayer${first ? ' o-form-table-item-displayer-first' : ''}${last ? ' o-form-table-item-displayer-last' : ''}`;
|
|
10286
|
+
return (React.createElement("div", { className: addClassname(classNames, className) }, userColumns.map((column, colIndex) => {
|
|
10287
|
+
const Displayer = column.Displayer;
|
|
10288
|
+
if (Displayer) {
|
|
10289
|
+
return (React.createElement(Displayer, { column: column, firstRow: first, lastRow: last, rowIndex: index, firstCol: colIndex === 0, lastCol: colIndex === columns.length - 1, colIndex: colIndex, format: format, value: value, rowName: name, key: `col-${colIndex}` }));
|
|
10290
|
+
}
|
|
10291
|
+
return null;
|
|
10292
|
+
})));
|
|
10293
|
+
};
|
|
10294
|
+
|
|
10295
|
+
const FormTableValueDisplayer = ({ name, columns, value, format, className }) => {
|
|
10296
|
+
if (!Array.isArray(value))
|
|
10297
|
+
return null;
|
|
10298
|
+
return (React.createElement("div", { className: addClassname('o-form-table-displayer-value', className) }, value.map((v, index) => (React.createElement(FormTableItemDisplayer, { key: `item-${index}`, value: v, columns: columns, first: index === 0, last: index === value.length - 1, format: format === 'csv' ? 'csv' : 'form_summary_table', name: `${name}.${index}`, index: index })))));
|
|
10299
|
+
};
|
|
10300
|
+
var FormTableValueDisplayer$1 = styled(FormTableValueDisplayer) `
|
|
10301
|
+
.o-form-table-item-displayer {
|
|
10302
|
+
${borderBottomColor('primary')}
|
|
10303
|
+
${borderBottomStyle('solid')}
|
|
10304
|
+
${borderBottomWidth('1px')}
|
|
10305
|
+
${paddingY('sm')}
|
|
10306
|
+
&.o-form-table-item-displayer-last{
|
|
10307
|
+
${paddingBottom(0)}
|
|
10308
|
+
${borderBottomWidth(0)}
|
|
10309
|
+
}
|
|
10310
|
+
&.o-form-table-item-displayer-first{
|
|
10311
|
+
${paddingTop(0)}
|
|
10312
|
+
}
|
|
10313
|
+
}
|
|
10314
|
+
`;
|
|
10315
|
+
|
|
9997
10316
|
const StyledFormTableComponent = styled(FormTableComponent) `
|
|
9998
10317
|
${tableStyle}
|
|
9999
10318
|
`;
|
|
@@ -10009,10 +10328,20 @@ const FormTable = React.memo((props) => {
|
|
|
10009
10328
|
}
|
|
10010
10329
|
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({
|
|
10011
10330
|
defaultValue,
|
|
10331
|
+
Displayer: (displayerProps) => {
|
|
10332
|
+
const form = useForm();
|
|
10333
|
+
let value = form.getValue(displayerProps.name) ?? [];
|
|
10334
|
+
const ValueDisplayer = props.ValueDisplayer ?? FormTableValueDisplayer$1;
|
|
10335
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { name: displayerProps.name, value: value, columns: props.controller.columns, format: displayerProps.format }), format: displayerProps.format }));
|
|
10336
|
+
},
|
|
10012
10337
|
}, props));
|
|
10338
|
+
const fieldContainer = useFieldContainer({
|
|
10339
|
+
container: props.name,
|
|
10340
|
+
});
|
|
10013
10341
|
const Component = props.FieldComponent || StyledFormTableComponent;
|
|
10014
10342
|
return (React.createElement(FieldLayout, { ...fieldLayoutProps, required: props.required },
|
|
10015
|
-
React.createElement(
|
|
10343
|
+
React.createElement(FormContext.Provider, { value: fieldContainer.context },
|
|
10344
|
+
React.createElement(Component, { ...fieldComponentProps, name: props.name, required: props.required, minLength: props.minLength ?? props.min, maxLength: props.maxLength ?? props.max }))));
|
|
10016
10345
|
});
|
|
10017
10346
|
FormTable.displayName = 'FormTable';
|
|
10018
10347
|
|
|
@@ -10029,12 +10358,37 @@ const CheckboxCellComponent = (options) => {
|
|
|
10029
10358
|
return CheckboxCellComponent;
|
|
10030
10359
|
};
|
|
10031
10360
|
|
|
10361
|
+
const DefaultFormCellDisplayer = (props) => {
|
|
10362
|
+
const form = useForm();
|
|
10363
|
+
if (['form_summary', 'form_summary_table'].includes(props.format)) {
|
|
10364
|
+
if (props.column) {
|
|
10365
|
+
const name = props.column.id ? `${props.rowName}.${props.column.id}` : `${props.rowName}`;
|
|
10366
|
+
const field = form.fields[name];
|
|
10367
|
+
if (props.column.id === 'value') {
|
|
10368
|
+
console.log(field);
|
|
10369
|
+
}
|
|
10370
|
+
if (field && field.Displayer) {
|
|
10371
|
+
const Component = field.Displayer;
|
|
10372
|
+
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 });
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
}
|
|
10376
|
+
if (props.format === 'csv') {
|
|
10377
|
+
const value = get(props.value, props.column.id, '');
|
|
10378
|
+
if (typeof value === 'string')
|
|
10379
|
+
return value;
|
|
10380
|
+
return JSON.stringify(value);
|
|
10381
|
+
}
|
|
10382
|
+
return null;
|
|
10383
|
+
};
|
|
10384
|
+
|
|
10032
10385
|
const checkboxColumn = (id, options) => {
|
|
10033
10386
|
const Component = options.CellComponent || CheckboxCellComponent;
|
|
10034
10387
|
return Object.assign({
|
|
10035
10388
|
filterable: false,
|
|
10036
10389
|
sortable: false,
|
|
10037
10390
|
className: 'o-checkbox-cell',
|
|
10391
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10038
10392
|
}, options, {
|
|
10039
10393
|
id,
|
|
10040
10394
|
CellComponent: Component(options),
|
|
@@ -10092,6 +10446,7 @@ const enumColumn = (id, options) => {
|
|
|
10092
10446
|
filterable: true,
|
|
10093
10447
|
FilterComponent: (props) => (React.createElement(TableSelectFilterComponent, { ...props, dataSource: options.filterDataSource })),
|
|
10094
10448
|
sortable: true,
|
|
10449
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10095
10450
|
}, options, {
|
|
10096
10451
|
id,
|
|
10097
10452
|
});
|
|
@@ -10114,6 +10469,7 @@ const inputColumn = (id, options) => {
|
|
|
10114
10469
|
return Object.assign({
|
|
10115
10470
|
filterable: false,
|
|
10116
10471
|
sortable: false,
|
|
10472
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10117
10473
|
}, options, {
|
|
10118
10474
|
id,
|
|
10119
10475
|
CellComponent: Component(options),
|
|
@@ -10136,6 +10492,7 @@ const textColumn = (id, options) => {
|
|
|
10136
10492
|
filterable: true,
|
|
10137
10493
|
FilterComponent: TableTextFilterComponent,
|
|
10138
10494
|
sortable: true,
|
|
10495
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10139
10496
|
}, options, {
|
|
10140
10497
|
id,
|
|
10141
10498
|
});
|
|
@@ -10166,6 +10523,7 @@ const numberColumn = (id, options) => {
|
|
|
10166
10523
|
filterable: true,
|
|
10167
10524
|
FilterComponent: TableNumberFilterComponent,
|
|
10168
10525
|
sortable: true,
|
|
10526
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10169
10527
|
}, options, {
|
|
10170
10528
|
id,
|
|
10171
10529
|
});
|
|
@@ -10210,6 +10568,7 @@ const selectColumn = (id, options) => {
|
|
|
10210
10568
|
return Object.assign({
|
|
10211
10569
|
filterable: false,
|
|
10212
10570
|
sortable: false,
|
|
10571
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10213
10572
|
}, opts, {
|
|
10214
10573
|
id,
|
|
10215
10574
|
CellComponent: Component(opts, broker),
|
|
@@ -10309,11 +10668,21 @@ const Textarea = styled(TextareaComponent) `
|
|
|
10309
10668
|
${textareaStyle}
|
|
10310
10669
|
`;
|
|
10311
10670
|
|
|
10671
|
+
const FormTextareaValueDisplayer = ({ value }) => {
|
|
10672
|
+
return (React.createElement("span", { className: "o-input-displayer-value" }, value ? value.split('\n').map((v, index) => React.createElement("div", { key: `line-${index}` }, v)) : ''));
|
|
10673
|
+
};
|
|
10312
10674
|
const FormTextarea = React.memo((props) => {
|
|
10313
|
-
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({
|
|
10314
|
-
defaultValue: props.defaultValue === undefined ? '' : props.defaultValue,
|
|
10315
|
-
}, props, {
|
|
10675
|
+
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({}, props, {
|
|
10316
10676
|
isUndefined: (value) => value === undefined || value === null,
|
|
10677
|
+
defaultValue: props.defaultValue === undefined ? '' : props.defaultValue,
|
|
10678
|
+
Displayer: props.Displayer === undefined
|
|
10679
|
+
? (displayerProps) => {
|
|
10680
|
+
const form = useForm();
|
|
10681
|
+
let value = form.getValue(displayerProps.name) ?? '';
|
|
10682
|
+
const ValueDisplayer = props.ValueDisplayer ?? FormTextareaValueDisplayer;
|
|
10683
|
+
return (React.createElement(FieldDisplayer, { label: displayerProps.label ?? titlelize(displayerProps.name), help: props.help, first: displayerProps.first, last: displayerProps.last, value: React.createElement(ValueDisplayer, { value: value }), format: displayerProps.format }));
|
|
10684
|
+
}
|
|
10685
|
+
: props.Displayer,
|
|
10317
10686
|
}));
|
|
10318
10687
|
const Component = props.FieldComponent || Textarea;
|
|
10319
10688
|
return (React.createElement(FieldLayout, { ...fieldLayoutProps, required: props.required },
|
|
@@ -10338,6 +10707,7 @@ const textareaColumn = (id, options) => {
|
|
|
10338
10707
|
return Object.assign({
|
|
10339
10708
|
filterable: false,
|
|
10340
10709
|
sortable: false,
|
|
10710
|
+
Displayer: DefaultFormCellDisplayer,
|
|
10341
10711
|
}, options, {
|
|
10342
10712
|
id,
|
|
10343
10713
|
CellComponent: Component(options),
|
|
@@ -10828,6 +11198,20 @@ const wizardStyle = ({ layout = 'vertical', theme, inModal }) => {
|
|
|
10828
11198
|
const wizardModalStyle = () => {
|
|
10829
11199
|
return css ``;
|
|
10830
11200
|
};
|
|
11201
|
+
const wizardSummaryStyle = () => {
|
|
11202
|
+
return css `
|
|
11203
|
+
.o-accordion-panel {
|
|
11204
|
+
${paddingBottom('md')}
|
|
11205
|
+
}
|
|
11206
|
+
.o-accordion-panel-title {
|
|
11207
|
+
${backgroundColor('lighter')}
|
|
11208
|
+
}
|
|
11209
|
+
.o-accordion-content {
|
|
11210
|
+
${paddingX('sm')}
|
|
11211
|
+
${paddingBottom('sm')}
|
|
11212
|
+
}
|
|
11213
|
+
`;
|
|
11214
|
+
};
|
|
10831
11215
|
|
|
10832
11216
|
const Wizard = styled(WizardComponent) `
|
|
10833
11217
|
${wizardStyle}
|
|
@@ -10842,6 +11226,19 @@ const WizardModal = styled(WizardModalComponent) `
|
|
|
10842
11226
|
${wizardModalStyle}
|
|
10843
11227
|
`;
|
|
10844
11228
|
|
|
11229
|
+
const WizardSummaryComponent = ({ className }) => {
|
|
11230
|
+
const form = useForm();
|
|
11231
|
+
const tree = Object.values(form.getDisplayerTree());
|
|
11232
|
+
return (React.createElement(Accordion, { className: className }, tree.map((field, index) => {
|
|
11233
|
+
const Displayer = field.Displayer;
|
|
11234
|
+
return React.createElement(Displayer, { ...field, index: index, key: `field-${index}`, first: index === 0, last: index === tree.length - 1, format: "form_summary" });
|
|
11235
|
+
})));
|
|
11236
|
+
};
|
|
11237
|
+
|
|
11238
|
+
const WizardSummary = styled(WizardSummaryComponent) `
|
|
11239
|
+
${wizardSummaryStyle}
|
|
11240
|
+
`;
|
|
11241
|
+
|
|
10845
11242
|
const useStep = (props) => {
|
|
10846
11243
|
const service = useWizardService();
|
|
10847
11244
|
const state = useWizardState();
|
|
@@ -10854,9 +11251,8 @@ const useStep = (props) => {
|
|
|
10854
11251
|
return step;
|
|
10855
11252
|
};
|
|
10856
11253
|
|
|
10857
|
-
const Step = ({ title, active = false, disabled = false, visible = true, closable = false, children, icon, uid, optional = false, showTitle = true, className, }) => {
|
|
11254
|
+
const Step = ({ title, active = false, disabled = false, visible = true, closable = false, children, icon, uid, optional = false, showTitle = true, className, onTouch, }) => {
|
|
10858
11255
|
const { animate, forwardOnly } = useWizardState();
|
|
10859
|
-
const service = useWizardService();
|
|
10860
11256
|
const step = useStep({
|
|
10861
11257
|
title,
|
|
10862
11258
|
active,
|
|
@@ -10870,15 +11266,7 @@ const Step = ({ title, active = false, disabled = false, visible = true, closabl
|
|
|
10870
11266
|
touching: !forwardOnly,
|
|
10871
11267
|
uid: uid === undefined ? title : uid,
|
|
10872
11268
|
});
|
|
10873
|
-
const fieldContainer = useFieldContainer({
|
|
10874
|
-
onValidationChange: (touchedValidation, allValidation) => {
|
|
10875
|
-
if (step) {
|
|
10876
|
-
service.onValidationChange(step.uid, touchedValidation, allValidation);
|
|
10877
|
-
}
|
|
10878
|
-
},
|
|
10879
|
-
});
|
|
10880
11269
|
const touched = step?.touched;
|
|
10881
|
-
const touchAllFields = fieldContainer.touchAllFields;
|
|
10882
11270
|
const onEnter = (node) => {
|
|
10883
11271
|
node.style.opacity = '0';
|
|
10884
11272
|
};
|
|
@@ -10889,34 +11277,88 @@ const Step = ({ title, active = false, disabled = false, visible = true, closabl
|
|
|
10889
11277
|
}, 0);
|
|
10890
11278
|
};
|
|
10891
11279
|
useEffect(() => {
|
|
10892
|
-
if (touched) {
|
|
10893
|
-
|
|
11280
|
+
if (touched && onTouch) {
|
|
11281
|
+
onTouch();
|
|
10894
11282
|
}
|
|
10895
|
-
}, [touched,
|
|
11283
|
+
}, [touched, onTouch]);
|
|
10896
11284
|
if (!step || !step.active) {
|
|
10897
11285
|
return null;
|
|
10898
11286
|
}
|
|
10899
|
-
return (React.createElement(
|
|
10900
|
-
React.createElement(
|
|
10901
|
-
React.createElement("div", { className:
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
const
|
|
10907
|
-
|
|
11287
|
+
return (React.createElement(CSSTransition, { in: true, timeout: animate, appear: true, onEnter: onEnter, onEntering: onEntering },
|
|
11288
|
+
React.createElement("div", { className: addClassname('o-step-content', className) },
|
|
11289
|
+
showTitle && React.createElement("div", { className: "o-step-content-title" }, title),
|
|
11290
|
+
children)));
|
|
11291
|
+
};
|
|
11292
|
+
|
|
11293
|
+
const FormStep = ({ name, disabled, visible, ...stepProps }) => {
|
|
11294
|
+
const decorator = useFormDecorator(name, {
|
|
11295
|
+
Displayer: (displayerProps) => {
|
|
11296
|
+
const total = Object.values(displayerProps.children ?? {}).length;
|
|
11297
|
+
return (React.createElement(AccordionPanel, { title: stepProps.title, initialActive: displayerProps.index === 0, initialExpand: displayerProps.index === 0 }, Object.values(displayerProps.children ?? {}).map((field, index) => {
|
|
11298
|
+
const Displayer = field.Displayer;
|
|
11299
|
+
return React.createElement(Displayer, { ...field, index: index, key: `field-${index}`, first: index === 0, last: index === total - 1, format: displayerProps.format });
|
|
11300
|
+
})));
|
|
11301
|
+
},
|
|
11302
|
+
});
|
|
10908
11303
|
const metadata = useFormMetadata(decorator.name);
|
|
10909
11304
|
const service = useWizardService();
|
|
11305
|
+
const fieldContainer = useFieldContainer({
|
|
11306
|
+
container: name,
|
|
11307
|
+
onValidationChange: (touchedValidation, allValidation) => {
|
|
11308
|
+
service.onValidationChange(name, touchedValidation, allValidation);
|
|
11309
|
+
},
|
|
11310
|
+
});
|
|
11311
|
+
const { touchAllFields, hide, show, disable, enable } = fieldContainer;
|
|
10910
11312
|
useEffect(() => {
|
|
10911
|
-
const
|
|
10912
|
-
|
|
10913
|
-
|
|
11313
|
+
const visible = metadata.visible ?? true;
|
|
11314
|
+
const disabled = metadata.disabled ?? false;
|
|
11315
|
+
if (!visible) {
|
|
11316
|
+
if (disabled) {
|
|
11317
|
+
service.disable(name);
|
|
11318
|
+
disable();
|
|
11319
|
+
}
|
|
11320
|
+
else {
|
|
11321
|
+
service.enable(name);
|
|
11322
|
+
enable();
|
|
11323
|
+
}
|
|
11324
|
+
service.hide(name);
|
|
11325
|
+
hide();
|
|
10914
11326
|
}
|
|
10915
|
-
|
|
10916
|
-
|
|
11327
|
+
else {
|
|
11328
|
+
service.show(name);
|
|
11329
|
+
show();
|
|
11330
|
+
if (disabled) {
|
|
11331
|
+
service.disable(name);
|
|
11332
|
+
disable();
|
|
11333
|
+
}
|
|
11334
|
+
else {
|
|
11335
|
+
service.enable(name);
|
|
11336
|
+
enable();
|
|
11337
|
+
}
|
|
10917
11338
|
}
|
|
10918
|
-
});
|
|
10919
|
-
|
|
11339
|
+
}, [name, metadata.visible, metadata.disabled]);
|
|
11340
|
+
useEffect(() => {
|
|
11341
|
+
if (!visible) {
|
|
11342
|
+
if (disabled) {
|
|
11343
|
+
disable();
|
|
11344
|
+
}
|
|
11345
|
+
else {
|
|
11346
|
+
enable();
|
|
11347
|
+
}
|
|
11348
|
+
hide();
|
|
11349
|
+
}
|
|
11350
|
+
else {
|
|
11351
|
+
show();
|
|
11352
|
+
if (disabled) {
|
|
11353
|
+
disable();
|
|
11354
|
+
}
|
|
11355
|
+
else {
|
|
11356
|
+
enable();
|
|
11357
|
+
}
|
|
11358
|
+
}
|
|
11359
|
+
}, [visible, disabled, hide, show, disable, enable]);
|
|
11360
|
+
return (React.createElement(FormContext.Provider, { value: fieldContainer.context },
|
|
11361
|
+
React.createElement(Step, { ...stepProps, uid: name, onTouch: touchAllFields })));
|
|
10920
11362
|
};
|
|
10921
11363
|
|
|
10922
11364
|
const animation = cssProperty('animation');
|
|
@@ -11810,5 +12252,5 @@ const TailwindTheme = (props) => {
|
|
|
11810
12252
|
return React.createElement(BaseTheme, { theme: tailwindTheme(), ...props });
|
|
11811
12253
|
};
|
|
11812
12254
|
|
|
11813
|
-
export { Accordion, AccordionComponent, AccordionContainer, AccordionPanel, ArraySelectComponent, ArrayTreeComponent, ArrayTreeSelectComponent, BaseTheme, BreakpointKeys, Button, Card, CardComponent, CardTitle, Checkbox, CheckboxCellComponent, CheckboxComponent, CloseAllIcon, Col, ColorKeys, ControlledSelectComponent, ControlledTimerComponent, ControlledWizardComponent, ControllerTreeComponent, CrossIcon, Dashboard, DashboardBody, DashboardContainer, DashboardFooter, DashboardHeader, DashboardKeys, DashboardLeft, DashboardOverlay, DashboardRight, DashboardService, DashboardServiceContext, DashboardStateContext, DashboardToggler, DefaultCellComponent, DefaultSelectBroker, Dropdown, DropdownButton, DropdownComponent, DropdownList, ErrorIcon, ExpandedCellComponent, FieldDescription, FieldDescriptionComponent,
|
|
12255
|
+
export { Accordion, AccordionComponent, AccordionContainer, AccordionPanel, ArraySelectComponent, ArrayTreeComponent, ArrayTreeSelectComponent, BaseTheme, BreakpointKeys, Button, Card, CardComponent, CardTitle, Checkbox, CheckboxCellComponent, CheckboxComponent, CloseAllIcon, Col, ColorKeys, ControlledSelectComponent, ControlledTimerComponent, ControlledWizardComponent, ControllerTreeComponent, CrossIcon, Dashboard, DashboardBody, DashboardContainer, DashboardFooter, DashboardHeader, DashboardKeys, DashboardLeft, DashboardOverlay, DashboardRight, DashboardService, DashboardServiceContext, DashboardStateContext, DashboardToggler, DefaultCellComponent, DefaultFormCellDisplayer as DefaultCellDisplayer, DefaultSelectBroker, Dropdown, DropdownButton, DropdownComponent, DropdownList, ErrorIcon, ExpandedCellComponent, FieldDescription, FieldDescriptionComponent, FieldDisplayer, FieldHelp, FieldHelpComponent, FieldLayout, FieldLayoutComponent, FileIcon, FolderIcon, FontFamiliesKeys, FontLineHeightKeys, FontSizeKeys, FontSpacingKeys, FontWeightKeys, FormCard, FormCardDisplayer, FormCheckbox, FormInput, FormSelect$1 as FormSelect, FormStep, FormTable, FormTableItemDisplayer, FormTableValueDisplayer$1 as FormTableValueDisplayer, FormTextarea, HelpIcon, Input, InputCellComponent, InputComponent, Label, List, ListItemComponent$1 as ListItemComponent, ListItemContent, ListStatus, LoadingIcon, LoadingItem$1 as LoadingItem, MenuIcon, Modal, ModalComponent, NotificationComponent, Notifications, NotificationsComponent, Password, PasswordComponent, Properties, PropertiesComponent, Property, RadiusKeys, Row, SearchIcon, Select, SelectCellComponent, SelectComponent$1 as SelectComponent, SelectIconComponent, SelectInputComponent$1 as SelectInputComponent, SelectNotFoundComponent, SelectOptionComponent$1 as SelectOptionComponent, SelectService$1 as SelectService, SelectTokensComponent$1 as SelectTokensComponent, ShadowKeys, SizeKeys, SpacingKeys, Step, StepTitle, SubmitButton, SuccessIcon, Tab, TabTitle, Table, TableBodyRowComponent, TableFilterOperatorComponent, TableInputFilterComponent, TableNumberFilterComponent, TableTextFilterComponent, Tabs, Tag, TagComponent, TailwindTheme, Textarea, TextareaCellComponent, TextareaComponent, Timer, TimerComponent, TogglerIcon, Tooltip, Tree, TreeBodyComponent, TreeComponent$1 as TreeComponent, TreeConfigContext, TreeItemComponent$1 as TreeItemComponent, TreeItemContent, TreeItemToggler, TreeListComponent, TreeSelect, TreeSelectComponent$1 as TreeSelectComponent, TreeService$1 as TreeService, TreeServiceContext, TreeStateContext, TshirtKeys, UncontrolledTimerComponent, UncontrolledWizardComponent, VirtualTreeBodyComponent, VirtualTreeListComponent, Wizard, WizardComponent, WizardContainer, WizardModal, WizardModalComponent, WizardService, WizardSummary, WizardSummaryComponent, accordionStyle, addClassname, addStyle, alignContent, alignItems, alignSelf, animation, animationDelay, animationDirection, animationDuration, animationFillMode, animationIterationCount, animationName, animationPlayState, animationTimingFunction, appearance, applyOpacity, aspectRatio, backgroundAttachment, backgroundClip, backgroundColor, backgroundImage, backgroundOpacity, backgroundOrigin, backgroundPosition, backgroundRepeat, backgroundSize, baseTheme, booleanFormatter, border, borderBottom, borderBottomColor, borderBottomLeftRadius, borderBottomOpacity, borderBottomRightRadius, borderBottomStyle, borderBottomWidth, borderCollapse, borderColor, borderImage, borderImageOutset, borderImageRepeat, borderImageSlice, borderImageSource, borderImageWidth, borderLeft, borderLeftColor, borderLeftOpacity, borderLeftStyle, borderLeftWidth, borderOpacity, borderRadius, borderRight, borderRightColor, borderRightOpacity, borderRightStyle, borderRightWidth, borderSpacing, borderStyle, borderTop, borderTopColor, borderTopLeftRadius, borderTopOpacity, borderTopRightRadius, borderTopStyle, borderTopWidth, borderWidth, bottom, boxShadow, boxSizing, breakAfter, breakBefore, breakInside, buttonStyle, captionSide, cardStyle, caretColor, checkboxColumn, checkboxStyle, clear, colStyle, color, colorFormatter, columnCount, columnFill, columnGap, columnRule, columnRuleColor, columnRuleStyle, columnRuleWidth, columnSpan, columnWidth, columns, container, cssProperty, cursor, darken, dashboardOverlayStyle, defaultTreeQueryEngine, deriveColor, display, dropdownButtonStyle, dropdownStyle, emptyCells, enumColumn, enumFormatter, fieldDescriptionStyle, fieldDisplayerStyle, fieldHelpStyle, fieldStyle, fill, filterListStyle, findSelectItem, findSelectItemIndex, flex, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, float, font, fontFamily, fontFeatureSettings, fontKerning, fontLanguageOverride, fontOpticalSizing, fontSize, fontSizeAdjust, fontStretch, fontStyle, fontSynthesis, fontVariant, fontVariantAlternates, fontVariantCaps, fontVariantEastAsian, fontVariantLigatures, fontVariantNumeric, fontVariantPosition, fontVariationSettings, fontWeight, gap, grid, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridColumnEnd, gridColumnGap, gridColumnStart, gridGap, gridRow, gridRowEnd, gridRowGap, gridRowStart, gridTemplate, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, height, hexToRgb, hyphens, iconHeight, iconWidth, imageRendering, inputColumn, justifyContent, justifySelf, left, letterSpacing, lighten, lineHeight, lineHeightStep, linkColumn, listStyle, listStyleImage, listStylePosition, listStyleType, margin, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxHeight, maxWidth, maxWidthPopperModifier, minHeight, minWidth, minWidthPopperModifier, modalStyle, notifcationsStyle, numberColumn, objectFit, objectPosition, opacity, order, orphans, outline, outlineColor, outlineOffset, outlineStyle, outlineWidth, overflow, overflowBlock, overflowInline, overflowWrap, overflowX, overflowY, overscrollBehavior, overscrollBehaviorBlock, overscrollBehaviorInline, overscrollBehaviorX, overscrollBehaviorY, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, passwordStyle, perspective, perspectiveOrigin, placeContent, placeItems, placeSelf, pointerEvents, position, preflight, propertiesStyle, pxFormatter, resize, rgbToHex, right, rotate, rowGap, rowStyle, sameWidthPopperModifier, scale, selectColumn, shouldCheckSelect, stroke, strokeWidth, tableLayout, tableStyle, tagStyle, tailwindPalette, tailwindTheme, textAlign, textColumn, textDecoration, textDecorationColor, textDecorationLine, textDecorationStyle, textDecorationThickness, textEmphasis, textEmphasisColor, textEmphasisPosition, textEmphasisStyle, textIdent, textJustify, textOpacity, textOverflow, textShadow, textTransform, textUnderlineOffset, textUnderlinePosition, textareaColumn, themeFormatter, timerStyle, titlelize, toCss, top, touchAction, transform, transformOrigin, transition, transitionDelay, transitionDuration, transitionProperty, transitionTimingFunction, useCheckboxColumn, useClickOutside, useColumns, useDashboard, useDashboardHorizontalPanel, useDashboardService, useDashboardState, useDashboardVerticalPanel, useDashoardBodyPanel, useDropdown, useEnumColumn, useFieldLayout, useFocusOutside, useFormTableContext, useInputColumn$1 as useInputColumn, useLinkColumn, useListController, useInputColumn as useNumberColumn, useSelectColumn, useSelectController, useSelectService, useTab, useTableController, useTableService, useTabsController, useTabsService, useTabsState, useTextColumn, useTextareaColumn, useTreeConfig, useTreeController, useTreeInitialState, useTreeItemContext, useTreeSelectController, useTreeService, useTreeState, userSelect, verticalAlign, visibility, whiteSpace, widows, width, wizardModalStyle, wizardStyle, wizardSummaryStyle, wordBreak, wordSpacing, zIndex, zoom };
|
|
11814
12256
|
//# sourceMappingURL=index.module.js.map
|