Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kne-components/components-core",
"version": "0.4.45",
"version": "0.4.46",
"files": [
"build"
],
Expand All @@ -22,9 +22,9 @@
"@kne/create-deferred": "^0.1.0",
"@kne/ensure-slash": "^0.1.0",
"@kne/flex-box": "^0.1.1",
"@kne/form-info": "^0.1.1",
"@kne/form-info": "^0.1.2",
"@kne/global-context": "^1.3.2",
"@kne/info-page": "^0.2.0",
"@kne/info-page": "^0.2.3",
"@kne/is-empty": "^1.0.1",
"@kne/phone-number-input": "^0.1.3",
"@kne/react-enum": "^0.1.12",
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/Scroller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Scroller = ({
scrollEl.addEventListener("scroll", computed);
});

refResizeObserver.observe(ref.current);
ref.current && refResizeObserver.observe(ref.current);

window.addEventListener("scroll", computed);
container.addEventListener("scroll", computed);
Expand Down
12 changes: 6 additions & 6 deletions src/common/components/SearchInput/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.search-input {
:global(.ant-input-group-addon) {
display: none;
background: transparent;
}
:global(.ant-input-group-addon),:global(.ant-input-search-btn) {
display: none;
background: transparent;
}

:global(.ant-input-affix-wrapper){
border-radius: var(--radius-default);
:global(.ant-input-affix-wrapper) {
border-radius: var(--radius-default)!important;
}

//&:not(.is-popup) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Filter/FilterLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const FilterLines = ({
const [isExpand, setIsExpand] = useState(false);
return (<IntlProvider importMessages={importMessages} moduleName="Filter">
<Space
className={classnames(style["filter-title"], className)}
className={classnames(style["filter-title"], "filter-title", className)}
align="top"
size={16}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Filter/FilterOuter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import FilterProvider from './FilterProvider';

const FilterOuter = ({children, className, ...props}) => {
return <FilterProvider {...props}>
{(context) => <div className={classnames(style["filter"], className)}>
{(context) => <div className={classnames(style["filter"], "filter", className)}>
{children(context)}
</div>}
</FilterProvider>
Expand Down
8 changes: 4 additions & 4 deletions src/components/FormInfo/Form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {forwardRef, useEffect, useState} from "react";
import {usePreset, useGlobalContext} from "@components/Global";
import {forwardRef, useEffect, useState, Fragment} from "react";
import {usePreset, useGlobalValue} from "@components/Global";
import get from "lodash/get";
import formPreset from "@components/FormInfo/preset";
import FormLangProvider from "@components/FormInfo/FormLangProvider";
Expand All @@ -11,7 +11,7 @@ import withLocale from "./withLocale";
const SetPreset = ({children}) => {
const [isPreset, setIsPreset] = useState(false);
const preset = usePreset();
const {locale} = useGlobalContext();
const locale = useGlobalValue('locale');
const formInfo = get(preset, "formInfo", {});
useEffect(() => {
Promise.resolve(formPreset(formInfo, {locale})).then(() => {
Expand All @@ -21,7 +21,7 @@ const SetPreset = ({children}) => {
if (!isPreset) {
return null;
}
return children;
return <Fragment key={locale}>{children}</Fragment>;
};

const Form = withLocale(forwardRef(({helperGuideName, lang, ...props}, ref) => {
Expand Down
9 changes: 5 additions & 4 deletions src/components/FormInfo/fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Tooltip from "@components/Tooltip";
import Icon from "@components/Icon";
import {Space} from "antd";
import classnames from "classnames";
import withLocale from '../withLocale';
import style from "../style.module.scss";

const createWithFieldDecorator = (decoratorList) => (WrappedComponent) => {
Expand Down Expand Up @@ -79,25 +80,25 @@ const createWithFieldDecorator = (decoratorList) => (WrappedComponent) => {
};

const withInputDefaultPlaceholder = (WrappedComponent) => {
return ({placeholder, label, ...props}) => {
return withLocale(({placeholder, label, ...props}) => {
const {formatMessage} = useIntl();
return (<WrappedComponent
{...props}
label={label}
placeholder={placeholder || formatMessage({id: 'defaultInputPlaceholder'}, {label})}
/>);
};
});
};

const withSelectDefaultPlaceholder = (WrappedComponent) => {
return ({placeholder, label, ...props}) => {
return withLocale(({placeholder, label, ...props}) => {
const {formatMessage} = useIntl();
return <WrappedComponent
{...props}
label={label}
placeholder={placeholder || formatMessage({id: 'defaultSelectPlaceholder'}, {label})}
/>;
}
})
};

const withLang = (WrappedComponent) => {
Expand Down
13 changes: 7 additions & 6 deletions src/components/FormInfo/formModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ import InputUpperCaseField from "./fields/InputUpperCase";
import TypeDateRangePicker from "./fields/TypeDateRangePicker";
import Text from "./fields/Text";
import ErrorTip from "./ErrorTip";
import withLocale from './withLocale';

const withInputDefaultPlaceholder = (WrappedComponent) => {
const TargetComponent = forwardRef(({placeholder, label, ...props}, ref) => {
const TargetComponent = withLocale(forwardRef(({placeholder, label, ...props}, ref) => {
const {formatMessage} = useIntl();

return <WrappedComponent
Expand All @@ -49,7 +50,7 @@ const withInputDefaultPlaceholder = (WrappedComponent) => {
label={label}
placeholder={placeholder || formatMessage({id: 'defaultInputPlaceholder'}, {label})}
/>;
});
}));
Object.keys(WrappedComponent)
.filter((key) => {
return ["$$typeof", "render", "field"].indexOf(key) === -1;
Expand All @@ -61,7 +62,7 @@ const withInputDefaultPlaceholder = (WrappedComponent) => {
return TargetComponent;
};

const withTextAreaDefaultPlaceholder = (WrappedComponent) => ({placeholder, label, className, ...props}) => {
const withTextAreaDefaultPlaceholder = (WrappedComponent) => withLocale(({placeholder, label, className, ...props}) => {
const {formatMessage} = useIntl();
return <div className={style["textarea-wrapped-component"]}>
<WrappedComponent
Expand All @@ -70,18 +71,18 @@ const withTextAreaDefaultPlaceholder = (WrappedComponent) => ({placeholder, labe
placeholder={placeholder || formatMessage({id: 'defaultInputPlaceholder'}, {label})}
/>
</div>;
};
});

const withSelectDefaultPlaceholder = (WrappedComponent) => {
const TargetComponent = forwardRef(({placeholder, label, ...props}, ref) => {
const TargetComponent = withLocale(forwardRef(({placeholder, label, ...props}, ref) => {
const {formatMessage} = useIntl();
return <WrappedComponent
{...props}
ref={ref}
label={label}
placeholder={placeholder || formatMessage({id: 'defaultSelectPlaceholder'}, {label})}
/>;
});
}));

Object.keys(WrappedComponent)
.filter((key) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/FormInfo/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const _olderLEN = RULES.LEN;

const formPreset = async (options, otherOptions) => {
const {locale} = Object.assign({}, otherOptions);

interceptors.input.use("photo-string", (value) => {
if (value && typeof value === "string") {
const [id, params] = value.split("?");
Expand Down
Loading