forstok-ui-lib 6.4.2 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -2
- package/dist/index.js +278 -149
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +451 -322
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/javascripts/function.ts +7 -8
- package/src/assets/stylesheets/shares.styles.ts +137 -0
- package/src/components/image/channel.tsx +62 -0
- package/src/components/image/type.ts +3 -0
package/package.json
CHANGED
|
@@ -108,14 +108,8 @@ export const generateMessageQuestion = (type: string, title: string, subtitle: s
|
|
|
108
108
|
return result;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export const currencyNumber = (value
|
|
112
|
-
|
|
113
|
-
return value;
|
|
114
|
-
} else if (typeof value == 'number') {
|
|
115
|
-
return value.toLocaleString('id-ID', {style: 'currency', currency: 'IDR', minimumFractionDigits: 0});
|
|
116
|
-
} else {
|
|
117
|
-
return value;
|
|
118
|
-
}
|
|
111
|
+
export const currencyNumber = (value?: number | null) => {
|
|
112
|
+
return (value !== undefined && value !== null) ? value.toLocaleString('id-ID', { style: 'currency', currency: 'IDR', minimumFractionDigits: 0 }) : '-'
|
|
119
113
|
}
|
|
120
114
|
|
|
121
115
|
export const evUpdateInputRc = (input?: HTMLInputElement, value?: string | number) => {
|
|
@@ -679,4 +673,9 @@ export const evSetTotal = (totalCount: number, totalEl: HTMLSpanElement, callbac
|
|
|
679
673
|
if (callback && typeof(callback) == "function") {
|
|
680
674
|
callback()
|
|
681
675
|
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export const humanise = (value?: string) => {
|
|
679
|
+
const underscoreMatch = /_/g, underscoreMatch2 = /-/g
|
|
680
|
+
return value ? value.replace(underscoreMatch, " ").replace(underscoreMatch2, " ") : ''
|
|
682
681
|
}
|
|
@@ -3901,4 +3901,141 @@ export const ScrollArrowContainer = styled.section`
|
|
|
3901
3901
|
color: var(--sec-clr-lnk__hvr);
|
|
3902
3902
|
}
|
|
3903
3903
|
}
|
|
3904
|
+
`
|
|
3905
|
+
|
|
3906
|
+
export const BulkSelectContainer = styled.div`
|
|
3907
|
+
position: relative;
|
|
3908
|
+
display: grid;
|
|
3909
|
+
grid-auto-flow: dense;
|
|
3910
|
+
grid-gap: 10px;
|
|
3911
|
+
> article {
|
|
3912
|
+
font-weight: 600;
|
|
3913
|
+
padding: 3px 4px 3px 0;
|
|
3914
|
+
display: grid;
|
|
3915
|
+
grid-auto-flow: column;
|
|
3916
|
+
&:only-child {
|
|
3917
|
+
margin-left: 0;
|
|
3918
|
+
}
|
|
3919
|
+
&:nth-child(4) {
|
|
3920
|
+
padding-left: 14px;
|
|
3921
|
+
}
|
|
3922
|
+
&:nth-child(4):last-child {
|
|
3923
|
+
width: 200%;
|
|
3924
|
+
padding-left: 0;
|
|
3925
|
+
margin-left: 0;
|
|
3926
|
+
}
|
|
3927
|
+
> section,
|
|
3928
|
+
> button {
|
|
3929
|
+
margin: -8px -6px -7px -6px;
|
|
3930
|
+
}
|
|
3931
|
+
> section {
|
|
3932
|
+
> section {
|
|
3933
|
+
button {
|
|
3934
|
+
overflow: hidden;
|
|
3935
|
+
text-overflow: ellipsis;
|
|
3936
|
+
white-space: nowrap;
|
|
3937
|
+
display: block;
|
|
3938
|
+
max-width: 100%;
|
|
3939
|
+
width: 28vw;
|
|
3940
|
+
font-weight: 600;
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
> section,
|
|
3946
|
+
> article {
|
|
3947
|
+
max-height: 20px;
|
|
3948
|
+
align-items: center;
|
|
3949
|
+
}
|
|
3950
|
+
@media only screen and (min-width: 375px) {
|
|
3951
|
+
> article {
|
|
3952
|
+
> section {
|
|
3953
|
+
> section {
|
|
3954
|
+
button {
|
|
3955
|
+
width: 31vw;
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
@media only screen and (min-width: 768px) {
|
|
3962
|
+
grid-auto-flow: column;
|
|
3963
|
+
grid-gap: 20px;
|
|
3964
|
+
._refSelectedBulk {
|
|
3965
|
+
display: none;
|
|
3966
|
+
}
|
|
3967
|
+
> section,
|
|
3968
|
+
> article {
|
|
3969
|
+
height: auto;
|
|
3970
|
+
max-height: auto;
|
|
3971
|
+
font-size: .875rem;
|
|
3972
|
+
align-items: unset;
|
|
3973
|
+
}
|
|
3974
|
+
> article {
|
|
3975
|
+
&:nth-child(4),
|
|
3976
|
+
&:last-child,
|
|
3977
|
+
&:nth-child(4):last-child {
|
|
3978
|
+
width: auto;
|
|
3979
|
+
padding-left: 3px;
|
|
3980
|
+
margin-bottom: 0;
|
|
3981
|
+
text-align: left;
|
|
3982
|
+
> span {
|
|
3983
|
+
padding-left: 0;
|
|
3984
|
+
font-weight: 600;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
> section {
|
|
3988
|
+
> section {
|
|
3989
|
+
button {
|
|
3990
|
+
width: auto;
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
@media only screen and (min-width: 1024px) {
|
|
3997
|
+
grid-gap: 32px;
|
|
3998
|
+
}
|
|
3999
|
+
`
|
|
4000
|
+
|
|
4001
|
+
export const DotIcon = styled.span<{ $color?: string, $mode?: 'activities' }>`
|
|
4002
|
+
display: inline-block;
|
|
4003
|
+
vertical-align: middle;
|
|
4004
|
+
margin-right: 8px;
|
|
4005
|
+
margin-top: -4px;
|
|
4006
|
+
width: 4px;
|
|
4007
|
+
height: 4px;
|
|
4008
|
+
border-radius: 2px;
|
|
4009
|
+
|
|
4010
|
+
${({ $color }) => $color && css`
|
|
4011
|
+
background-color: ${$color}
|
|
4012
|
+
`}
|
|
4013
|
+
|
|
4014
|
+
${({ $mode }) => $mode === 'activities' && css`
|
|
4015
|
+
margin-top: -6px;
|
|
4016
|
+
margin-left: -2.5px;
|
|
4017
|
+
width: 8px;
|
|
4018
|
+
height: 8px;
|
|
4019
|
+
border-radius: 4px;
|
|
4020
|
+
`}
|
|
4021
|
+
`
|
|
4022
|
+
|
|
4023
|
+
export const ItemQtyLabel = styled.span`
|
|
4024
|
+
text-align: right;
|
|
4025
|
+
display: grid;
|
|
4026
|
+
`
|
|
4027
|
+
|
|
4028
|
+
export const APILabel = styled.label`
|
|
4029
|
+
color: var(--act-clr);
|
|
4030
|
+
font-size: 10px;
|
|
4031
|
+
text-transform: uppercase;
|
|
4032
|
+
letter-spacing: .5px;
|
|
4033
|
+
padding: 3px 5px;
|
|
4034
|
+
background-color: #21BA45;
|
|
4035
|
+
display: block;
|
|
4036
|
+
position: absolute;
|
|
4037
|
+
right: 10px;
|
|
4038
|
+
top: 12px;
|
|
4039
|
+
z-index: 1;
|
|
4040
|
+
border-radius: var(--ter-rd);
|
|
3904
4041
|
`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Image from '.'
|
|
2
|
+
|
|
3
|
+
import { InitialContainer, APILabel } from '../../assets/stylesheets/shares.styles'
|
|
4
|
+
|
|
5
|
+
import { ImageMode } from './type'
|
|
6
|
+
|
|
7
|
+
const ImageChannel = ({ data, label, size, isImageOnly, $mode }:{ data?: any, label?: string, size?: string, isImageOnly?: boolean, $mode?: ImageMode }) => {
|
|
8
|
+
const fontSize = size ? ((parseInt(size) / 2) > 10 ? (parseInt(size) / 2) : 10) : 10
|
|
9
|
+
const defSize = size || '20px'
|
|
10
|
+
|
|
11
|
+
if (!data) {
|
|
12
|
+
return (
|
|
13
|
+
<>{!isImageOnly && <span>{label || '-'}</span>}</>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const defName = label || data?.name || data?.storeName || data?.store_name || data?.accountName || data?.channelName || data?.channel_name || 'No Store'
|
|
18
|
+
const defSrc = data?.icon || data?.imageUrl || data?.channelImage || data?.channel_image || ''
|
|
19
|
+
const defColor = data?.color || data?.channelColor || data?.channel_color || '#ooo'
|
|
20
|
+
const defInitial = data?.channelInitials || data?.channelInitial || data?.channel_initials || data?.initials || ''
|
|
21
|
+
const isAPI = data?.availableAPI
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<div>
|
|
26
|
+
{defSrc ? (
|
|
27
|
+
<Image
|
|
28
|
+
$mode={$mode}
|
|
29
|
+
width='auto'
|
|
30
|
+
height={defSize}
|
|
31
|
+
src={defSrc || '/'}
|
|
32
|
+
alt={data.channelName || data.channel_name || ''}
|
|
33
|
+
/>
|
|
34
|
+
) : (
|
|
35
|
+
defInitial? (
|
|
36
|
+
<InitialContainer style={{
|
|
37
|
+
width: defSize,
|
|
38
|
+
height: defSize,
|
|
39
|
+
backgroundColor: defColor,
|
|
40
|
+
fontSize: fontSize+'px'}}
|
|
41
|
+
>{defInitial}</InitialContainer>
|
|
42
|
+
) : (
|
|
43
|
+
<Image
|
|
44
|
+
$mode={$mode}
|
|
45
|
+
width='auto'
|
|
46
|
+
height={defSize}
|
|
47
|
+
src={'/'}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
{!isImageOnly && (
|
|
53
|
+
<span className='multi-elipsis' title={defName}>
|
|
54
|
+
{defName}
|
|
55
|
+
{isAPI && <APILabel className='_refLabel'>API</APILabel>}
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
</>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default ImageChannel
|