forstok-ui-lib 6.20.2 → 6.21.2
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 -49
- package/dist/index.js +571 -1167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +569 -1165
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/javascripts/function.ts +21 -0
- package/src/assets/javascripts/helper.ts +11 -2
- package/src/components/index.ts +0 -1
- package/src/components/link/index.tsx +4 -1
- package/src/components/link/styles.ts +152 -144
- package/src/components/link/typed.ts +10 -0
- package/src/typeds/shares.typed.ts +26 -26
- package/src/components/masterTable/index.tsx +0 -649
- package/src/components/masterTable/partials/datas/confirm.tsx +0 -92
- package/src/components/masterTable/partials/datas/index.tsx +0 -81
- package/src/components/masterTable/partials/editors/date.bare.tsx +0 -39
- package/src/components/masterTable/partials/editors/date.tsx +0 -123
- package/src/components/masterTable/partials/editors/image.tsx +0 -61
- package/src/components/masterTable/partials/editors/input.bare.tsx +0 -127
- package/src/components/masterTable/partials/editors/input.tsx +0 -140
- package/src/components/masterTable/partials/editors/label.tsx +0 -128
- package/src/components/masterTable/partials/editors/select.bare.tsx +0 -104
- package/src/components/masterTable/partials/editors/select.tsx +0 -142
- package/src/components/masterTable/partials/editors/switch.tsx +0 -56
- package/src/components/masterTable/partials/editors/tag.tsx +0 -49
- package/src/components/masterTable/partials/editors/textarea.tsx +0 -7
- package/src/components/masterTable/styles.tsx +0 -1011
- package/src/components/masterTable/typed.ts +0 -87
package/package.json
CHANGED
|
@@ -113,6 +113,27 @@ export const currencyNumber = (value?: number | null) => {
|
|
|
113
113
|
return (value !== undefined && value !== null) ? value.toLocaleString('id-ID', { style: 'currency', currency: 'IDR', minimumFractionDigits: 0 }) : '-'
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
export const generateSUM = (names: string[] | string, data: any, type?: string) => {
|
|
117
|
+
let result: number = 0
|
|
118
|
+
if (data && names) {
|
|
119
|
+
result = data.reduce((_sum: any, cur: any) => {
|
|
120
|
+
let _name
|
|
121
|
+
if (Array.isArray(names)) {
|
|
122
|
+
_name = cur
|
|
123
|
+
for (const name of names) {
|
|
124
|
+
if (name in _name) {
|
|
125
|
+
_name = _name[name]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
_name = cur[names]
|
|
130
|
+
}
|
|
131
|
+
return _sum + (type === 'currency' ? parseInt(_name.replace(/,.*|[^0-9]/g, '')) : _name)
|
|
132
|
+
}, 0)
|
|
133
|
+
}
|
|
134
|
+
return result
|
|
135
|
+
}
|
|
136
|
+
|
|
116
137
|
export const evUpdateInputRc = (input?: HTMLInputElement, value?: string | number) => {
|
|
117
138
|
if (!input) {
|
|
118
139
|
return false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TObject } from '../../typeds';
|
|
1
|
+
import { BodyContentMode, TObject } from '../../typeds';
|
|
2
2
|
|
|
3
3
|
export const dateRangeStatus = (value: string) => {
|
|
4
4
|
const statusObj: TObject = { 'today': 'Today', 'lastweek': 'Last 7 days', 'lastsecondweek': 'Last 14 days', 'lastmonth': 'Last 30 days', 'lastquart': 'Last 90 days', 'custom': 'Date' }
|
|
5
5
|
return statusObj[value]
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const pageMasterTable = (value
|
|
8
|
+
export const pageMasterTable = (value?: BodyContentMode) => {
|
|
9
9
|
switch (value) {
|
|
10
10
|
case 'create-master': case 'edit-master':
|
|
11
11
|
return 'master'
|
|
@@ -154,6 +154,15 @@ export const typePage = (value?: string) => {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
export const isCustomVariantChannel = (channelId: number) => {
|
|
158
|
+
let result = false
|
|
159
|
+
if (channelId !== undefined) {
|
|
160
|
+
const listCompareChannels = [9, 3, 12, 10030, 15, 13] //blibli, lazada, shopee, tiktok, tokopedia, zalora
|
|
161
|
+
result = listCompareChannels.includes(channelId)
|
|
162
|
+
}
|
|
163
|
+
return result
|
|
164
|
+
}
|
|
165
|
+
|
|
157
166
|
export const historyType = (name?: string) => {
|
|
158
167
|
if(!name) return ''
|
|
159
168
|
switch(name) {
|
package/src/components/index.ts
CHANGED
|
@@ -24,7 +24,6 @@ export { default as DateComponent } from './date';
|
|
|
24
24
|
export { default as DateTimeComponent } from './datetime';
|
|
25
25
|
export { default as RadioComponent } from './radio';
|
|
26
26
|
export { default as SwitchComponent } from './switch';
|
|
27
|
-
export { default as MasterTableComponent } from './masterTable';
|
|
28
27
|
export { default as ListComponent } from './list';
|
|
29
28
|
|
|
30
29
|
export * from './message/typed';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ReactNode, MouseEvent, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
2
3
|
import { AnchorLinkContainer, ElLinkContainer } from './styles';
|
|
3
4
|
|
|
5
|
+
import { LinkMode } from './typed'
|
|
6
|
+
|
|
4
7
|
type TLinkBase = {
|
|
5
8
|
children: ReactNode
|
|
6
|
-
mode?:
|
|
9
|
+
mode?: LinkMode
|
|
7
10
|
$activated?: boolean
|
|
8
11
|
$elipsis?: boolean
|
|
9
12
|
$shadow?: boolean
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Link } from 'react-router-dom'
|
|
2
|
+
import styled, { css } from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import IconXls from '../../assets/images/icons/xls.svg'
|
|
5
|
+
import { multiElipsis } from '../../assets/stylesheets/bases.styles'
|
|
6
|
+
import { LinkMode } from './typed'
|
|
5
7
|
|
|
6
|
-
const ClearStyles = css`
|
|
7
|
-
color: var(--pri-clr-lnk);
|
|
8
|
-
&,
|
|
9
|
-
&:hover {
|
|
10
|
-
text-decoration: none;
|
|
11
|
-
}
|
|
12
|
-
&:hover {
|
|
13
|
-
color: var(--pri-clr-lnk__hvr);
|
|
14
|
-
}
|
|
15
|
-
`
|
|
16
|
-
const ClearRStyles = css`
|
|
17
|
-
color: var(--pri-clr-lnk);
|
|
18
|
-
&,
|
|
19
|
-
&:hover {
|
|
20
|
-
text-decoration: none;
|
|
21
|
-
}
|
|
22
|
-
&:hover {
|
|
23
|
-
color: var(--sec-clr-lnk__hvr);
|
|
24
|
-
}
|
|
25
|
-
`
|
|
26
8
|
const ButtonStyles = css`
|
|
27
9
|
position: relative;
|
|
28
10
|
display: inline-grid;
|
|
@@ -38,132 +20,158 @@ const ButtonStyles = css`
|
|
|
38
20
|
text-decoration: none;
|
|
39
21
|
}
|
|
40
22
|
`
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
style += ButtonStyles + `
|
|
96
|
-
color: var(--act-clr);
|
|
97
|
-
background-color: var(--act-clr-bg);
|
|
98
|
-
&:hover {
|
|
99
|
-
background-color: var(--act-clr-bg__hvr);
|
|
100
|
-
}
|
|
101
|
-
`
|
|
102
|
-
} else if (mode === 'greyB') {
|
|
103
|
-
style += ButtonStyles + `
|
|
104
|
-
color: var(--act-clr);
|
|
23
|
+
const modeStyles = {
|
|
24
|
+
clear: css`
|
|
25
|
+
color: var(--pri-clr-lnk);
|
|
26
|
+
&,
|
|
27
|
+
&:hover {
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
}
|
|
30
|
+
&:hover {
|
|
31
|
+
color: var(--pri-clr-lnk__hvr);
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
clearR: css`
|
|
35
|
+
color: var(--pri-clr-lnk);
|
|
36
|
+
&,
|
|
37
|
+
&:hover {
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
&:hover {
|
|
41
|
+
color: var(--sec-clr-lnk__hvr);
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
blue: css`
|
|
45
|
+
&,
|
|
46
|
+
&:hover {
|
|
47
|
+
color: var(--pri-clr-lnk__hvr);
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
trans: css`
|
|
52
|
+
${ButtonStyles}
|
|
53
|
+
height: auto;
|
|
54
|
+
padding: 0;
|
|
55
|
+
opacity: 1;
|
|
56
|
+
&,
|
|
57
|
+
&:hover {
|
|
58
|
+
color: var(--pri-clr-lnk__hvr);
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
}
|
|
61
|
+
&:hover {
|
|
62
|
+
opacity: .9;
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
hover: css`
|
|
66
|
+
${ButtonStyles}
|
|
67
|
+
height: auto;
|
|
68
|
+
width: max-content;
|
|
69
|
+
padding: 3px 6px;
|
|
70
|
+
position: relative;
|
|
71
|
+
left: -6px;
|
|
72
|
+
color: initial;
|
|
73
|
+
grid-gap: 4px;
|
|
74
|
+
&:hover {
|
|
75
|
+
border-radius: var(--ter-rd);
|
|
76
|
+
box-shadow: 1px 1px var(--pri-clr-ln);
|
|
105
77
|
background-color: var(--mt-clr-bg__fc);
|
|
106
|
-
|
|
107
|
-
background-color: var(--cl-clr-bg__hvr);
|
|
108
|
-
}
|
|
109
|
-
`
|
|
110
|
-
}
|
|
111
|
-
if ($activated) {
|
|
112
|
-
style += `
|
|
113
|
-
color: var(--sta-clr);
|
|
114
|
-
font-weight: 400;
|
|
115
|
-
`
|
|
116
|
-
if (mode === 'clear' || mode === 'clearR') {
|
|
117
|
-
style += `
|
|
118
|
-
color: var(--pri-clr-lnk__act);
|
|
119
|
-
font-weight: 600;
|
|
120
|
-
`
|
|
78
|
+
text-decoration: none;
|
|
121
79
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
80
|
+
`,
|
|
81
|
+
whiteB: css`
|
|
82
|
+
${ButtonStyles}
|
|
83
|
+
color: var(--ter-clr);
|
|
84
|
+
background-color: var(--cl-clr-bg);
|
|
85
|
+
border: 1px solid var(--sec-clr-ln);
|
|
86
|
+
&,
|
|
87
|
+
&:hover {
|
|
88
|
+
background-color: var(--cl-clr-bg__hvr);
|
|
89
|
+
}
|
|
90
|
+
`,
|
|
91
|
+
redB: css`
|
|
92
|
+
${ButtonStyles}
|
|
93
|
+
color: var(--act-clr);
|
|
94
|
+
background-color: var(--act-clr-bg);
|
|
95
|
+
&:hover {
|
|
96
|
+
background-color: var(--act-clr-bg__hvr);
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
greyB: css`
|
|
100
|
+
${ButtonStyles}
|
|
101
|
+
color: var(--act-clr);
|
|
102
|
+
background-color: var(--mt-clr-bg__fc);
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: var(--cl-clr-bg__hvr);
|
|
105
|
+
}
|
|
106
|
+
`,
|
|
107
|
+
table: css`
|
|
108
|
+
display: block;
|
|
109
|
+
width: 100%;
|
|
110
|
+
text-wrap: wrap;
|
|
111
|
+
word-wrap: break-word;
|
|
112
|
+
font-size: 13px;
|
|
113
|
+
`
|
|
114
|
+
} as const
|
|
115
|
+
const getLinkModifiedStyled = ({ mode, $elipsis, $activated, $shadow, $iconRight, disabled }:{ mode?: LinkMode, $elipsis: boolean, $activated: boolean, $shadow: boolean, $iconRight?: string, disabled: boolean }) => css`
|
|
116
|
+
${mode && modeStyles[mode]}
|
|
117
|
+
|
|
118
|
+
${$activated && css`
|
|
119
|
+
color: var(--sta-clr);
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
`}
|
|
122
|
+
|
|
123
|
+
${(mode === 'clear' || mode === 'clearR') && css`
|
|
124
|
+
font-weight: ${$activated ? '600' : 'normal'};
|
|
125
|
+
color: ${$activated ? 'var(--pri-clr-lnk__act) !important' : 'inherit'};
|
|
126
|
+
`}
|
|
127
|
+
|
|
128
|
+
${$elipsis && css`
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
display: block;
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
width: auto;
|
|
135
|
+
${multiElipsis}
|
|
136
|
+
`}
|
|
162
137
|
|
|
163
|
-
|
|
138
|
+
${$shadow && css`
|
|
139
|
+
box-shadow: var(--act-shd-bx);
|
|
140
|
+
`}
|
|
141
|
+
|
|
142
|
+
${$iconRight === 'xls' && css`
|
|
143
|
+
position: relative;
|
|
144
|
+
padding-right: 21px;
|
|
145
|
+
&:before {
|
|
146
|
+
content: url(${IconXls});
|
|
147
|
+
position: absolute;
|
|
148
|
+
right: 0px;
|
|
149
|
+
top: -4px;
|
|
150
|
+
width: 18px;
|
|
151
|
+
height: 18px;
|
|
152
|
+
}
|
|
153
|
+
`}
|
|
154
|
+
|
|
155
|
+
${disabled && css`
|
|
156
|
+
color: #A9A9A9;
|
|
157
|
+
opacity: 0.7;
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
`}
|
|
160
|
+
`
|
|
161
|
+
export const AnchorLinkContainer = styled.a<{ mode?: LinkMode, $elipsis: boolean, $activated: boolean, $shadow: boolean, $iconRight?: string, disabled: boolean }>`
|
|
164
162
|
${getLinkModifiedStyled}
|
|
165
163
|
`
|
|
166
|
-
|
|
164
|
+
|
|
165
|
+
export const ElLinkContainer = styled.span<{ mode?: LinkMode, $elipsis: boolean, $activated: boolean, $shadow: boolean, $iconRight?: string, disabled: boolean }>`
|
|
167
166
|
cursor:pointer;
|
|
168
167
|
${getLinkModifiedStyled}
|
|
168
|
+
`
|
|
169
|
+
|
|
170
|
+
export const LinkContainer = styled(Link)<{ mode?: LinkMode, $elipsis: boolean, $activated: boolean, $shadow: boolean, $iconRight?: string, disabled: boolean }>`
|
|
171
|
+
&._refHoverLink {
|
|
172
|
+
padding: 3px 0px 0px 6px;
|
|
173
|
+
position: relative;
|
|
174
|
+
top: -3px;
|
|
175
|
+
}
|
|
176
|
+
${getLinkModifiedStyled}
|
|
169
177
|
`
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Dispatch, JSX } from 'react';
|
|
2
2
|
import { TChangeEvent, TMouseEvent, TObject, TPage, TState, TUPage } from './base.typed';
|
|
3
|
-
import { TCustomField, TAutoCopy } from '../components/masterTable/typed';
|
|
4
3
|
import { TMessageFunction, TMessageQuestionFunction } from '../components/message/typed';
|
|
5
4
|
import { TPopupFunction, TPopupOpenFunction } from '../components/popup/typed';
|
|
6
5
|
import { TOption } from '../components/select/typed';
|
|
@@ -85,30 +84,7 @@ export type THeadProps = {
|
|
|
85
84
|
placeholder?: string
|
|
86
85
|
isHidden?: boolean
|
|
87
86
|
showFormat?: string
|
|
88
|
-
|
|
89
|
-
export type TMasterProps = {
|
|
90
|
-
data: any
|
|
91
|
-
setData: any
|
|
92
|
-
headerColumns: THeadProps[]
|
|
93
|
-
evCreateMessage?: TMessageFunction
|
|
94
|
-
evCreateMessageQuestion?: TMessageQuestionFunction
|
|
95
|
-
type?: string
|
|
96
|
-
isLessField?: boolean
|
|
97
|
-
isForceUpdateField?: boolean
|
|
98
|
-
setForceUpdateField?: TState<boolean>
|
|
99
|
-
evOpenPopup?: TPopupOpenFunction
|
|
100
|
-
autoCopy?: TAutoCopy
|
|
101
|
-
setAutoCopy?: TState<TAutoCopy>
|
|
102
|
-
isAutoCopyField?: boolean
|
|
103
|
-
resultPopup?: TObject | null
|
|
104
|
-
setResultPopup?: TState<TObject | null>
|
|
105
|
-
evCheckAllValidation?: any
|
|
106
|
-
dataCustomField?: TCustomField[]
|
|
107
|
-
setDataCustomField?: TState<TCustomField[]>
|
|
108
|
-
isRemovable?: boolean
|
|
109
|
-
isForceUpdate?: boolean
|
|
110
|
-
setForceUpdate?: TState<boolean>
|
|
111
|
-
evPickAll?: TMouseEvent
|
|
87
|
+
containOfType?: string[] | null
|
|
112
88
|
}
|
|
113
89
|
|
|
114
90
|
export type TInData<TData = never> = {
|
|
@@ -320,4 +296,28 @@ export type modeTable =
|
|
|
320
296
|
| 'price'
|
|
321
297
|
| 'price'
|
|
322
298
|
| 'price-full'
|
|
323
|
-
| 'price-mid'
|
|
299
|
+
| 'price-mid'
|
|
300
|
+
|
|
301
|
+
export type BodyContentStyle =
|
|
302
|
+
| 'create-return'
|
|
303
|
+
| 'create-price'
|
|
304
|
+
| 'create-adjustment'
|
|
305
|
+
| 'create-outbound'
|
|
306
|
+
| 'confirm-inbound'
|
|
307
|
+
| 'confirm-outbound'
|
|
308
|
+
| 'confirm-adjustment'
|
|
309
|
+
|
|
310
|
+
export type BodyContentMode = BodyContentStyle
|
|
311
|
+
| 'create-promotion'
|
|
312
|
+
| 'create-inbound'
|
|
313
|
+
| 'create-transfer'
|
|
314
|
+
| 'create-picklist'
|
|
315
|
+
| 'edit-picklist'
|
|
316
|
+
| 'create-package'
|
|
317
|
+
| 'edit-master'
|
|
318
|
+
| 'putaway-inbound'
|
|
319
|
+
| 'create-paymentreceive'
|
|
320
|
+
| 'create-master'
|
|
321
|
+
| 'create-listing'
|
|
322
|
+
| 'create-adjustment'
|
|
323
|
+
| 'edit-listing'
|