amotify 0.0.4 → 0.0.5
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 +1 -1
- package/public/amotify.js +1 -0
- package/public/amotify.min.css +24 -0
- package/dist/src/@jsminAmotifyExtension/_.d.ts +0 -4
- package/dist/src/@jsminAmotifyExtension/fetch.d.ts +0 -9
- package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +0 -1
- package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +0 -4
- package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/src/@types/_.d.ts +0 -6
- package/dist/src/@types/amot.d.ts +0 -260
- package/dist/src/@types/fn.d.ts +0 -1040
- package/dist/src/@types/index.d.ts +0 -62
- package/dist/src/@types/jsminAmotifyExtension.d.ts +0 -134
- package/dist/src/@types/module.d.ts +0 -2
- package/dist/src/@types/state.d.ts +0 -145
- package/dist/src/Atoms/@export.d.ts +0 -4
- package/dist/src/Atoms/FAIcon/parts.d.ts +0 -2
- package/dist/src/Atoms/Logo/parts.d.ts +0 -1
- package/dist/src/Atoms/Various/parts.d.ts +0 -9
- package/dist/src/Functions/@export.d.ts +0 -12
- package/dist/src/Functions/Button/_.d.ts +0 -1
- package/dist/src/Functions/Cropper/parts.d.ts +0 -1
- package/dist/src/Functions/Effects/Fade.d.ts +0 -1
- package/dist/src/Functions/Effects/Ripple.d.ts +0 -1
- package/dist/src/Functions/Effects/_.d.ts +0 -3
- package/dist/src/Functions/Input/Chips/Selector.d.ts +0 -1
- package/dist/src/Functions/Input/Chips/_.d.ts +0 -2
- package/dist/src/Functions/Input/DigitCharacters.d.ts +0 -1
- package/dist/src/Functions/Input/File/_.d.ts +0 -2
- package/dist/src/Functions/Input/Hidden.d.ts +0 -1
- package/dist/src/Functions/Input/List/_.d.ts +0 -1
- package/dist/src/Functions/Input/Segmented/_.d.ts +0 -1
- package/dist/src/Functions/Input/Select/_.d.ts +0 -1
- package/dist/src/Functions/Input/Slider/_.d.ts +0 -1
- package/dist/src/Functions/Input/Switch/_.d.ts +0 -1
- package/dist/src/Functions/Input/Text.d.ts +0 -5
- package/dist/src/Functions/Input/TextArea.d.ts +0 -1
- package/dist/src/Functions/Input/Time/Picker.d.ts +0 -1
- package/dist/src/Functions/Input/Time/_.d.ts +0 -2
- package/dist/src/Functions/Input/_.d.ts +0 -5
- package/dist/src/Functions/Input/core.d.ts +0 -34
- package/dist/src/Functions/Inputs/_.d.ts +0 -3
- package/dist/src/Functions/Inputs/text.d.ts +0 -12
- package/dist/src/Functions/Layout/PageNotFound.d.ts +0 -1
- package/dist/src/Functions/Layout/PageRouter.d.ts +0 -2
- package/dist/src/Functions/Layout/PageViewController/parts.d.ts +0 -1
- package/dist/src/Functions/Layout/Plate.d.ts +0 -1
- package/dist/src/Functions/Layout/RootViewController/parts.d.ts +0 -1
- package/dist/src/Functions/Layout/SwipeView/parts.d.ts +0 -2
- package/dist/src/Functions/Layout/TabBar.d.ts +0 -1
- package/dist/src/Functions/Layout/_.d.ts +0 -2
- package/dist/src/Functions/Loader/corner.d.ts +0 -1
- package/dist/src/Functions/Loader/mini.d.ts +0 -33
- package/dist/src/Functions/Loader/parts.d.ts +0 -3
- package/dist/src/Functions/Loader/top.d.ts +0 -1
- package/dist/src/Functions/Sheet/parts.d.ts +0 -2
- package/dist/src/Functions/SnackBar/parts.d.ts +0 -2
- package/dist/src/Functions/Table/Data/parts.d.ts +0 -3
- package/dist/src/Functions/Table/Drag/parts.d.ts +0 -1
- package/dist/src/Functions/Table/Normal/parts.d.ts +0 -1
- package/dist/src/Functions/Table/_.d.ts +0 -9
- package/dist/src/Functions/Tooltips/parts.d.ts +0 -2
- package/dist/src/Global/@export.d.ts +0 -12
- package/dist/src/Global/LaunchReactApplication.d.ts +0 -1
- package/dist/src/Global/styleConverter.d.ts +0 -2
- package/dist/src/Molecules/@export.d.ts +0 -21
- package/dist/src/Molecules/Accordion/parts.d.ts +0 -2
- package/dist/src/Molecules/LinkifyText/parts.d.ts +0 -1
- package/dist/src/Molecules/List.d.ts +0 -1
- package/dist/src/Organisms/@export.d.ts +0 -2
- package/dist/src/Organisms/DisplayStyleInput/_.d.ts +0 -1
- package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +0 -1
- package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +0 -27
- package/dist/src/Templates/@export.d.ts +0 -2
- package/dist/src/Templates/PlayGround/parts.d.ts +0 -1
- package/dist/src/config.d.ts +0 -16
- package/dist/src/launch.d.ts +0 -9
- package/dist/src/preload.d.ts +0 -1
- package/src/@jsminAmotifyExtension/_.tsx +0 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +0 -107
- package/src/@jsminAmotifyExtension/formCollect.tsx +0 -89
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -159
- package/src/@jsminAmotifyExtension/variables.tsx +0 -130
- package/src/@styles/@app.scss +0 -4
- package/src/@styles/@variables/customProps.scss +0 -109
- package/src/@styles/@variables/styleSet.scss +0 -38
- package/src/@styles/@variables/themeColor.scss +0 -71
- package/src/@styles/@variables/var.scss +0 -171
- package/src/@styles/UniStyling.scss +0 -996
- package/src/@styles/init.scss +0 -154
- package/src/@types/_.tsx +0 -6
- package/src/@types/amot.tsx +0 -323
- package/src/@types/fn.tsx +0 -1210
- package/src/@types/index.tsx +0 -74
- package/src/@types/jsminAmotifyExtension.tsx +0 -143
- package/src/@types/module.tsx +0 -2
- package/src/@types/state.tsx +0 -199
- package/src/Atoms/@export.tsx +0 -32
- package/src/Atoms/FAIcon/parts.tsx +0 -117
- package/src/Atoms/FAIcon/style.module.scss +0 -9
- package/src/Atoms/Logo/parts.tsx +0 -335
- package/src/Atoms/Logo/style.module.scss +0 -96
- package/src/Atoms/Various/parts.tsx +0 -157
- package/src/Atoms/Various/style.module.scss +0 -40
- package/src/Functions/@export.tsx +0 -29
- package/src/Functions/Button/_.tsx +0 -305
- package/src/Functions/Button/style.module.scss +0 -183
- package/src/Functions/Cropper/parts.tsx +0 -1061
- package/src/Functions/Cropper/style.module.scss +0 -62
- package/src/Functions/Effects/Fade.tsx +0 -81
- package/src/Functions/Effects/Ripple.tsx +0 -141
- package/src/Functions/Effects/_.tsx +0 -33
- package/src/Functions/Effects/style.module.scss +0 -83
- package/src/Functions/Input/Chips/Selector.tsx +0 -451
- package/src/Functions/Input/Chips/_.tsx +0 -286
- package/src/Functions/Input/Chips/style.module.scss +0 -6
- package/src/Functions/Input/DigitCharacters.tsx +0 -241
- package/src/Functions/Input/File/_.tsx +0 -596
- package/src/Functions/Input/File/style.module.scss +0 -34
- package/src/Functions/Input/Hidden.tsx +0 -18
- package/src/Functions/Input/List/_.tsx +0 -383
- package/src/Functions/Input/List/style.module.scss +0 -84
- package/src/Functions/Input/Segmented/_.tsx +0 -238
- package/src/Functions/Input/Segmented/style.module.scss +0 -81
- package/src/Functions/Input/Select/_.tsx +0 -225
- package/src/Functions/Input/Select/style.module.scss +0 -10
- package/src/Functions/Input/Slider/_.tsx +0 -519
- package/src/Functions/Input/Slider/style.module.scss +0 -67
- package/src/Functions/Input/Switch/_.tsx +0 -177
- package/src/Functions/Input/Switch/style.module.scss +0 -18
- package/src/Functions/Input/Text.tsx +0 -437
- package/src/Functions/Input/TextArea.tsx +0 -115
- package/src/Functions/Input/Time/Picker.tsx +0 -950
- package/src/Functions/Input/Time/_.tsx +0 -736
- package/src/Functions/Input/Time/style.module.scss +0 -72
- package/src/Functions/Input/_.tsx +0 -793
- package/src/Functions/Input/core.tsx +0 -461
- package/src/Functions/Input/style.module.scss +0 -43
- package/src/Functions/Inputs/_.tsx +0 -5
- package/src/Functions/Inputs/style.module.scss +0 -15
- package/src/Functions/Inputs/text.tsx +0 -67
- package/src/Functions/Inputs/types.d.ts +0 -1
- package/src/Functions/Layout/PageNotFound.tsx +0 -81
- package/src/Functions/Layout/PageRouter.tsx +0 -107
- package/src/Functions/Layout/PageViewController/parts.tsx +0 -32
- package/src/Functions/Layout/Plate.tsx +0 -30
- package/src/Functions/Layout/RootViewController/parts.tsx +0 -290
- package/src/Functions/Layout/RootViewController/style.module.scss +0 -24
- package/src/Functions/Layout/SwipeView/parts.tsx +0 -380
- package/src/Functions/Layout/SwipeView/style.module.scss +0 -19
- package/src/Functions/Layout/TabBar.tsx +0 -64
- package/src/Functions/Layout/_.tsx +0 -20
- package/src/Functions/Loader/corner.tsx +0 -78
- package/src/Functions/Loader/mini.tsx +0 -117
- package/src/Functions/Loader/parts.tsx +0 -105
- package/src/Functions/Loader/style.module.scss +0 -222
- package/src/Functions/Loader/top.tsx +0 -90
- package/src/Functions/Sheet/parts.tsx +0 -972
- package/src/Functions/Sheet/style.module.scss +0 -235
- package/src/Functions/SnackBar/parts.tsx +0 -215
- package/src/Functions/SnackBar/style.module.scss +0 -25
- package/src/Functions/Table/Data/parts.tsx +0 -955
- package/src/Functions/Table/Drag/parts.tsx +0 -448
- package/src/Functions/Table/Normal/parts.tsx +0 -123
- package/src/Functions/Table/_.tsx +0 -170
- package/src/Functions/Table/style.module.scss +0 -92
- package/src/Functions/Tooltips/parts.tsx +0 -52
- package/src/Global/@export.tsx +0 -138
- package/src/Global/LaunchReactApplication.tsx +0 -30
- package/src/Global/exe.tsx +0 -0
- package/src/Global/styleConverter.tsx +0 -435
- package/src/Molecules/@export.tsx +0 -95
- package/src/Molecules/Accordion/parts.tsx +0 -146
- package/src/Molecules/Accordion/style.module.scss +0 -13
- package/src/Molecules/LinkifyText/parts.tsx +0 -54
- package/src/Molecules/List.tsx +0 -30
- package/src/Organisms/@export.tsx +0 -5
- package/src/Organisms/DisplayStyleInput/_.tsx +0 -18
- package/src/Organisms/DisplayStyleInput/darkmode.tsx +0 -112
- package/src/Organisms/DisplayStyleInput/themeColor.tsx +0 -210
- package/src/Templates/@export.tsx +0 -7
- package/src/Templates/PlayGround/parts.tsx +0 -115
- package/src/Templates/PlayGround/style.module.scss +0 -38
- package/src/config.tsx +0 -132
- package/src/launch.tsx +0 -100
- package/src/preload.tsx +0 -49
|
@@ -1,451 +0,0 @@
|
|
|
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
|
-
}
|