forstok-ui-lib 5.13.4 → 5.13.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forstok-ui-lib",
3
- "version": "5.13.4",
3
+ "version": "5.13.6",
4
4
  "description": "Forstok UI Components Library",
5
5
  "path": "dist",
6
6
  "main": "dist/index.js",
@@ -5,30 +5,30 @@ import { TObject } from '../../typeds/base.typed';
5
5
  import { errorTitle } from './helper';
6
6
 
7
7
  export const getStorage = (name: string, type: string = 'string', defaultVal?: any, loadName: string = 'load') => {
8
- let result: any;
8
+ let result: any
9
9
  if (sessionStorage.getItem(loadName) !== null) {
10
- result = sessionStorage.getItem(name) !== null ? sessionStorage.getItem(name) : defaultVal;
10
+ result = sessionStorage.getItem(name) !== null ? sessionStorage.getItem(name) : defaultVal
11
11
  } else {
12
- result = localStorage.getItem(name) !== null ? localStorage.getItem(name) : defaultVal;
13
- localStorage.getItem(name) !== null && sessionStorage.setItem(name, result);
12
+ result = localStorage.getItem(name) !== null ? localStorage.getItem(name) : defaultVal
13
+ localStorage.getItem(name) !== null && sessionStorage.setItem(name, result)
14
14
  }
15
15
  switch (type) {
16
16
  case 'boolean':
17
- result = (result !== undefined && result !== 'undefined') ? (result === 'true') : false;
18
- break;
17
+ result = (result !== undefined && result !== 'undefined') ? (result === 'true') : false
18
+ break
19
19
  case 'number':
20
20
  case 'integer':
21
- result = (result !== undefined && result !== 'undefined') ? parseInt(result) : 0;
22
- break;
21
+ result = (result !== undefined && result !== 'undefined') ? parseInt(result) : 0
22
+ break
23
23
  case 'object':
24
24
  case 'array':
25
- result = (result !== undefined && result !== 'undefined') ? JSON.parse(result) : undefined;
26
- break;
25
+ result = (result !== undefined && result !== 'undefined') ? (typeof result === 'string' ? (result !== '' ? JSON.parse(result) : undefined) : result) : undefined
26
+ break
27
27
  default:
28
- result = (result === undefined || result === 'undefined') ? '' : result;
29
- break;
28
+ result = (result === undefined || result === 'undefined') ? '' : result
29
+ break
30
30
  }
31
- return result;
31
+ return result
32
32
  }
33
33
 
