forstok-ui-lib 5.3.6 → 5.4.3

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.
Files changed (32) hide show
  1. package/dist/index.d.ts +108 -5
  2. package/dist/index.js +1044 -163
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1036 -155
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +3 -1
  7. package/src/assets/images/icons/edit-white.svg +5 -0
  8. package/src/assets/images/icons/loading-red.svg +27 -0
  9. package/src/assets/javascripts/function.ts +319 -10
  10. package/src/assets/javascripts/helper.ts +47 -0
  11. package/src/assets/stylesheets/shares.styles.ts +168 -0
  12. package/src/components/index.ts +2 -0
  13. package/src/components/masterTable/index.tsx +649 -0
  14. package/src/components/masterTable/partials/datas/confirm.tsx +92 -0
  15. package/src/components/masterTable/partials/datas/index.tsx +81 -0
  16. package/src/components/masterTable/partials/editors/date.bare.tsx +39 -0
  17. package/src/components/masterTable/partials/editors/date.tsx +123 -0
  18. package/src/components/masterTable/partials/editors/image.tsx +61 -0
  19. package/src/components/masterTable/partials/editors/input.bare.tsx +127 -0
  20. package/src/components/masterTable/partials/editors/input.tsx +140 -0
  21. package/src/components/masterTable/partials/editors/label.tsx +128 -0
  22. package/src/components/masterTable/partials/editors/select.bare.tsx +104 -0
  23. package/src/components/masterTable/partials/editors/select.tsx +142 -0
  24. package/src/components/masterTable/partials/editors/switch.tsx +56 -0
  25. package/src/components/masterTable/partials/editors/tag.tsx +49 -0
  26. package/src/components/masterTable/partials/editors/textarea.tsx +7 -0
  27. package/src/components/masterTable/styles.tsx +1012 -0
  28. package/src/components/masterTable/typed.ts +87 -0
  29. package/src/components/switch/index.tsx +52 -0
  30. package/src/components/switch/styles.ts +34 -0
  31. package/src/declarations.d.ts +3 -1
  32. package/src/typeds/shares.typed.ts +56 -2
@@ -0,0 +1,87 @@
1
+ import type { JSX } from 'react';
2
+ import type { TMouseEvent, TObject, TState } from '../../typeds/base.typed';
3
+ import type { THeadProps } from '../../typeds/shares.typed';
4
+ import { TPopupOpenFunction } from '../popup/typed';
5
+
6
+ export type TAutoCopyObj = {
7
+ category: string
8
+ copy : {
9
+ id: number
10
+ accountIds: number[]
11
+ }[]
12
+ channelId?: number
13
+ start? : {
14
+ accId: number
15
+ id: number
16
+ }
17
+ keys?: string[]
18
+ }
19
+
20
+ export type TAutoCopy = TAutoCopyObj[]
21
+
22
+ export type TCustomField = {
23
+ accountId: number
24
+ header: any
25
+ id: number
26
+ }
27
+
28
+ export type TEditorProps = {
29
+ head: THeadProps
30
+ value: any
31
+ height?: number | string
32
+ idx: number
33
+ evChange: (head: THeadProps, value: any, idx: number, variantIdx?: number) => void
34
+ evCloseEditor: (callback?: () => void) => void
35
+ variantIdx?: number
36
+ evOpenPopup?: TPopupOpenFunction
37
+ error: string
38
+ resultPopup?: TObject | null
39
+ setResultPopup?: TState<TObject | null>
40
+ content?: any
41
+ type?: string
42
+ isForceUpdate?: boolean
43
+ setForceUpdate?: TState<boolean>
44
+ }
45
+
46
+ export type TReloadField = {
47
+ ids: number[]
48
+ accountIds: number[]
49
+ start? : {
50
+ accId: number
51
+ id: number
52
+ }
53
+ isFirst?: boolean
54
+ next?: {
55
+ keyAlias: string
56
+ value: any
57
+ }
58
+ } | undefined
59
+
60
+ export type TFieldEditorProps = {
61
+ custom: any
62
+ content: any
63
+ idx: number
64
+ defaultValue?: any
65
+ name: string
66
+ isError?: string | TObject[]
67
+ 'data-qa-id'?: string
68
+ 'data-tip'?: string
69
+ 'data-place'?: string
70
+ 'data-type'?: string
71
+ evChangeCustom?: (key: string, value: any) => void
72
+ }
73
+
74
+ export type TDataPartial = {
75
+ data: any
76
+ heightContent?: number
77
+ firstHeaderColumnsWidth: number
78
+ evCheckbox: TMouseEvent
79
+ headerColumns: THeadProps[]
80
+ switchEditor: (idx: number, head: THeadProps, valueKey: any, error: string, variantIdx?: number, height?: number | string, content?: any) => JSX.Element
81
+ totalColGroupWidth?: number
82
+ lastHeaderColumnsWidth: number
83
+ evRemove: TMouseEvent
84
+ type?: string
85
+ isRemovable?: boolean
86
+ evPickAll?: TMouseEvent
87
+ }
@@ -0,0 +1,52 @@
1
+ import { type ChangeEvent, type InputHTMLAttributes, useState, useEffect } from 'react';
2
+ import { SwitchContainer, InputContainer, LabelContainer } from './styles';
3
+ import type { TState } from '../../typeds/base.typed';
4
+
5
+ type TInput = InputHTMLAttributes<HTMLInputElement> & {
6
+ reset?: boolean
7
+ setReset?: TState<boolean>
8
+ isForceUpdate?: boolean
9
+ setForceUpdate?: TState<boolean>
10
+ evChange?: (e: ChangeEvent<HTMLInputElement>) => void
11
+ }
12
+
13
+ const SwitchComponent = ({ isForceUpdate, setForceUpdate, reset, setReset, evChange, ...props }: TInput) => {
14
+ const { id, defaultChecked } = props;
15
+
16
+ const [inputChecked, evInputChecked] = useState<boolean>(defaultChecked||false);
17
+
18
+ useEffect(() => {
19
+ if (isForceUpdate) {
20
+ evInputChecked(defaultChecked||false);
21
+ setForceUpdate && setForceUpdate(false);
22
+ }
23
+ if (reset) {
24
+ evInputChecked(false);
25
+ setReset && setReset(false);
26
+ }
27
+ }, [isForceUpdate, setForceUpdate, reset, setReset, defaultChecked, evInputChecked])
28
+
29
+ const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
30
+ const _value = e.target.checked;
31
+ evInputChecked(_value);
32
+ }
33
+
34
+ let parseProps = {...props};
35
+ delete parseProps.defaultChecked;
36
+
37
+ return (
38
+ <SwitchContainer>
39
+ <InputContainer
40
+ type='checkbox'
41
+ checked={inputChecked}
42
+ onChange={(e: ChangeEvent<HTMLInputElement>) => {
43
+ handleChange(e)
44
+ evChange && evChange(e)
45
+ }}
46
+ {...parseProps} />
47
+ <LabelContainer role='checkbox-label' htmlFor={id} />
48
+ </SwitchContainer>
49
+ )
50
+ }
51
+
52
+ export default SwitchComponent
@@ -0,0 +1,34 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const SwitchContainer = styled.div`
4
+ > input:checked + label::after {
5
+ left: 16px;
6
+ }
7
+ > input:checked + label {
8
+ background-color: var(--sw-clr-bg__fc);
9
+ }
10
+ `
11
+ export const InputContainer = styled.input`
12
+ display: none;
13
+ `
14
+ export const LabelContainer = styled.label`
15
+ position: relative;
16
+ display: inline-block;
17
+ width: 32px;
18
+ height: 16px;
19
+ background-color: var(--sw-clr-bg);
20
+ border-radius: 20px;
21
+ transition: all 0.3s;
22
+ cursor: pointer;
23
+ &::after {
24
+ content: '';
25
+ position: absolute;
26
+ width: 14px;
27
+ height: 14px;
28
+ border-radius:50%;
29
+ background-color:var(--pri-clr-bg);
30
+ top: 1px;
31
+ left: 1px;
32
+ transition: all 0.3s;
33
+ }
34
+ `
@@ -51,4 +51,6 @@ declare module '*.module.scss' {
51
51
  declare module '*.module.sass' {
52
52
  const classes: { readonly [key: string]: string };
53
53
  export default classes;
54
- }
54
+ }
55
+
56
+ declare module 'approvejs';
@@ -1,7 +1,9 @@
1
- import { TObject } from './base.typed';
1
+ import { TMouseEvent, TObject, TState } from './base.typed';
2
2
  import { TCloseDropdownFunction } from '../components/dropdown/typed';
