amotify 0.0.39 → 0.0.41
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/@types/amot.tsx +2 -2
- package/@types/fn.tsx +37 -0
- package/dist/amotify.js +2 -2
- package/dist/amotify.min.css +3 -2
- package/dist/coreVender.js +1 -1
- package/package.json +3 -3
- package/src/@jsminAmotifyExtension/formCollect.tsx +2 -0
- package/src/@styles/init.scss +11 -0
- package/src/config.tsx +9 -0
- package/src/functions/Input/RichSelect/_.tsx +228 -0
- package/src/functions/Input/RichSelect/style.module.scss +11 -0
- package/src/functions/Input/Select/_.tsx +1 -1
- package/src/functions/Input/_.tsx +23 -0
- package/src/functions/Input/core.tsx +3 -0
- package/src/functions/Sheet/parts.tsx +10 -12
- package/src/launch.tsx +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amotify",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "UI Component for React",
|
|
5
5
|
"main": "dist/launch.js",
|
|
6
6
|
"types": "dist/@types.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
|
35
35
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
36
36
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
37
|
-
"jsmin-front": "^0.0.
|
|
37
|
+
"jsmin-front": "^0.0.23",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
39
|
"react-dom": "^18.2.0",
|
|
40
40
|
"react-router-dom": "^6.19.0"
|
|
@@ -66,4 +66,4 @@
|
|
|
66
66
|
"webpack-cli": "^5.1.4",
|
|
67
67
|
"webpack-remove-empty-scripts": "^1.0.4"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
@@ -65,6 +65,8 @@ $.formCollect = async ( form ) => {
|
|
|
65
65
|
if ( Value ) Value = JSON.parse( Value );
|
|
66
66
|
} else if ( inputType == 'select' ) {
|
|
67
67
|
if ( Value ) Value = JSON.parse( Value );
|
|
68
|
+
} else if ( inputType == 'richSelect' ) {
|
|
69
|
+
if ( Value ) Value = JSON.parse( Value );
|
|
68
70
|
} else if ( inputType == 'file' ) {
|
|
69
71
|
if ( componentData ) {
|
|
70
72
|
let files = componentData.Files;
|
package/src/@styles/init.scss
CHANGED
|
@@ -54,6 +54,17 @@ html {
|
|
|
54
54
|
Helvetica,
|
|
55
55
|
Arial,
|
|
56
56
|
sans-serif;
|
|
57
|
+
|
|
58
|
+
font-family:
|
|
59
|
+
-apple-system,
|
|
60
|
+
BlinkMacSystemFont,
|
|
61
|
+
Segoe UI,
|
|
62
|
+
Helvetica,
|
|
63
|
+
Arial,
|
|
64
|
+
Noto Sans JP,
|
|
65
|
+
sans-serif,
|
|
66
|
+
"Apple Color Emoji",
|
|
67
|
+
"Segoe UI Emoji";
|
|
57
68
|
font-kerning: normal;
|
|
58
69
|
// -webkit-font-smoothing: antialiased;
|
|
59
70
|
caret-color: $color-theme;
|
package/src/config.tsx
CHANGED
|
@@ -174,6 +174,15 @@ $( window ).addEvent( {
|
|
|
174
174
|
eventType: 'load',
|
|
175
175
|
callback: () => {
|
|
176
176
|
let style: any = document.body.style;
|
|
177
|
+
|
|
178
|
+
let Body = $( document.body );
|
|
179
|
+
let topNavHeight = Number( Body.getStyleProperty( '--topNavHeight' ).removeLetters() || 0 );
|
|
180
|
+
let footerNavHeight = Number( Body.getStyleProperty( '--footerNavHeight' ).removeLetters() || 0 );
|
|
181
|
+
|
|
182
|
+
let viewHeight = window.innerHeight;
|
|
183
|
+
let contentHeight = viewHeight - topNavHeight - footerNavHeight;
|
|
184
|
+
|
|
177
185
|
style.setProperty( '--viewHeight',window.innerHeight + 'px' );
|
|
186
|
+
style.setProperty( '--contentHeight',contentHeight + 'px' );
|
|
178
187
|
}
|
|
179
188
|
} );
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
React,
|
|
3
|
+
} from '@global';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Box
|
|
7
|
+
} from '@atoms';
|
|
8
|
+
import {
|
|
9
|
+
Column
|
|
10
|
+
} from '@mols';
|
|
11
|
+
import {
|
|
12
|
+
BoxWrapper,
|
|
13
|
+
SubmitForm,
|
|
14
|
+
ValidationCheck,
|
|
15
|
+
CommonEffects
|
|
16
|
+
} from '../core';
|
|
17
|
+
import {
|
|
18
|
+
Input,
|
|
19
|
+
Tooltips,
|
|
20
|
+
Buttons
|
|
21
|
+
} from '@fn';
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
import style from './style.module.scss';
|
|
25
|
+
import coreStyle from '../style.module.scss';
|
|
26
|
+
|
|
27
|
+
function DefaultValidation( props: {
|
|
28
|
+
value: any
|
|
29
|
+
params: any
|
|
30
|
+
} ): amotify.fn.Input.Validation.Result {
|
|
31
|
+
let {
|
|
32
|
+
value,
|
|
33
|
+
params
|
|
34
|
+
} = props;
|
|
35
|
+
let {
|
|
36
|
+
required,
|
|
37
|
+
options
|
|
38
|
+
} = params as amotify.fn.Input.RichSelect.PlainParams;
|
|
39
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = [];
|
|
40
|
+
|
|
41
|
+
if ( required ) {
|
|
42
|
+
if ( !options.length || ( options.length && $.is.nullish( JSON.parse( value ) ) ) ) {
|
|
43
|
+
notice.push( { type: 'invalid',label: '必須項目です' } );
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
|
|
49
|
+
notice: notice
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const RichSelectInput: React.FC<amotify.fn.Input.RichSelect.PlainParams> = ( params ) => {
|
|
54
|
+
let {
|
|
55
|
+
value = null,
|
|
56
|
+
placeholder,
|
|
57
|
+
options = []
|
|
58
|
+
} = params;
|
|
59
|
+
|
|
60
|
+
let SelectedExist = 0;
|
|
61
|
+
let SelectedValue = JSON.stringify( value );
|
|
62
|
+
let DefaultOptions = options.map( ( option ) => {
|
|
63
|
+
let { type,value } = option;
|
|
64
|
+
let Value = JSON.stringify( value );
|
|
65
|
+
let Selected = Value == SelectedValue;
|
|
66
|
+
SelectedExist |= Number( Selected );
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
...option,
|
|
70
|
+
type: type || 'button',
|
|
71
|
+
value: Value
|
|
72
|
+
}
|
|
73
|
+
} );
|
|
74
|
+
if ( !SelectedExist ) value = null;
|
|
75
|
+
let DefaultValue = JSON.stringify( value );
|
|
76
|
+
|
|
77
|
+
return <Core
|
|
78
|
+
{ ...params }
|
|
79
|
+
value={ DefaultValue }
|
|
80
|
+
options={ DefaultOptions }
|
|
81
|
+
/>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const Core: React.FC<amotify.fn.Input.RichSelect.PlainParams> = ( params ) => {
|
|
85
|
+
let {
|
|
86
|
+
tone,
|
|
87
|
+
required,
|
|
88
|
+
form,
|
|
89
|
+
className,
|
|
90
|
+
|
|
91
|
+
enableFormSubmit,
|
|
92
|
+
enableUnSelected,
|
|
93
|
+
|
|
94
|
+
checkValidationAtFirst,
|
|
95
|
+
onChange,onKeyDown,
|
|
96
|
+
onValidate,
|
|
97
|
+
onUpdateValue,
|
|
98
|
+
onUpdateValidValue,
|
|
99
|
+
value = '',
|
|
100
|
+
options,
|
|
101
|
+
placeholder,
|
|
102
|
+
|
|
103
|
+
leftIndicator,rightIndicator,leftIcon,rightIcon,
|
|
104
|
+
componentID,status_id,
|
|
105
|
+
|
|
106
|
+
cellStyles,
|
|
107
|
+
sheetStyles,
|
|
108
|
+
|
|
109
|
+
...others
|
|
110
|
+
} = params;
|
|
111
|
+
|
|
112
|
+
let Default_Status: amotify.fn.Input.Status.Plain = {
|
|
113
|
+
componentID: params.componentID || '',
|
|
114
|
+
dataValue: value,
|
|
115
|
+
eventType: 'init',
|
|
116
|
+
eventID: $.uuidGen()
|
|
117
|
+
}
|
|
118
|
+
let [ val_tipID ] = React.useState( $.uuid.gen() );
|
|
119
|
+
let [ val_status,set_status ] = React.useState( Default_Status );
|
|
120
|
+
let [ val_validate,set_validate ] = React.useState( {
|
|
121
|
+
ok: false,
|
|
122
|
+
notice: []
|
|
123
|
+
} as amotify.fn.Input.Validation.Result );
|
|
124
|
+
|
|
125
|
+
CommonEffects( {
|
|
126
|
+
type: 'richSelect',
|
|
127
|
+
params,
|
|
128
|
+
val_status,
|
|
129
|
+
set_status,
|
|
130
|
+
ExtraOverrideParams: {
|
|
131
|
+
dataValue: value,
|
|
132
|
+
formatValue: value,
|
|
133
|
+
},
|
|
134
|
+
val_validate,
|
|
135
|
+
set_validate,
|
|
136
|
+
DefaultValidation,
|
|
137
|
+
onUpdateValue,
|
|
138
|
+
onUpdateValidValue
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
let SelectedElement: ReactElement = <Box fontColor='4.thin' textAlign='left'>{ placeholder || '選択' }</Box>;
|
|
142
|
+
if ( val_status.dataValue ) {
|
|
143
|
+
let Selected = options.find( ( option ) => option.type == 'button' && option.value == val_status.dataValue );
|
|
144
|
+
if ( Selected ) {
|
|
145
|
+
SelectedElement = Selected.label;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return <BoxWrapper
|
|
150
|
+
val_status={ val_status }
|
|
151
|
+
set_status={ set_status }
|
|
152
|
+
val_validate={ val_validate }
|
|
153
|
+
params={ params }
|
|
154
|
+
>
|
|
155
|
+
<button
|
|
156
|
+
{ ...others as any }
|
|
157
|
+
data-form={ form }
|
|
158
|
+
data-validation={ val_validate.ok }
|
|
159
|
+
data-component-id={ val_status.componentID }
|
|
160
|
+
data-value={ val_status.dataValue }
|
|
161
|
+
data-input-type={ 'richSelect' }
|
|
162
|
+
className={ [
|
|
163
|
+
className,
|
|
164
|
+
style.SelectLegend,
|
|
165
|
+
coreStyle.InputCover
|
|
166
|
+
].join( ' ' ) }
|
|
167
|
+
onClick={ ( e ) => {
|
|
168
|
+
Tooltips.open( {
|
|
169
|
+
tipsID: val_tipID,
|
|
170
|
+
parent: e.currentTarget,
|
|
171
|
+
gravityPoint: 13,
|
|
172
|
+
close_option: {
|
|
173
|
+
elementBlur: ''
|
|
174
|
+
},
|
|
175
|
+
content: () => {
|
|
176
|
+
let Options = options.map( ( option ) => {
|
|
177
|
+
let {
|
|
178
|
+
type,
|
|
179
|
+
value,
|
|
180
|
+
label
|
|
181
|
+
} = option;
|
|
182
|
+
|
|
183
|
+
if ( type == 'button' ) {
|
|
184
|
+
return <Buttons.Button.Clear.R
|
|
185
|
+
color='cloud'
|
|
186
|
+
borderRadius={ 0 }
|
|
187
|
+
fontColor='2.normal'
|
|
188
|
+
textAlign='left'
|
|
189
|
+
padding={ 0 }
|
|
190
|
+
onClick={ () => {
|
|
191
|
+
set_status( {
|
|
192
|
+
...val_status,
|
|
193
|
+
dataValue: value,
|
|
194
|
+
eventType: 'update',
|
|
195
|
+
eventID: $.uuidGen()
|
|
196
|
+
} );
|
|
197
|
+
Tooltips.close( val_tipID );
|
|
198
|
+
} }
|
|
199
|
+
{ ...cellStyles }
|
|
200
|
+
>
|
|
201
|
+
{ label }
|
|
202
|
+
</Buttons.Button.Clear.R>
|
|
203
|
+
} else {
|
|
204
|
+
return label;
|
|
205
|
+
}
|
|
206
|
+
} );
|
|
207
|
+
return <Column
|
|
208
|
+
ssCardBox
|
|
209
|
+
padding={ [ 1,0 ] }
|
|
210
|
+
gap={ 0 }
|
|
211
|
+
maxHeight={ 'viewHeight' }
|
|
212
|
+
overflow={ 'auto' }
|
|
213
|
+
{ ...sheetStyles }
|
|
214
|
+
freeCSS={ {
|
|
215
|
+
minWidth: 12 * 20,
|
|
216
|
+
...sheetStyles?.freeCSS
|
|
217
|
+
} }
|
|
218
|
+
>
|
|
219
|
+
{ Options }
|
|
220
|
+
</Column>;
|
|
221
|
+
}
|
|
222
|
+
} );
|
|
223
|
+
} }
|
|
224
|
+
>
|
|
225
|
+
{ SelectedElement }
|
|
226
|
+
</button>
|
|
227
|
+
</BoxWrapper>;
|
|
228
|
+
}
|
|
@@ -129,7 +129,7 @@ const Core: React.FC<amotify.fn.Input.Select.PlainParams> = ( params ) => {
|
|
|
129
129
|
onUpdateValidValue
|
|
130
130
|
} );
|
|
131
131
|
|
|
132
|
-
let SelectedElement: ReactElement = <Box fontColor='4.thin'>{ placeholder || '選択' }</Box>;
|
|
132
|
+
let SelectedElement: ReactElement = <Box fontColor='4.thin' textAlign='left'>{ placeholder || '選択' }</Box>;
|
|
133
133
|
if ( val_status.dataValue ) {
|
|
134
134
|
let Selected = options.find( ( option ) => option.value == val_status.dataValue );
|
|
135
135
|
if ( Selected ) SelectedElement = Selected.displayLabel ?? Selected.label;
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
TimeFNs
|
|
41
41
|
} from './Time/_';
|
|
42
42
|
import { SelectInput } from './Select/_';
|
|
43
|
+
import { RichSelectInput } from './RichSelect/_';
|
|
43
44
|
import { ListInput } from './List/_';
|
|
44
45
|
import { ChipsInput } from './Chips/_';
|
|
45
46
|
import { SwitchInput } from './Switch/_';
|
|
@@ -442,6 +443,28 @@ export const Input: amotify.fn.Input.Methods = {
|
|
|
442
443
|
params={ params }
|
|
443
444
|
/>;
|
|
444
445
|
},
|
|
446
|
+
RichSelect: ( rawParams ) => {
|
|
447
|
+
rawParams = { ...rawParams }
|
|
448
|
+
if ( $.is.nullish( rawParams.rightIcon ) ) {
|
|
449
|
+
rawParams.rightIcon = <Input.Comps.RightIcon
|
|
450
|
+
flexType='col'
|
|
451
|
+
className={ style.IndicatorIcon }
|
|
452
|
+
{ ...rawParams.rightIconStyles }
|
|
453
|
+
>
|
|
454
|
+
<FAI.AngleDown />
|
|
455
|
+
</Input.Comps.RightIcon>
|
|
456
|
+
}
|
|
457
|
+
if ( rawParams.rightIcon ) rawParams.paddingRight = rawParams.paddingRight ?? 3;
|
|
458
|
+
if ( rawParams.leftIcon ) rawParams.paddingLeft = rawParams.paddingLeft ?? 3;
|
|
459
|
+
|
|
460
|
+
let params = DefaultStyles.Boxish( rawParams ) as amotify.fn.Input.Select.PlainParams;
|
|
461
|
+
delete params.rightIconStyles;
|
|
462
|
+
return <UniComponent
|
|
463
|
+
componentID={ rawParams.componentID }
|
|
464
|
+
children={ RichSelectInput }
|
|
465
|
+
params={ params }
|
|
466
|
+
/>;
|
|
467
|
+
},
|
|
445
468
|
Radio: ListInputs.Radio,
|
|
446
469
|
Checkbox: ListInputs.Checkbox,
|
|
447
470
|
Chips: ChipsInputs,
|
|
@@ -103,6 +103,7 @@ const GenNotices: React.FC<{
|
|
|
103
103
|
componentID,
|
|
104
104
|
eventType
|
|
105
105
|
} = val_status;
|
|
106
|
+
|
|
106
107
|
$.interval.clear( 'NoticeTimer-' + componentID );
|
|
107
108
|
$.interval.clear( 'NoticeTimerClose-' + componentID );
|
|
108
109
|
|
|
@@ -316,6 +317,8 @@ export const CommonEffects: {
|
|
|
316
317
|
Value = dataValue.map( ( value: any ) => JSON.parse( value ) )
|
|
317
318
|
} else if ( type == 'select' ) {
|
|
318
319
|
Value = JSON.parse( dataValue );
|
|
320
|
+
} else if ( type == 'richSelect' ) {
|
|
321
|
+
Value = JSON.parse( dataValue );
|
|
319
322
|
} else if ( type == 'file' ) {
|
|
320
323
|
useStore.update( {
|
|
321
324
|
key: componentID,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
launchID,
|
|
3
3
|
React,
|
|
4
4
|
LaunchSubApplication,
|
|
5
|
-
useStore
|
|
5
|
+
useStore,
|
|
6
6
|
} from '@global';
|
|
7
7
|
import {
|
|
8
8
|
Img,
|
|
@@ -677,29 +677,25 @@ const Comps = {
|
|
|
677
677
|
}
|
|
678
678
|
return WrapperCSS;
|
|
679
679
|
}
|
|
680
|
+
|
|
680
681
|
let [ val_Styles,set_Styles ] = React.useState( getWrapperCSS() );
|
|
681
682
|
const AdjustExtrusion = () => {
|
|
683
|
+
let BaseRect = $( Query ).position();
|
|
682
684
|
let ContentRect = $( ContentQuery ).position();
|
|
683
685
|
let screen = $.getScreenSize();
|
|
684
686
|
|
|
685
687
|
let newStyles = { ...val_Styles }
|
|
686
688
|
if ( ContentRect.top < 0 ) {
|
|
687
|
-
|
|
688
|
-
newStyles.top = ContentRect.height + 2;
|
|
689
|
+
newStyles.top = BaseRect.top - ContentRect.top;
|
|
689
690
|
}
|
|
690
691
|
if ( ContentRect.left < 0 ) {
|
|
691
|
-
|
|
692
|
-
newStyles.left = ContentRect.width + 2;
|
|
692
|
+
newStyles.left = BaseRect.left - ContentRect.left;
|
|
693
693
|
}
|
|
694
694
|
if ( ContentRect.right > screen.width ) {
|
|
695
|
-
|
|
696
|
-
let shift = ContentRect.right - screen.width;
|
|
697
|
-
newStyles.left = ContentRect.left - shift - 2;
|
|
695
|
+
newStyles.left = BaseRect.left - ( ContentRect.right - screen.width );
|
|
698
696
|
}
|
|
699
697
|
if ( ContentRect.bottom > screen.height ) {
|
|
700
|
-
|
|
701
|
-
let shift = ContentRect.bottom - screen.height;
|
|
702
|
-
newStyles.top = ContentRect.top - shift - 2;
|
|
698
|
+
newStyles.top = BaseRect.top - ( ContentRect.bottom - screen.height );
|
|
703
699
|
}
|
|
704
700
|
|
|
705
701
|
return newStyles;
|
|
@@ -754,10 +750,12 @@ const Comps = {
|
|
|
754
750
|
<Box
|
|
755
751
|
flexSizing={ 'none' }
|
|
756
752
|
data-sheet-content={ val_componentID }
|
|
753
|
+
maxHeight={ 'viewHeight' }
|
|
754
|
+
overflow={ 'auto' }
|
|
757
755
|
{ ...others }
|
|
758
756
|
freeCSS={ {
|
|
759
757
|
maxWidth: '98vw',
|
|
760
|
-
...others.freeCSS
|
|
758
|
+
...others.freeCSS
|
|
761
759
|
} }
|
|
762
760
|
>
|
|
763
761
|
{ $.is.function( Content ) ? <Content /> : Content }
|
package/src/launch.tsx
CHANGED
|
@@ -97,7 +97,16 @@ $( window ).addEvent( {
|
|
|
97
97
|
callback: () => {
|
|
98
98
|
global.amotify.config.device = deviceIdentifier();
|
|
99
99
|
|
|
100
|
-
$( document.body )
|
|
100
|
+
let Body = $( document.body );
|
|
101
|
+
let viewHeight = window.innerHeight;
|
|
102
|
+
|
|
103
|
+
let topNavHeight = Number( Body.getStyleProperty( '--topNavHeight' ).removeLetters() );
|
|
104
|
+
let footerNavHeight = Number( Body.getStyleProperty( '--footerNavHeight' ).removeLetters() );
|
|
105
|
+
let contentHeight = viewHeight - topNavHeight - footerNavHeight;
|
|
106
|
+
|
|
107
|
+
Body.setStyleProperty( '--viewHeight',viewHeight + 'px' )
|
|
108
|
+
.setStyleProperty( '--sideNavHeight',contentHeight + 'px' )
|
|
109
|
+
.setStyleProperty( '--contentHeight',contentHeight + 'px' );
|
|
101
110
|
}
|
|
102
111
|
} );
|
|
103
112
|
|