34
34
  export const setStorage = (name: string, value?: any, only?: string) => {
@@ -51,7 +51,6 @@ export const dropBase = css`
51
51
  export const headTable = css`
52
52
  font-size: 12px;
53
53
  font-weight: 600;
54
- letter-spacing: 0.3px;
55
54
  text-transform: capitalize;
56
55
  `
57
56
  export const formLabel = css`
@@ -1807,7 +1807,6 @@ export const HeaderContainer = styled.aside`
1807
1807
  }
1808
1808
  `
1809
1809
  export const Title = styled.h1`
1810
- font-family: PT Sans;
1811
1810
  font-size: 22px;
1812
1811
  color: var(--ter-clr);
1813
1812
  > aside {
@@ -2445,7 +2444,6 @@ export const TabsHeader = styled.article`
2445
2444
  ${responseWidth}
2446
2445
  `
2447
2446
  export const TabsItem = styled.div<{ $activated?: boolean }>`
2448
- font-family: var(--sec-ft-fm);
2449
2447
  cursor: pointer;
2450
2448
  letter-spacing: 0.6px;
2451
2449
  position: relative;
@@ -13,7 +13,7 @@ import ImageComponent from '../image';
13
13
  import TextComponent from '../text';
14
14
  import CheckboxComponent from '../checkbox';
15
15
  import LinkComponent from '../link';
16
- import { generateMessage, generateMessageQuestion, generateValue, validateByApproveJs } from '../../assets/javascripts/function';
16
+ import { evGenerateValueMatch, generateMessage, generateMessageQuestion, generateValue, validateByApproveJs } from '../../assets/javascripts/function';
17
17
 
18
18
  import DateEditors from './partials/editors/date';
19
19
  import DateBareEditors from './partials/editors/date.bare';
@@ -112,7 +112,7 @@ const MasterTableComponent = (props: TMasterProps) => {
112
112
  const evChange = (head: THeadProps, value: any, idx: number, variantIdx?: number) => {
113
113
  const _type = (head?.condition === 'category') ? 'Array' : (head.typeData || 'String');
114
114
  const _value = generateValue(_type, value);
115
- const valid = head?.condition === 'category' ? validateByApproveJs(head, _value, (head?.condition[0].toUpperCase() + head?.condition.substring(1))) : validateByApproveJs(head, _value);
115
+ const valid = head?.condition === 'category' ? validateByApproveJs(head, _value, (head?.condition[0].toUpperCase() + head?.condition.substring(1))) : validateByApproveJs(head, _value, undefined, evGenerateValueMatch(head.validations, data?.[idx]));
116
116
  if (idx >= 0) {
117
117
  let newData = [...data];
118
118
  let newDataByIdx = newData[idx];
@@ -728,7 +728,6 @@ export const MasterTableBodyContent = styled.article<{ $mode?: string }>`
728
728
  background-color: var(--pri-clr-bg);
729
729
  border-bottom: 1px solid var(--sec-clr-ln);
730
730
  h3 {
731
- font-size: 20px;
732
731
  padding: 11px 30px;
733
732
  color: var(---hd-clr);
734
733
  }
@@ -780,7 +779,6 @@ export const TablePopupWrapper = styled.section<{ $mode?: string }>`
780
779
  aside {
781
780
  font-size: 11px;
782
781
  line-height: 15px;
783
- letter-spacing: 0.6px;
784
782
  padding-top: 6px;
785
783
  text-align: center;
786
784
  max-height: 36px;
@@ -242,7 +242,6 @@ export const PopupHeader = styled.h3`
242
242
  }
243
243
  }
244
244
  @media only screen and (min-width: 768px) {
245
- font-size: 20px;
246
245
  padding: 11px 30px;
247
246
  }
248
247
  `
@@ -293,7 +292,7 @@ export const PopupFooter = styled.div<{ $isLeft?: boolean }>`
293
292
  ${({ $isLeft }: { $isLeft?: boolean }) => {
294
293
  if ($isLeft) {
295
294
  return css`
296
- grid-template-columns: 40% 60%;
295
+ grid-template-columns: 42% 58%;
297
296
  `
298
297
  }
299
298
  }}
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import ReactSelect from 'react-select';
3
- import type { SingleValueProps, OptionProps, StylesConfig, ActionMeta, ControlProps, MultiValueProps, OnChangeValue, CSSObjectWithLabel } from 'react-select';
3
+ import type { SingleValueProps, OptionProps, StylesConfig, ActionMeta, ControlProps, MultiValueProps, OnChangeValue, CSSObjectWithLabel, MenuListProps, MultiValueRemoveProps } from 'react-select';
4
4
  import CreatableSelect from 'react-select/creatable';
5
5
  import type { CSSObject } from '@emotion/serialize';
6
6
  import { generateMessageQuestion } from '../../assets/javascripts/function';
@@ -15,6 +15,8 @@ type TSelect = {
15
15
  name?: string
16
16
  customOption?: (arg0: OptionProps) => void
17
17
  customLabel?: (arg0: SingleValueProps) => void
18
+ customMenuList?: (arg0: MenuListProps) => void
19
+ customMultiValueRemove?: (arg0: MultiValueRemoveProps) => void
18
20
  MenuList?: any
19
21
  isCreateable?: boolean
20
22
  isClearable?: boolean
@@ -42,7 +44,7 @@ type TSelect = {
42
44
  height?: string
43
45
  }
44
46
 
45
- const SelectComponent = ({ type, isError=false, mode, customOption, customLabel, MenuList, isCreateable=false, isClearable=false, selectKey, disabled, defaultValue, width, reset, setReset, isForceUpdate, setForceUpdate, isCheckAutoCopy, evChangeCustom, isField, evCreate, evChange, isMinOption, isMulti=false, options, name, placeholder, removeMessage, evCreateMessageQuestion, isLoading, height, ...props }: TSelect) => {
47
+ const SelectComponent = ({ type, isError=false, mode, customOption, customLabel, MenuList, isCreateable=false, isClearable=false, selectKey, disabled, defaultValue, width, reset, setReset, isForceUpdate, setForceUpdate, isCheckAutoCopy, evChangeCustom, isField, evCreate, evChange, isMinOption, isMulti=false, options, name, placeholder, removeMessage, evCreateMessageQuestion, isLoading, height, customMenuList, customMultiValueRemove, ...props }: TSelect) => {
46
48
  const [valueState, setValue] = useState<typeof defaultValue>(defaultValue || null)
47
49
 
48
50
  useEffect(()=> {
@@ -297,6 +299,8 @@ const SelectComponent = ({ type, isError=false, mode, customOption, customLabel,
297
299
  isClearable={isClearable ? ((Array.isArray(valueState) && valueState.length) ? valueState.some((v) => !v.isFixed) : true) : isClearable}
298
300
  {...isMulti && { isMulti: true }}
299
301
  {...customOption && { components: { Option: customOption } }}
302
+ {...customMenuList && { components: { MenuList: customMenuList } }}
303
+ {...customMultiValueRemove && { components: { MultiValueRemove: customMultiValueRemove } }}
300
304
  {...MenuList && { components: { MenuList, Option: customOption } }}
301
305
  {...selectKey && { key: selectKey }}
302
306
  {...disabled && { isDisabled: disabled }}
@@ -321,6 +325,8 @@ const SelectComponent = ({ type, isError=false, mode, customOption, customLabel,
321
325
  {...customOption && { components: { Option: customOption } }}
322
326
  {...mode === 'paymentReceiveStore' && { components: { Option: customOption, SingleValue: customLabel } }}
323
327
  {...customLabel && { components: { SingleValue: customLabel } }}
328
+ {...customMenuList && { components: { MenuList: customMenuList } }}
329
+ {...customMultiValueRemove && { components: { MultiValueRemove: customMultiValueRemove } }}
324
330
  {...MenuList && { components: { MenuList, Option: customOption } }}
325
331
  {...(customLabel && customOption) && { components: { SingleValue: customLabel, Option: customOption } }}
326
332
  {...selectKey && { key: selectKey }}
@@ -134,10 +134,10 @@ export type TInPart = {
134
134
  evCloseDropdown?: TCloseDropdownFunction
135
135
  evCreateMessage?: TMessageFunction
136
136
  evCreateMessageQuestion?: TMessageQuestionFunction
137
- saveSubscription?: (statuses: (string | null)[], id: number) => void
137
+ saveSubscription?: (statuses: (string | null)[], id: string | number) => void
138
138
  clearSubscription?: ()=> void
139
139
  data?: any
140
- id?: string
140
+ id?: string | number
141
141
  evPrintReceipt?: (dataOrder: any) => void
142
142
  }
143
143