3
+ import { TCustomField, TAutoCopy } from '../components/masterTable/typed';
3
4
  import { TMessageFunction, TMessageQuestionFunction } from '../components/message/typed';
4
5
  import { TPopupFunction, TPopupOpenFunction } from '../components/popup/typed';
6
+ import { TOption } from '../components/select/typed';
5
7
 
6
8
  export type TUser = {
7
9
  profile_id: number,
@@ -53,4 +55,56 @@ export type TChannel = {
53
55
  storeImageName?: string
54
56
  }[]
55
57
  availableAPI?: boolean | null
56
- }
58
+ }
59
+ export type THeadProps = {
60
+ key: string
61
+ name: string
62
+ fieldType: string
63
+ validations?: TObject
64
+ width: number
65
+ typeData: string
66
+ condition?: string
67
+ type?: string
68
+ bare?: boolean,
69
+ multiline?: boolean
70
+ options?: TOption[],
71
+ isMassEditable?: boolean
72
+ isMassClearable?: boolean
73
+ value?: number
74
+ schema?: string
75
+ align?: any
76
+ format?: string
77
+ allowEmpty?: boolean
78
+ customOptionKey?: string
79
+ icon?: string
80
+ initial?: string
81
+ color?: string
82
+ tip?: string
83
+ placeholder?: string
84
+ isHidden?: boolean
85
+ showFormat?: string
86
+ }
87
+ export type TMasterProps = {
88
+ data: any
89
+ setData: any
90
+ headerColumns: THeadProps[]
91
+ evCreateMessage?: TMessageFunction
92
+ evCreateMessageQuestion?: TMessageQuestionFunction
93
+ type?: string
94
+ isLessField?: boolean
95
+ isForceUpdateField?: boolean
96
+ setForceUpdateField?: TState<boolean>
97
+ evOpenPopup?: TPopupOpenFunction
98
+ autoCopy?: TAutoCopy
99
+ setAutoCopy?: TState<TAutoCopy>
100
+ isAutoCopyField?: boolean
101
+ resultPopup?: TObject | null
102
+ setResultPopup?: TState<TObject | null>
103
+ evCheckAllValidation?: any
104
+ dataCustomField?: TCustomField[]
105
+ setDataCustomField?: TState<TCustomField[]>
106
+ isRemovable?: boolean
107
+ isForceUpdate?: boolean
108
+ setForceUpdate?: TState<boolean>
109
+ evPickAll?: TMouseEvent
110
+ }