@pinnacle0/web-ui 0.6.41 → 0.6.43
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/core/AmountConditionInput/index.d.ts +1 -10
- package/core/AmountConditionInput/index.js +26 -29
- package/core/AmountConditionInput/index.js.map +1 -1
- package/core/AmountRangeInput/index.d.ts +2 -11
- package/core/AmountRangeInput/index.js +14 -20
- package/core/AmountRangeInput/index.js.map +1 -1
- package/core/AuthenticationCodeInput/index.d.ts +1 -17
- package/core/AuthenticationCodeInput/index.js +36 -50
- package/core/AuthenticationCodeInput/index.js.map +1 -1
- package/package.json +1 -3
- package/util/OrientationUtil/index.js +8 -1
- package/util/OrientationUtil/index.js.map +1 -1
|
@@ -16,13 +16,4 @@ export interface Props extends ControlledFormValue<AmountConditionValue> {
|
|
|
16
16
|
scale: number;
|
|
17
17
|
operators?: Operator[];
|
|
18
18
|
}
|
|
19
|
-
export declare
|
|
20
|
-
static displayName: string;
|
|
21
|
-
private readonly operators;
|
|
22
|
-
private readonly selectStyle;
|
|
23
|
-
private readonly inputStyle;
|
|
24
|
-
operatorTranslator: (value: Operator) => string;
|
|
25
|
-
onConditionChange: (value: Operator) => void;
|
|
26
|
-
onAmountChange: (value: number | null) => void;
|
|
27
|
-
render(): React.JSX.Element;
|
|
28
|
-
}
|
|
19
|
+
export declare const AmountConditionInput: (props: Props) => React.JSX.Element;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Space } from "../Space";
|
|
3
3
|
import { NumberInput } from "../NumberInput";
|
|
4
4
|
import { EnumSelect } from "../EnumSelect";
|
|
5
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
5
6
|
export var Operator;
|
|
6
7
|
(function (Operator) {
|
|
7
8
|
Operator["GREATER_THAN"] = "GREATER_THAN";
|
|
@@ -11,34 +12,30 @@ export var Operator;
|
|
|
11
12
|
Operator["EQUALS"] = "EQUALS";
|
|
12
13
|
Operator["NOT_EQUALS"] = "NOT_EQUALS";
|
|
13
14
|
})(Operator || (Operator = {}));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const { scale, value } = this.props;
|
|
39
|
-
return (React.createElement(Space.Compact, { block: true },
|
|
40
|
-
React.createElement(EnumSelect, { value: value.condition, onChange: this.onConditionChange, translator: this.operatorTranslator, list: this.operators, style: this.selectStyle }),
|
|
41
|
-
React.createElement(NumberInput, { allowNull: true, scale: scale, value: value.amount, onChange: this.onAmountChange, inputStyle: this.inputStyle })));
|
|
15
|
+
const selectStyle = { width: 55 };
|
|
16
|
+
const inputStyle = { width: 180, borderTopLeftRadius: 0, borderBottomLeftRadius: 0 };
|
|
17
|
+
export const AmountConditionInput = ReactUtil.memo("AmountConditionInput", (props) => {
|
|
18
|
+
const { value, onChange, scale, operators = [Operator.GREATER_THAN, Operator.GREATER_EQUAL, Operator.LESS_THAN, Operator.LESS_EQUAL, Operator.EQUALS] } = props;
|
|
19
|
+
const onConditionChange = (condition) => onChange({ condition, amount: value.amount });
|
|
20
|
+
const onAmountChange = (amount) => onChange({ condition: value.condition, amount });
|
|
21
|
+
return (React.createElement(Space.Compact, { block: true },
|
|
22
|
+
React.createElement(EnumSelect, { value: value.condition, onChange: onConditionChange, translator: operatorTranslator, list: operators, style: selectStyle }),
|
|
23
|
+
React.createElement(NumberInput, { allowNull: true, scale: scale, value: value.amount, onChange: onAmountChange, inputStyle: inputStyle })));
|
|
24
|
+
});
|
|
25
|
+
const operatorTranslator = (value) => {
|
|
26
|
+
switch (value) {
|
|
27
|
+
case Operator.GREATER_THAN:
|
|
28
|
+
return ">";
|
|
29
|
+
case Operator.GREATER_EQUAL:
|
|
30
|
+
return "≥";
|
|
31
|
+
case Operator.LESS_THAN:
|
|
32
|
+
return "<";
|
|
33
|
+
case Operator.LESS_EQUAL:
|
|
34
|
+
return "≤";
|
|
35
|
+
case Operator.EQUALS:
|
|
36
|
+
return "=";
|
|
37
|
+
case Operator.NOT_EQUALS:
|
|
38
|
+
return "≠";
|
|
42
39
|
}
|
|
43
|
-
}
|
|
40
|
+
};
|
|
44
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AmountConditionInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AmountConditionInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAE/C,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,yCAA6B,CAAA;IAC7B,2CAA+B,CAAA;IAC/B,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,qCAAyB,CAAA;AAC7B,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB;AAYD,MAAM,WAAW,GAAwB,EAAC,KAAK,EAAE,E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AAQ,CAAC,YAAY;YACtB,OAAO,GAAG,CAAC;QACf,KAAK,QAAQ,CAAC,aAAa;YACvB,OAAO,GAAG,CAAC;QACf,KAAK,QAAQ,CAAC,SAAS;YACnB,OAAO,GAAG,CAAC;QACf,KAAK,QAAQ,CAAC,UAAU;YACpB,OAAO,GAAG,CAAC;QACf,KAAK,QAAQ,CAAC,MAAM;YAChB,OAAO,GAAG,CAAC;QACf,KAAK,QAAQ,CAAC,UAAU;YACpB,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ControlledFormValue
|
|
2
|
+
import type { ControlledFormValue } from "../../internal/type";
|
|
3
3
|
export type AmountRangeValue<T extends boolean> = T extends true ? [number | null, number | null] : [number, number];
|
|
4
4
|
export interface Props<T extends boolean> extends ControlledFormValue<AmountRangeValue<T>> {
|
|
5
5
|
allowNull: T;
|
|
@@ -10,13 +10,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<AmountRang
|
|
|
10
10
|
style?: React.CSSProperties;
|
|
11
11
|
inputStyle?: React.CSSProperties;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
14
|
-
static displayName: string;
|
|
15
|
-
static defaultProps: PickOptional<Props<any>>;
|
|
16
|
-
private readonly minInputStyle;
|
|
17
|
-
private readonly maxInputStyle;
|
|
18
|
-
private readonly connectorStyle;
|
|
19
|
-
onMinAmountChange: (value: number | null) => void;
|
|
20
|
-
onMaxAmountChange: (value: number | null) => void;
|
|
21
|
-
render(): React.JSX.Element;
|
|
22
|
-
}
|
|
13
|
+
export declare const AmountRangeInput: <T extends boolean>(props: Props<T>) => React.JSX.Element;
|
|
@@ -3,24 +3,18 @@ import { NumberInput } from "../NumberInput";
|
|
|
3
3
|
import { Input } from "../Input";
|
|
4
4
|
import { i18n } from "../../internal/i18n/core";
|
|
5
5
|
import { Space } from "../Space";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (React.createElement(Space.Compact, { block: true, style: style },
|
|
21
|
-
React.createElement(NumberInput, { disabled: disabled, allowNull: allowNull, min: min, scale: scale, placeholder: t.minimum, value: value[0], onChange: this.onMinAmountChange, inputStyle: { ...this.minInputStyle, ...inputStyle } }),
|
|
22
|
-
React.createElement(Input.Readonly, { style: this.connectorStyle, value: "~" }),
|
|
23
|
-
React.createElement(NumberInput, { disabled: disabled, allowNull: allowNull, min: value[0] !== null ? (shouldNotEqual ? value[0] + 1 : value[0]) : 0, scale: scale, placeholder: t.maximum, value: value[1], onChange: this.onMaxAmountChange, inputStyle: { ...this.maxInputStyle, ...inputStyle } })));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
6
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
7
|
+
const minInputStyle = { borderTopRightRadius: 0, borderBottomRightRadius: 0, width: 80, textAlign: "right" };
|
|
8
|
+
const maxInputStyle = { borderTopLeftRadius: 0, borderBottomLeftRadius: 0, width: 80, borderLeftWidth: 0, textAlign: "left" };
|
|
9
|
+
const connectorStyle = { width: 30, borderLeftWidth: 0, borderRightWidth: 0, backgroundColor: "#fff", pointerEvents: "none" };
|
|
10
|
+
export const AmountRangeInput = ReactUtil.memo("AmountRangeInput", (props) => {
|
|
11
|
+
const { value, onChange, scale = 2, disabled, min = 0, shouldNotEqual, allowNull, style, inputStyle } = props;
|
|
12
|
+
const t = i18n();
|
|
13
|
+
const onMinAmountChange = (minValue) => onChange([minValue, value[1]]);
|
|
14
|
+
const onMaxAmountChange = (maxValue) => onChange([value[0], maxValue]);
|
|
15
|
+
return (React.createElement(Space.Compact, { block: true, style: style },
|
|
16
|
+
React.createElement(NumberInput, { disabled: disabled, allowNull: allowNull, min: min, scale: scale, placeholder: t.minimum, value: value[0], onChange: onMinAmountChange, inputStyle: { ...minInputStyle, ...inputStyle } }),
|
|
17
|
+
React.createElement(Input.Readonly, { style: connectorStyle, value: "~" }),
|
|
18
|
+
React.createElement(NumberInput, { disabled: disabled, allowNull: allowNull, min: value[0] !== null ? (shouldNotEqual ? value[0] + 1 : value[0]) : 0, scale: scale, placeholder: t.maximum, value: value[1], onChange: onMaxAmountChange, inputStyle: { ...maxInputStyle, ...inputStyle } })));
|
|
19
|
+
});
|
|
26
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AmountRangeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AmountRangeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAc/C,MAAM,aAAa,GAAwB,EAAC,oBAAoB,EAAE,CAAC,EAAE,uBAAuB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAC,CAAC;AAChI,MAAM,aAAa,GAAwB,EAAC,mBAA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U,EAAC,GAC/C;QACF,oBAAC,KAAK,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAC,GAAG,GAAG;QACnD,oBAAC,WAAW,IACR,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAU,EACrB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACvE,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,CAAC,CAAC,OAAO,EACtB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAQ,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,UAAU,EAAE,EAAC,GAAG,aAAa,EAAE,GAAG,UAAU,EAAC,GAC/C,CACU,CACnB,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Props as InputProps } from "../Input";
|
|
3
|
-
import type { PickOptional } from "../../internal/type";
|
|
4
3
|
import "./index.less";
|
|
5
4
|
export interface Props extends Omit<InputProps, "suffix"> {
|
|
6
5
|
onSend: () => Promise<boolean>;
|
|
@@ -8,19 +7,4 @@ export interface Props extends Omit<InputProps, "suffix"> {
|
|
|
8
7
|
autoSendOnMount?: boolean;
|
|
9
8
|
sendButtonText?: string;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
isSending: boolean;
|
|
13
|
-
nextSendRemainingSecond: number | null;
|
|
14
|
-
}
|
|
15
|
-
export declare class AuthenticationCodeInput extends React.PureComponent<Props, State> {
|
|
16
|
-
static displayName: string;
|
|
17
|
-
static defaultProps: PickOptional<Props>;
|
|
18
|
-
private timer;
|
|
19
|
-
constructor(props: Props);
|
|
20
|
-
componentDidMount(): void;
|
|
21
|
-
componentWillUnmount(): void;
|
|
22
|
-
updateNextSendRemainingSecond: () => void;
|
|
23
|
-
onSend: () => Promise<void>;
|
|
24
|
-
render(): React.JSX.Element;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
10
|
+
export declare const AuthenticationCodeInput: (props: Props) => React.JSX.Element;
|
|
@@ -4,65 +4,51 @@ import { classNames } from "../../util/ClassNames";
|
|
|
4
4
|
import { i18n } from "../../internal/i18n/core";
|
|
5
5
|
import { TextUtil } from "../../internal/TextUtil";
|
|
6
6
|
import { Input } from "../Input";
|
|
7
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
8
|
+
import { useDidMountEffect } from "../../hooks/useDidMountEffect";
|
|
9
|
+
import { useWillUnmountEffect } from "../../hooks/useWillUnmountEffect";
|
|
7
10
|
import "./index.less";
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isSending: false,
|
|
18
|
-
nextSendRemainingSecond: null,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
componentDidMount() {
|
|
22
|
-
if (this.props.autoSendOnMount) {
|
|
23
|
-
this.onSend();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
componentWillUnmount() {
|
|
27
|
-
clearInterval(this.timer);
|
|
28
|
-
}
|
|
29
|
-
updateNextSendRemainingSecond = () => {
|
|
30
|
-
const nextSendRemainingSecond = this.state.nextSendRemainingSecond - 1;
|
|
31
|
-
if (nextSendRemainingSecond <= 0) {
|
|
32
|
-
clearInterval(this.timer);
|
|
33
|
-
this.setState({ nextSendRemainingSecond: null });
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.setState({ nextSendRemainingSecond });
|
|
11
|
+
export const AuthenticationCodeInput = ReactUtil.memo("AuthenticationCodeInput", (props) => {
|
|
12
|
+
const { nextSendInterval = 60, autoSendOnMount, sendButtonText, className, onSend, ...inputProps } = props;
|
|
13
|
+
const [isSending, setIsSending] = React.useState(false); // Only true during calling send API
|
|
14
|
+
const [nextSendRemainingSecond, setNextSendRemainingSecond] = React.useState(null); // At least 1 when type is number
|
|
15
|
+
const timer = React.useRef(null);
|
|
16
|
+
const t = i18n();
|
|
17
|
+
useDidMountEffect(() => {
|
|
18
|
+
if (autoSendOnMount) {
|
|
19
|
+
handleSend();
|
|
37
20
|
}
|
|
21
|
+
});
|
|
22
|
+
useWillUnmountEffect(() => {
|
|
23
|
+
timer.current !== null && clearInterval(timer.current);
|
|
24
|
+
});
|
|
25
|
+
const updateNextSendRemainingSecond = () => {
|
|
26
|
+
setNextSendRemainingSecond(prev => {
|
|
27
|
+
if (prev === null)
|
|
28
|
+
return null;
|
|
29
|
+
const nextSecond = prev - 1;
|
|
30
|
+
if (nextSecond <= 0) {
|
|
31
|
+
timer.current && clearInterval(timer.current);
|
|
32
|
+
timer.current = null;
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return nextSecond;
|
|
36
|
+
});
|
|
38
37
|
};
|
|
39
|
-
|
|
40
|
-
const { nextSendInterval, onSend } = this.props;
|
|
38
|
+
const handleSend = async () => {
|
|
41
39
|
try {
|
|
42
|
-
|
|
40
|
+
setIsSending(true);
|
|
43
41
|
const sendSuccess = await onSend();
|
|
44
42
|
if (sendSuccess) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
43
|
+
setNextSendRemainingSecond(nextSendInterval);
|
|
44
|
+
timer.current = setInterval(updateNextSendRemainingSecond, 1000);
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
finally {
|
|
51
|
-
|
|
48
|
+
setIsSending(false);
|
|
52
49
|
}
|
|
53
50
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
onSend,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- not included in inputProps
|
|
59
|
-
autoSendOnMount,
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- not included in inputProps
|
|
61
|
-
nextSendInterval, className, ...inputProps } = this.props;
|
|
62
|
-
const { isSending, nextSendRemainingSecond } = this.state;
|
|
63
|
-
const t = i18n();
|
|
64
|
-
const sendButton = (React.createElement(Button, { type: "primary", ghost: true, className: "g-auth-code-input-send-button", size: "small", disabled: inputProps.disabled || nextSendRemainingSecond !== null || isSending, onClick: this.onSend }, nextSendRemainingSecond ? TextUtil.interpolate(t.waitResendAuthCode, nextSendRemainingSecond.toString()) : sendButtonText || t.sendAuthCode));
|
|
65
|
-
return React.createElement(Input, { ...inputProps, className: classNames(className, "g-auth-code-input"), suffix: sendButton });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
51
|
+
const sendButton = (React.createElement(Button, { type: "primary", ghost: true, className: "g-auth-code-input-send-button", size: "small", disabled: inputProps.disabled || nextSendRemainingSecond !== null || isSending, onClick: handleSend }, nextSendRemainingSecond ? TextUtil.interpolate(t.waitResendAuthCode, nextSendRemainingSecond.toString()) : sendButtonText || t.sendAuthCode));
|
|
52
|
+
return React.createElement(Input, { ...inputProps, className: classNames(className, "g-auth-code-input"), suffix: sendButton });
|
|
53
|
+
});
|
|
68
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AuthenticationCodeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/AuthenticationCodeInput/index.tsx"],"names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,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,YAAY,CACvI,CACZ,CAAC;IACF,OAAO,oBAAC,KAAK,OAAK,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,mBAAmB,CAAC,EAAE,MAAM,EAAE,UAAU,GAAI,CAAC;AAChH,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinnacle0/web-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.43",
|
|
4
4
|
"author": "Pinnacle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
@@ -19,12 +19,10 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@ant-design/cssinjs": "1.24.0",
|
|
21
21
|
"@ant-design/icons": "6.1.0",
|
|
22
|
-
"@juggle/resize-observer": "3.4.0",
|
|
23
22
|
"@tanstack/react-virtual": "3.13.12",
|
|
24
23
|
"antd": "5.29.1",
|
|
25
24
|
"classnames": "2.5.1",
|
|
26
25
|
"dayjs": "1.11.19",
|
|
27
|
-
"intersection-observer": "0.12.2",
|
|
28
26
|
"rc-picker": "4.11.3"
|
|
29
27
|
},
|
|
30
28
|
"peerDependencies": {
|
|
@@ -18,7 +18,14 @@
|
|
|
18
18
|
import { BrowserUtil } from "../BrowserUtil";
|
|
19
19
|
const supportScreenOrientationAPI = typeof window.screen.orientation !== "undefined";
|
|
20
20
|
function subscribe(subscriber) {
|
|
21
|
-
|
|
21
|
+
let lastOrientation = current();
|
|
22
|
+
const handler = () => {
|
|
23
|
+
const newOrientation = current();
|
|
24
|
+
if (newOrientation !== lastOrientation) {
|
|
25
|
+
lastOrientation = newOrientation;
|
|
26
|
+
subscriber(newOrientation);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
22
29
|
if (BrowserUtil.os() === "ios") {
|
|
23
30
|
const mediaQuery = window.matchMedia("(orientation: portrait)");
|
|
24
31
|
if (mediaQuery instanceof EventTarget) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/OrientationUtil/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,MAAM,2BAA2B,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,KAAK,WAAW,CAAC;AAMrF,SAAS,SAAS,CAAC,UAAsB;IACrC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/OrientationUtil/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,MAAM,2BAA2B,GAAG,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,KAAK,WAAW,CAAC;AAMrF,SAAS,SAAS,CAAC,UAAsB;IACrC,IAAI,eAAe,GAAG,OAAO,EAAE,CAAC;IAEhC,MAAM,OAAO,GAAG,GAAG,EAAE;QACjB,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC;QACjC,IAAI,cAAc,KAAK,eAAe,EAAE,CAAC;YACrC,eAAe,GAAG,cAAc,CAAC;YACjC,UAAU,CAAC,cAAc,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,WAAW,CAAC,EAAE,EAAE,KAAK,KAAK,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;QAChE,IAAI,UAAU,YAAY,WAAW,EAAE,CAAC;YACpC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,GAAG,EAAE,CAAC,UAAU,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