amotify 0.0.2 → 0.0.4
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/src/@jsminAmotifyExtension/_.d.ts +4 -0
- package/dist/src/@jsminAmotifyExtension/fetch.d.ts +9 -0
- package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +1 -0
- package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +4 -0
- package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/src/@types/_.d.ts +6 -0
- package/dist/src/@types/amot.d.ts +260 -0
- package/dist/src/@types/fn.d.ts +1040 -0
- package/dist/src/@types/index.d.ts +62 -0
- package/dist/src/@types/jsminAmotifyExtension.d.ts +134 -0
- package/dist/src/@types/module.d.ts +2 -0
- package/dist/src/@types/state.d.ts +145 -0
- package/dist/src/Atoms/@export.d.ts +4 -0
- package/dist/src/Atoms/FAIcon/parts.d.ts +2 -0
- package/dist/src/Atoms/Logo/parts.d.ts +1 -0
- package/dist/src/Atoms/Various/parts.d.ts +9 -0
- package/dist/src/Functions/@export.d.ts +12 -0
- package/dist/src/Functions/Button/_.d.ts +1 -0
- package/dist/src/Functions/Cropper/parts.d.ts +1 -0
- package/dist/src/Functions/Effects/Fade.d.ts +1 -0
- package/dist/src/Functions/Effects/Ripple.d.ts +1 -0
- package/dist/src/Functions/Effects/_.d.ts +3 -0
- package/dist/src/Functions/Input/Chips/Selector.d.ts +1 -0
- package/dist/src/Functions/Input/Chips/_.d.ts +2 -0
- package/dist/src/Functions/Input/DigitCharacters.d.ts +1 -0
- package/dist/src/Functions/Input/File/_.d.ts +2 -0
- package/dist/src/Functions/Input/Hidden.d.ts +1 -0
- package/dist/src/Functions/Input/List/_.d.ts +1 -0
- package/dist/src/Functions/Input/Segmented/_.d.ts +1 -0
- package/dist/src/Functions/Input/Select/_.d.ts +1 -0
- package/dist/src/Functions/Input/Slider/_.d.ts +1 -0
- package/dist/src/Functions/Input/Switch/_.d.ts +1 -0
- package/dist/src/Functions/Input/Text.d.ts +5 -0
- package/dist/src/Functions/Input/TextArea.d.ts +1 -0
- package/dist/src/Functions/Input/Time/Picker.d.ts +1 -0
- package/dist/src/Functions/Input/Time/_.d.ts +2 -0
- package/dist/src/Functions/Input/_.d.ts +5 -0
- package/dist/src/Functions/Input/core.d.ts +34 -0
- package/dist/src/Functions/Inputs/_.d.ts +3 -0
- package/dist/src/Functions/Inputs/text.d.ts +12 -0
- package/dist/src/Functions/Layout/PageNotFound.d.ts +1 -0
- package/dist/src/Functions/Layout/PageRouter.d.ts +2 -0
- package/dist/src/Functions/Layout/PageViewController/parts.d.ts +1 -0
- package/dist/src/Functions/Layout/Plate.d.ts +1 -0
- package/dist/src/Functions/Layout/RootViewController/parts.d.ts +1 -0
- package/dist/src/Functions/Layout/SwipeView/parts.d.ts +2 -0
- package/dist/src/Functions/Layout/TabBar.d.ts +1 -0
- package/dist/src/Functions/Layout/_.d.ts +2 -0
- package/dist/src/Functions/Loader/corner.d.ts +1 -0
- package/dist/src/Functions/Loader/mini.d.ts +33 -0
- package/dist/src/Functions/Loader/parts.d.ts +3 -0
- package/dist/src/Functions/Loader/top.d.ts +1 -0
- package/dist/src/Functions/Sheet/parts.d.ts +2 -0
- package/dist/src/Functions/SnackBar/parts.d.ts +2 -0
- package/dist/src/Functions/Table/Data/parts.d.ts +3 -0
- package/dist/src/Functions/Table/Drag/parts.d.ts +1 -0
- package/dist/src/Functions/Table/Normal/parts.d.ts +1 -0
- package/dist/src/Functions/Table/_.d.ts +9 -0
- package/dist/src/Functions/Tooltips/parts.d.ts +2 -0
- package/dist/src/Global/@export.d.ts +12 -0
- package/dist/src/Global/LaunchReactApplication.d.ts +1 -0
- package/dist/src/Global/styleConverter.d.ts +2 -0
- package/dist/src/Molecules/@export.d.ts +21 -0
- package/dist/src/Molecules/Accordion/parts.d.ts +2 -0
- package/dist/src/Molecules/LinkifyText/parts.d.ts +1 -0
- package/dist/src/Molecules/List.d.ts +1 -0
- package/dist/src/Organisms/@export.d.ts +2 -0
- package/dist/src/Organisms/DisplayStyleInput/_.d.ts +1 -0
- package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +1 -0
- package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +27 -0
- package/dist/src/Templates/@export.d.ts +2 -0
- package/dist/src/Templates/PlayGround/parts.d.ts +1 -0
- package/dist/src/config.d.ts +16 -0
- package/dist/src/launch.d.ts +9 -0
- package/dist/src/preload.d.ts +1 -0
- package/package.json +2 -2
- package/src/@jsminAmotifyExtension/_.tsx +4 -0
- package/src/@jsminAmotifyExtension/fetch.tsx +107 -0
- package/src/@jsminAmotifyExtension/formCollect.tsx +89 -0
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +159 -0
- package/src/@jsminAmotifyExtension/variables.tsx +130 -0
- package/src/@styles/@app.scss +4 -0
- package/src/@styles/@variables/customProps.scss +109 -0
- package/src/@styles/@variables/styleSet.scss +38 -0
- package/src/@styles/@variables/themeColor.scss +71 -0
- package/src/@styles/@variables/var.scss +171 -0
- package/src/@styles/UniStyling.scss +996 -0
- package/src/@styles/init.scss +154 -0
- package/src/@types/_.tsx +6 -0
- package/src/@types/amot.tsx +323 -0
- package/src/@types/fn.tsx +1210 -0
- package/src/@types/index.tsx +74 -0
- package/src/@types/jsminAmotifyExtension.tsx +143 -0
- package/src/@types/module.tsx +2 -0
- package/src/@types/state.tsx +199 -0
- package/src/Atoms/@export.tsx +32 -0
- package/src/Atoms/FAIcon/parts.tsx +117 -0
- package/src/Atoms/FAIcon/style.module.scss +9 -0
- package/src/Atoms/Logo/parts.tsx +335 -0
- package/src/Atoms/Logo/style.module.scss +96 -0
- package/src/Atoms/Various/parts.tsx +157 -0
- package/src/Atoms/Various/style.module.scss +40 -0
- package/src/Functions/@export.tsx +29 -0
- package/src/Functions/Button/_.tsx +305 -0
- package/src/Functions/Button/style.module.scss +183 -0
- package/src/Functions/Cropper/parts.tsx +1061 -0
- package/src/Functions/Cropper/style.module.scss +62 -0
- package/src/Functions/Effects/Fade.tsx +81 -0
- package/src/Functions/Effects/Ripple.tsx +141 -0
- package/src/Functions/Effects/_.tsx +33 -0
- package/src/Functions/Effects/style.module.scss +83 -0
- package/src/Functions/Input/Chips/Selector.tsx +451 -0
- package/src/Functions/Input/Chips/_.tsx +286 -0
- package/src/Functions/Input/Chips/style.module.scss +6 -0
- package/src/Functions/Input/DigitCharacters.tsx +241 -0
- package/src/Functions/Input/File/_.tsx +596 -0
- package/src/Functions/Input/File/style.module.scss +34 -0
- package/src/Functions/Input/Hidden.tsx +18 -0
- package/src/Functions/Input/List/_.tsx +383 -0
- package/src/Functions/Input/List/style.module.scss +84 -0
- package/src/Functions/Input/Segmented/_.tsx +238 -0
- package/src/Functions/Input/Segmented/style.module.scss +81 -0
- package/src/Functions/Input/Select/_.tsx +225 -0
- package/src/Functions/Input/Select/style.module.scss +10 -0
- package/src/Functions/Input/Slider/_.tsx +519 -0
- package/src/Functions/Input/Slider/style.module.scss +67 -0
- package/src/Functions/Input/Switch/_.tsx +177 -0
- package/src/Functions/Input/Switch/style.module.scss +18 -0
- package/src/Functions/Input/Text.tsx +437 -0
- package/src/Functions/Input/TextArea.tsx +115 -0
- package/src/Functions/Input/Time/Picker.tsx +950 -0
- package/src/Functions/Input/Time/_.tsx +736 -0
- package/src/Functions/Input/Time/style.module.scss +72 -0
- package/src/Functions/Input/_.tsx +793 -0
- package/src/Functions/Input/core.tsx +461 -0
- package/src/Functions/Input/style.module.scss +43 -0
- package/src/Functions/Inputs/_.tsx +5 -0
- package/src/Functions/Inputs/style.module.scss +15 -0
- package/src/Functions/Inputs/text.tsx +67 -0
- package/src/Functions/Inputs/types.d.ts +1 -0
- package/src/Functions/Layout/PageNotFound.tsx +81 -0
- package/src/Functions/Layout/PageRouter.tsx +107 -0
- package/src/Functions/Layout/PageViewController/parts.tsx +32 -0
- package/src/Functions/Layout/Plate.tsx +30 -0
- package/src/Functions/Layout/RootViewController/parts.tsx +290 -0
- package/src/Functions/Layout/RootViewController/style.module.scss +24 -0
- package/src/Functions/Layout/SwipeView/parts.tsx +380 -0
- package/src/Functions/Layout/SwipeView/style.module.scss +19 -0
- package/src/Functions/Layout/TabBar.tsx +64 -0
- package/src/Functions/Layout/_.tsx +20 -0
- package/src/Functions/Loader/corner.tsx +78 -0
- package/src/Functions/Loader/mini.tsx +117 -0
- package/src/Functions/Loader/parts.tsx +105 -0
- package/src/Functions/Loader/style.module.scss +222 -0
- package/src/Functions/Loader/top.tsx +90 -0
- package/src/Functions/Sheet/parts.tsx +972 -0
- package/src/Functions/Sheet/style.module.scss +235 -0
- package/src/Functions/SnackBar/parts.tsx +215 -0
- package/src/Functions/SnackBar/style.module.scss +25 -0
- package/src/Functions/Table/Data/parts.tsx +955 -0
- package/src/Functions/Table/Drag/parts.tsx +448 -0
- package/src/Functions/Table/Normal/parts.tsx +123 -0
- package/src/Functions/Table/_.tsx +170 -0
- package/src/Functions/Table/style.module.scss +92 -0
- package/src/Functions/Tooltips/parts.tsx +52 -0
- package/src/Global/@export.tsx +138 -0
- package/src/Global/LaunchReactApplication.tsx +30 -0
- package/src/Global/exe.tsx +0 -0
- package/src/Global/styleConverter.tsx +435 -0
- package/src/Molecules/@export.tsx +95 -0
- package/src/Molecules/Accordion/parts.tsx +146 -0
- package/src/Molecules/Accordion/style.module.scss +13 -0
- package/src/Molecules/LinkifyText/parts.tsx +54 -0
- package/src/Molecules/List.tsx +30 -0
- package/src/Organisms/@export.tsx +5 -0
- package/src/Organisms/DisplayStyleInput/_.tsx +18 -0
- package/src/Organisms/DisplayStyleInput/darkmode.tsx +112 -0
- package/src/Organisms/DisplayStyleInput/themeColor.tsx +210 -0
- package/src/Templates/@export.tsx +7 -0
- package/src/Templates/PlayGround/parts.tsx +115 -0
- package/src/Templates/PlayGround/style.module.scss +38 -0
- package/src/config.tsx +132 -0
- package/src/launch.tsx +100 -0
- package/src/preload.tsx +49 -0
- package/tsconfig.json +27 -14
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useRecycle,
|
|
3
|
+
useStore,
|
|
4
|
+
} from '@global';
|
|
5
|
+
const {
|
|
6
|
+
useEffect,
|
|
7
|
+
useState
|
|
8
|
+
} = React;
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
Flex,
|
|
12
|
+
FAIcon,
|
|
13
|
+
Span
|
|
14
|
+
} from '@atoms';
|
|
15
|
+
import {
|
|
16
|
+
Column,
|
|
17
|
+
Row,
|
|
18
|
+
Text
|
|
19
|
+
} from '@mols';
|
|
20
|
+
import {
|
|
21
|
+
Input,
|
|
22
|
+
Buttons,
|
|
23
|
+
Loader,
|
|
24
|
+
Sheet
|
|
25
|
+
} from '@functions';
|
|
26
|
+
|
|
27
|
+
import style from './style.module.scss';
|
|
28
|
+
|
|
29
|
+
const Selector = ( params: {
|
|
30
|
+
selectorID: string
|
|
31
|
+
bottomContent: ReactElement
|
|
32
|
+
options: amotify.fn.Input.Chips.OptionParams[]
|
|
33
|
+
limit?: number
|
|
34
|
+
selected: amotify.fn.Input.Chips.OptionParams[]
|
|
35
|
+
SelectorCellComponent: amotify.fn.Input.Chips.SelectorCellComponentInput
|
|
36
|
+
onUpdated( params: {
|
|
37
|
+
values: any[]
|
|
38
|
+
} ): void
|
|
39
|
+
onDynamicSearch?: amotify.fn.Input.Chips.onDynamicSearch
|
|
40
|
+
} ) => {
|
|
41
|
+
type StatusTypes = 'show' | 'interlude';
|
|
42
|
+
let [ val_status,set_status ] = useState( 'show' as StatusTypes );
|
|
43
|
+
let [ val_keyword,set_keyword ] = useState( '' );
|
|
44
|
+
let [ val_componentID ] = useState( $.uuidGen() );
|
|
45
|
+
|
|
46
|
+
let [ val_options,set_options ] = useState( params.options );
|
|
47
|
+
let [ val_focus,set_focus ] = useState( val_options[ 0 ] || null );
|
|
48
|
+
let [ val_selected,set_selected ] = useState( params.selected );
|
|
49
|
+
let [ val_keyEvent,set_keyEvent ] = useState( 'init' );
|
|
50
|
+
|
|
51
|
+
useEffect( () => {
|
|
52
|
+
useStore.set( {
|
|
53
|
+
key: params.selectorID,
|
|
54
|
+
value: {
|
|
55
|
+
updateOptions: ( options: amotify.fn.Input.Chips.OptionParams[] ) => {
|
|
56
|
+
set_options( options );
|
|
57
|
+
},
|
|
58
|
+
updateSelected: ( selected: amotify.fn.Input.Chips.OptionParams[] ) => {
|
|
59
|
+
set_selected( selected );
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} );
|
|
63
|
+
},[] );
|
|
64
|
+
const mountedOptions = React.useRef( false );
|
|
65
|
+
useEffect( () => {
|
|
66
|
+
if ( mountedOptions.current ) {
|
|
67
|
+
Sheet.reposition( params.selectorID );
|
|
68
|
+
} else {
|
|
69
|
+
mountedOptions.current = true;
|
|
70
|
+
}
|
|
71
|
+
},[ val_options ] );
|
|
72
|
+
const mountedKeyword = React.useRef( false );
|
|
73
|
+
useEffect( () => {
|
|
74
|
+
if ( mountedKeyword.current ) {
|
|
75
|
+
set_status( 'interlude' );
|
|
76
|
+
set_focus( val_options[ 0 ] || null );
|
|
77
|
+
|
|
78
|
+
if ( params.onDynamicSearch ) {
|
|
79
|
+
$.interval.clear( val_componentID + '-dynamicSearch' );
|
|
80
|
+
$.interval.standBy(
|
|
81
|
+
val_componentID + '-dynamicSearch',
|
|
82
|
+
400,
|
|
83
|
+
async () => {
|
|
84
|
+
let {
|
|
85
|
+
options
|
|
86
|
+
} = await params.onDynamicSearch!( val_keyword );
|
|
87
|
+
set_options( options );
|
|
88
|
+
set_status( 'show' );
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
$.interval.clear( val_componentID + '-staticSearch' );
|
|
93
|
+
$.interval.standBy(
|
|
94
|
+
val_componentID + '-staticSearch',
|
|
95
|
+
400,
|
|
96
|
+
async () => {
|
|
97
|
+
let regExp = new RegExp( val_keyword,'ig' );
|
|
98
|
+
let newSelection: amotify.fn.Input.Chips.OptionParams[] = [];
|
|
99
|
+
[ ...params.options ].forEach( ( o ) => {
|
|
100
|
+
let match = Boolean( !val_keyword || ( String( o.label ) ?? String( o.value ) ).match( regExp ) );
|
|
101
|
+
if ( match ) newSelection.push( o );
|
|
102
|
+
} );
|
|
103
|
+
|
|
104
|
+
set_options( newSelection );
|
|
105
|
+
set_status( 'show' );
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
mountedKeyword.current = true;
|
|
111
|
+
}
|
|
112
|
+
},[ val_keyword ] );
|
|
113
|
+
const mountedSelected = React.useRef( false );
|
|
114
|
+
useEffect( () => {
|
|
115
|
+
if ( mountedSelected.current ) {
|
|
116
|
+
params.onUpdated( {
|
|
117
|
+
values: val_selected
|
|
118
|
+
} );
|
|
119
|
+
} else {
|
|
120
|
+
mountedSelected.current = true;
|
|
121
|
+
}
|
|
122
|
+
},[ val_selected ] );
|
|
123
|
+
useEffect( () => {
|
|
124
|
+
$.fnScope( () => {
|
|
125
|
+
if ( $.is.nullish( val_focus ) ) return;
|
|
126
|
+
if ( val_keyEvent == 'MouseEvent' ) return;
|
|
127
|
+
|
|
128
|
+
let Wrapper = $( '#' + val_componentID + '-Selector-Cell-Wrap' );
|
|
129
|
+
if ( !Wrapper[ 0 ] ) return;
|
|
130
|
+
|
|
131
|
+
let focusCell = $( '[data-chips-selector-cell="' + val_componentID + '-' + JSON.stringify( val_focus?.value || '' ).replace( /\"/ig,'' ) + '"]' );
|
|
132
|
+
if ( !focusCell[ 0 ] ) return;
|
|
133
|
+
|
|
134
|
+
let { top: pTop,height: pHeight } = Wrapper.position();
|
|
135
|
+
let { top: cTop,height: cHeight } = focusCell.position();
|
|
136
|
+
if ( pTop <= cTop && cTop + cHeight <= pTop + pHeight ) return;
|
|
137
|
+
|
|
138
|
+
let scroll = Wrapper[ 0 ].scrollTop + ( cTop - pTop );
|
|
139
|
+
if ( val_keyEvent == 'ArrowDown' ) {
|
|
140
|
+
scroll -= ( pHeight - cHeight ) - 20;
|
|
141
|
+
} else if ( val_keyEvent == 'ArrowUp' ) {
|
|
142
|
+
scroll -= 20;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
Wrapper[ 0 ].scrollTop = scroll;
|
|
146
|
+
} );
|
|
147
|
+
},[ val_focus ] );
|
|
148
|
+
|
|
149
|
+
let List: ReactElement[] = [];
|
|
150
|
+
|
|
151
|
+
if ( val_status == 'interlude' ) {
|
|
152
|
+
List = [ <Row.Center
|
|
153
|
+
padding={ 2 }
|
|
154
|
+
gap={ 0 }
|
|
155
|
+
>
|
|
156
|
+
<Loader.Theme.R
|
|
157
|
+
showInitial
|
|
158
|
+
/>
|
|
159
|
+
<Box
|
|
160
|
+
padding={ [ 0,1 ] }
|
|
161
|
+
fontSize='1.mini'
|
|
162
|
+
fontColor='4.thin'
|
|
163
|
+
>
|
|
164
|
+
検索中...
|
|
165
|
+
</Box>
|
|
166
|
+
</Row.Center> ];
|
|
167
|
+
} else {
|
|
168
|
+
List = [
|
|
169
|
+
val_options.map( ( option,index ) => {
|
|
170
|
+
let {
|
|
171
|
+
value,label
|
|
172
|
+
} = option;
|
|
173
|
+
|
|
174
|
+
let safeValue = String( JSON.stringify( value ) );
|
|
175
|
+
|
|
176
|
+
let findIndex = val_selected.findIndex( ( v ) => JSON.stringify( v.value ) == safeValue );
|
|
177
|
+
|
|
178
|
+
let isSelected = findIndex != -1;
|
|
179
|
+
let isFocused = JSON.stringify( val_focus?.value || '' ) == safeValue;
|
|
180
|
+
|
|
181
|
+
let styles: amotifyUniStyleParams = {}
|
|
182
|
+
if ( isSelected || isFocused ) {
|
|
183
|
+
styles = {
|
|
184
|
+
fontColor: 'theme',
|
|
185
|
+
isBoldFont: true,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if ( isFocused ) {
|
|
189
|
+
styles = {
|
|
190
|
+
...styles,
|
|
191
|
+
backgroundColor: 'cloud',
|
|
192
|
+
paddingLeft: '2/3'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if ( isSelected ) {
|
|
196
|
+
styles = {
|
|
197
|
+
...styles,
|
|
198
|
+
backgroundColor: 'tcOpFew',
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return <Buttons.Button.Clear.R
|
|
203
|
+
color='cloud'
|
|
204
|
+
padding={ '1/3' }
|
|
205
|
+
tabIndex={ -1 }
|
|
206
|
+
textAlign='left'
|
|
207
|
+
data-chips-selector-cell={ val_componentID + '-' + safeValue.replace( /\"/ig,'' ) }
|
|
208
|
+
isActive={ isSelected || isFocused }
|
|
209
|
+
isActiveStyles={ styles }
|
|
210
|
+
{ ...styles }
|
|
211
|
+
onMouseOver={ () => {
|
|
212
|
+
set_keyEvent( 'MouseEvent' );
|
|
213
|
+
set_focus( option );
|
|
214
|
+
} }
|
|
215
|
+
onClick={ () => {
|
|
216
|
+
let newSelected = [ ...val_selected ];
|
|
217
|
+
if ( isSelected ) {
|
|
218
|
+
newSelected.splice( findIndex,1 );
|
|
219
|
+
} else {
|
|
220
|
+
newSelected = [
|
|
221
|
+
...newSelected,
|
|
222
|
+
option
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
if ( params.limit && newSelected.length > params.limit ) {
|
|
226
|
+
newSelected.shift();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
set_selected( newSelected );
|
|
230
|
+
} }
|
|
231
|
+
>
|
|
232
|
+
<params.SelectorCellComponent
|
|
233
|
+
isSelected={ isSelected }
|
|
234
|
+
isFocused={ isFocused }
|
|
235
|
+
value={ value }
|
|
236
|
+
label={ label }
|
|
237
|
+
/>
|
|
238
|
+
</Buttons.Button.Clear.R>;
|
|
239
|
+
} )
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return ( <>
|
|
244
|
+
<Column
|
|
245
|
+
padding={ '2/3' }
|
|
246
|
+
gap={ '2/3' }
|
|
247
|
+
borderBottom
|
|
248
|
+
>
|
|
249
|
+
<Row.Separate>
|
|
250
|
+
<Input.Text.Normal
|
|
251
|
+
value={ val_keyword }
|
|
252
|
+
onUpdateValidValue={ ( { value } ) => {
|
|
253
|
+
set_keyword( value );
|
|
254
|
+
} }
|
|
255
|
+
id={ params.selectorID + '-KeywordInput' }
|
|
256
|
+
padding={ '2/3' }
|
|
257
|
+
placeholder='検索...'
|
|
258
|
+
leftIcon={ <Input.Comps.LeftIcon
|
|
259
|
+
right={ '2/3' }
|
|
260
|
+
fontSize={ '1.mini' }
|
|
261
|
+
fontColor='3.blur'
|
|
262
|
+
>
|
|
263
|
+
<FAIcon.Search />
|
|
264
|
+
</Input.Comps.LeftIcon> }
|
|
265
|
+
onKeyDown={ ( event ) => {
|
|
266
|
+
let {
|
|
267
|
+
key,
|
|
268
|
+
metaKey,ctrlKey
|
|
269
|
+
} = event;
|
|
270
|
+
let auxKey = metaKey || ctrlKey;
|
|
271
|
+
|
|
272
|
+
if ( [ 'ArrowDown','ArrowUp' ].includes( key ) ) {
|
|
273
|
+
let dir = Number( key == 'ArrowDown' ) * 2 - 1;
|
|
274
|
+
if ( auxKey ) {
|
|
275
|
+
let next = val_options[ dir == 1 ? val_options.length - 1 : 0 ];
|
|
276
|
+
set_focus( next );
|
|
277
|
+
} else {
|
|
278
|
+
let nextIndex = val_options.findIndex( ( v ) => JSON.stringify( v.value ) == JSON.stringify( val_focus?.value || '' ) ) + dir;
|
|
279
|
+
|
|
280
|
+
if ( val_options[ nextIndex ] ) {
|
|
281
|
+
set_focus( val_options[ nextIndex ] );
|
|
282
|
+
} else {
|
|
283
|
+
set_focus( val_options[ dir == 1 ? 0 : val_options.length - 1 ] || null );
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
} else if ( key == 'Enter' ) {
|
|
287
|
+
let selectedIndex = val_selected.findIndex( ( v ) => JSON.stringify( v.value ) == JSON.stringify( val_focus?.value || '' ) );
|
|
288
|
+
let isSelected = selectedIndex != -1;
|
|
289
|
+
let newSelected = [ ...val_selected ];
|
|
290
|
+
if ( isSelected ) {
|
|
291
|
+
newSelected.splice( selectedIndex,1 );
|
|
292
|
+
} else {
|
|
293
|
+
let optionsIndex = val_options.findIndex( ( v ) => JSON.stringify( v.value ) == JSON.stringify( val_focus?.value || '' ) );
|
|
294
|
+
if ( optionsIndex == -1 ) return;
|
|
295
|
+
newSelected = [
|
|
296
|
+
...newSelected,
|
|
297
|
+
val_options[ optionsIndex ],
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
if ( params.limit && newSelected.length > params.limit ) {
|
|
301
|
+
newSelected.shift();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
set_selected( newSelected );
|
|
306
|
+
}
|
|
307
|
+
set_keyEvent( key );
|
|
308
|
+
} }
|
|
309
|
+
/>
|
|
310
|
+
<Buttons.Button.Border.S
|
|
311
|
+
marginRight={ '1/3' }
|
|
312
|
+
ssSphere={ 2 }
|
|
313
|
+
backgroundColor='cloud'
|
|
314
|
+
borderRadius={ '2.tone.secondary' }
|
|
315
|
+
onClick={ () => {
|
|
316
|
+
Sheet.close( params.selectorID! );
|
|
317
|
+
} }
|
|
318
|
+
>
|
|
319
|
+
<FAIcon
|
|
320
|
+
d='window-minimize'
|
|
321
|
+
/>
|
|
322
|
+
</Buttons.Button.Border.S>
|
|
323
|
+
</Row.Separate>
|
|
324
|
+
<Row.Separate>
|
|
325
|
+
<Row.Left
|
|
326
|
+
gap={ '1/2' }
|
|
327
|
+
verticalAlign='baseline'
|
|
328
|
+
>
|
|
329
|
+
<Span
|
|
330
|
+
fontColor={ 'theme' }
|
|
331
|
+
>
|
|
332
|
+
{ val_options.length }
|
|
333
|
+
</Span>
|
|
334
|
+
<Box
|
|
335
|
+
fontSize='1.mini'
|
|
336
|
+
fontColor='3.blur'
|
|
337
|
+
>
|
|
338
|
+
件のヒット
|
|
339
|
+
</Box>
|
|
340
|
+
</Row.Left>
|
|
341
|
+
<Row.Right>
|
|
342
|
+
{ params.limit ? <Span
|
|
343
|
+
fontColor={ '3.blur' }
|
|
344
|
+
fontSize='1.mini'
|
|
345
|
+
>
|
|
346
|
+
<Span
|
|
347
|
+
fontSize='3.paragraph'
|
|
348
|
+
fontColor='theme'
|
|
349
|
+
isBoldFont
|
|
350
|
+
>
|
|
351
|
+
{ val_selected.length }
|
|
352
|
+
</Span> / { params.limit } 件
|
|
353
|
+
</Span> : null }
|
|
354
|
+
</Row.Right>
|
|
355
|
+
</Row.Separate>
|
|
356
|
+
</Column>
|
|
357
|
+
<Column
|
|
358
|
+
gap={ '1/4' }
|
|
359
|
+
padding={ '1/2' }
|
|
360
|
+
overflow={ 'auto' }
|
|
361
|
+
freeCSS={ {
|
|
362
|
+
maxHeight: 12 * 26,
|
|
363
|
+
maxWidth: 12 * 26
|
|
364
|
+
} }
|
|
365
|
+
id={ val_componentID + '-Selector-Cell-Wrap' }
|
|
366
|
+
className={ style.SelectorWrapper }
|
|
367
|
+
>
|
|
368
|
+
{ List }
|
|
369
|
+
</Column>
|
|
370
|
+
{ params.bottomContent }
|
|
371
|
+
</> );
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export const ChipsInputFNs: amotify.fn.Input.Chips.FNs = {
|
|
375
|
+
openSelector: ( params ) => {
|
|
376
|
+
let {
|
|
377
|
+
selectorID,
|
|
378
|
+
options,
|
|
379
|
+
selected,
|
|
380
|
+
limit,
|
|
381
|
+
bottomContent,
|
|
382
|
+
onDynamicSearch,
|
|
383
|
+
SelectorCellComponent,
|
|
384
|
+
onUpdated,
|
|
385
|
+
onClosed,
|
|
386
|
+
parent,
|
|
387
|
+
...sheetarams
|
|
388
|
+
} = params;
|
|
389
|
+
let sheetID = selectorID;
|
|
390
|
+
|
|
391
|
+
SelectorCellComponent = SelectorCellComponent || ( ( params ) => {
|
|
392
|
+
return <Row.Left>
|
|
393
|
+
<FAIcon.CheckCircle
|
|
394
|
+
isSolidIcon={ params.isSelected }
|
|
395
|
+
isRegularIcon={ !params.isSelected }
|
|
396
|
+
fontColor={ params.isSelected ? 'theme' : '6.clear' }
|
|
397
|
+
/>
|
|
398
|
+
{ params.label }
|
|
399
|
+
</Row.Left>;
|
|
400
|
+
} );
|
|
401
|
+
|
|
402
|
+
Sheet.open( {
|
|
403
|
+
parent,
|
|
404
|
+
sheetID,
|
|
405
|
+
type: 'custom',
|
|
406
|
+
gravityPoint: 22,
|
|
407
|
+
padding: [ 1,0 ],
|
|
408
|
+
holdState: true,
|
|
409
|
+
closeOption: {
|
|
410
|
+
aroundClick: true,
|
|
411
|
+
escapeKeyDown: true
|
|
412
|
+
},
|
|
413
|
+
...sheetarams,
|
|
414
|
+
content: <Box
|
|
415
|
+
borderRadius={ '2.tone.secondary' }
|
|
416
|
+
backgroundColor={ '1.layer.base' }
|
|
417
|
+
border
|
|
418
|
+
boxShadow={ 'borderBox' }
|
|
419
|
+
overflow='hidden'
|
|
420
|
+
>
|
|
421
|
+
<Selector
|
|
422
|
+
selectorID={ selectorID }
|
|
423
|
+
options={ options }
|
|
424
|
+
limit={ limit }
|
|
425
|
+
selected={ selected }
|
|
426
|
+
onUpdated={ onUpdated }
|
|
427
|
+
SelectorCellComponent={ SelectorCellComponent }
|
|
428
|
+
bottomContent={ bottomContent }
|
|
429
|
+
onDynamicSearch={ onDynamicSearch }
|
|
430
|
+
/>
|
|
431
|
+
</Box>,
|
|
432
|
+
openAfter: () => {
|
|
433
|
+
$( '#' + params.selectorID + '-KeywordInput' ).focus();
|
|
434
|
+
},
|
|
435
|
+
closeAfter: () => {
|
|
436
|
+
onClosed();
|
|
437
|
+
}
|
|
438
|
+
} );
|
|
439
|
+
},
|
|
440
|
+
closeSelector: ( selectorID ) => {
|
|
441
|
+
Sheet.close( selectorID );
|
|
442
|
+
},
|
|
443
|
+
updateOptions: ( selectorID,options ) => {
|
|
444
|
+
let C = useStore.get( selectorID );
|
|
445
|
+
if ( C && C.updateOptions ) C.updateOptions( options );
|
|
446
|
+
},
|
|
447
|
+
updateSelected: ( selectorID,selected ) => {
|
|
448
|
+
let C = useStore.get( selectorID );
|
|
449
|
+
if ( C && C.updateSelected ) C.updateSelected( selected );
|
|
450
|
+
}
|
|
451
|
+
}
|