amotify 0.2.279 → 0.2.280
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/demo/esbuild/designBook.tsx +16 -21
- package/demo/esbuild/public/index.css +9366 -1
- package/demo/next/package.json +1 -1
- package/dist/@declares/property.d.ts +9 -8
- package/dist/@styles/componentClasses/index.css +1 -1
- package/dist/@styles/componentClasses/index.d.ts +22 -21
- package/dist/@styles/componentClasses/index.js +1 -1
- package/dist/@styles/index.css +1 -1
- package/dist/@styles/index.js +1 -1
- package/dist/@styles/style.css +1 -1
- package/dist/@styles/style.d.ts +0 -1
- package/dist/@styles/style.js +1 -1
- package/dist/@utils/GenerateClassName.d.ts +11 -15
- package/dist/@utils/GenerateClassName.js +1 -1
- package/dist/@utils/LaunchReactApp.js +1 -1
- package/dist/@utils/config.js +1 -1
- package/dist/@utils/dragEffect.d.ts +57 -0
- package/dist/@utils/dragEffect.js +1 -0
- package/dist/@utils/index.d.ts +2 -1
- package/dist/@utils/index.js +1 -1
- package/dist/@utils/useRemote.d.ts +9 -0
- package/dist/@utils/useRemote.js +1 -0
- package/dist/atoms/Grid.js +2 -2
- package/dist/atoms/Img.js +1 -1
- package/dist/atoms/Logo.js +2 -2
- package/dist/atoms/index.js +1 -1
- package/dist/fn/Button.d.ts +1 -1
- package/dist/fn/Button.js +1 -1
- package/dist/fn/Cropper.js +1 -1
- package/dist/fn/DataGrid/index.d.ts +129 -83
- package/dist/fn/DataGrid/index.js +1 -1
- package/dist/fn/Effect/Fade.js +1 -1
- package/dist/fn/Effect/Pudding.js +1 -1
- package/dist/fn/Effect/Ripple.js +3 -3
- package/dist/fn/Input/Autocomplete.d.ts +3 -3
- package/dist/fn/Input/Autocomplete.js +1 -1
- package/dist/fn/Input/Color.js +1 -1
- package/dist/fn/Input/Contenteditable.js +1 -1
- package/dist/fn/Input/DigitCharacters.d.ts +1 -1
- package/dist/fn/Input/DigitCharacters.js +1 -1
- package/dist/fn/Input/Drum.d.ts +2 -2
- package/dist/fn/Input/Drum.js +1 -1
- package/dist/fn/Input/Filer.d.ts +4 -4
- package/dist/fn/Input/Filer.js +1 -1
- package/dist/fn/Input/Label.d.ts +2 -0
- package/dist/fn/Input/Label.js +1 -1
- package/dist/fn/Input/List.d.ts +5 -5
- package/dist/fn/Input/List.js +1 -1
- package/dist/fn/Input/Parts.js +1 -1
- package/dist/fn/Input/Segmented.js +1 -1
- package/dist/fn/Input/Select.d.ts +6 -6
- package/dist/fn/Input/Select.js +1 -1
- package/dist/fn/Input/Slider.js +1 -1
- package/dist/fn/Input/Switch.js +1 -1
- package/dist/fn/Input/TextField.js +2 -2
- package/dist/fn/Input/Time/Selector.js +1 -1
- package/dist/fn/Input/Time/index.js +1 -1
- package/dist/fn/Input/core.d.ts +6 -6
- package/dist/fn/Input/core.js +1 -1
- package/dist/fn/Input/index.d.ts +18 -18
- package/dist/fn/Input/index.js +1 -1
- package/dist/fn/Loader/corner.js +1 -1
- package/dist/fn/PageNotFound.js +1 -1
- package/dist/fn/Plate.js +1 -1
- package/dist/fn/RootViewController.js +1 -1
- package/dist/fn/Sheet.js +1 -1
- package/dist/fn/SwipeView.js +1 -1
- package/dist/fn/TabBar.js +1 -1
- package/dist/fn/Table/Data.d.ts +3 -3
- package/dist/fn/Table/Data.js +1 -1
- package/dist/fn/Table/Normal.js +1 -1
- package/dist/fn/Table/Wrapper.js +1 -1
- package/dist/fn/Table/index.d.ts +2 -2
- package/dist/fn/Table/index.js +1 -1
- package/dist/fn/Tooltips.js +1 -1
- package/dist/index.d.ts +49 -6
- package/dist/mols/List.js +1 -1
- package/dist/mols/Literal.js +1 -1
- package/dist/mols/MarkerPen.d.ts +10 -0
- package/dist/mols/MarkerPen.js +1 -0
- package/dist/mols/index.d.ts +1 -0
- package/dist/mols/index.js +1 -1
- package/dist/orgs/index.d.ts +1 -1
- package/dist/orgs/index.js +1 -0
- package/dist/temps/index.d.ts +1 -1
- package/dist/temps/index.js +1 -0
- package/package.json +7 -7
- package/dist/@utils/useRefresh.d.ts +0 -8
- package/dist/@utils/useRefresh.js +0 -1
- package/dist/fn/Table/Drag.d.ts +0 -18
- package/dist/fn/Table/Drag.js +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Records } from 'jmini';
|
|
1
2
|
import { ReactElement, StyleProps } from '../../@declares';
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import Input from '../Input';
|
|
3
5
|
declare namespace DataGrid {
|
|
4
6
|
type customTableHTMLAttributes<T> = Omit<React.TableHTMLAttributes<T>, 'border'>;
|
|
5
7
|
type Table = StyleProps.BasicElement & customTableHTMLAttributes<HTMLTableElement>;
|
|
@@ -8,135 +10,179 @@ declare namespace DataGrid {
|
|
|
8
10
|
type TR = StyleProps.BasicElement & React.HTMLAttributes<HTMLTableRowElement>;
|
|
9
11
|
type TableCell = StyleProps.BasicElement & React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
10
12
|
type RowID = string | number;
|
|
13
|
+
/**
|
|
14
|
+
* -1: descending
|
|
15
|
+
* 0: disabled
|
|
16
|
+
* 1: ascending
|
|
17
|
+
*/
|
|
18
|
+
type Keytype = string | number;
|
|
11
19
|
type SortType = -1 | 0 | 1;
|
|
12
|
-
type Tones = 'border' | 'border.vertical' | 'border.horizontal' |
|
|
20
|
+
type Tones = 'border' | 'border.vertical' | 'border.horizontal' | false;
|
|
21
|
+
type Checkable = boolean | 'left' | 'right';
|
|
13
22
|
type CellPosition = {
|
|
14
23
|
rowIdx: number;
|
|
15
24
|
colIdx: number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
topIdx: number;
|
|
26
|
+
leftIdx: number;
|
|
27
|
+
rightIdx: number;
|
|
28
|
+
bottomIdx: number;
|
|
20
29
|
isHeader: boolean;
|
|
21
30
|
isBody: boolean;
|
|
31
|
+
isFooter: boolean;
|
|
22
32
|
};
|
|
23
33
|
type Cell = TableCell & {
|
|
24
|
-
|
|
25
|
-
data: string | number;
|
|
34
|
+
isTH?: boolean;
|
|
26
35
|
label?: ReactElement;
|
|
27
|
-
sortKey?: string | number;
|
|
28
36
|
};
|
|
29
37
|
namespace Cell {
|
|
30
|
-
type Head = Cell & {
|
|
38
|
+
type Head<K extends Keytype> = Cell & {
|
|
39
|
+
key: K;
|
|
31
40
|
/**
|
|
32
|
-
* default
|
|
41
|
+
* default 0
|
|
33
42
|
*/
|
|
34
43
|
sortable?: SortType;
|
|
35
44
|
defSort?: SortType;
|
|
36
45
|
filterable?: boolean;
|
|
37
|
-
checkable?:
|
|
46
|
+
checkable?: Checkable;
|
|
47
|
+
/**
|
|
48
|
+
* if true, ( sortable/defSort/filterable ) will be ignored.
|
|
49
|
+
*/
|
|
38
50
|
draggable?: boolean;
|
|
51
|
+
isHidden?: boolean;
|
|
52
|
+
};
|
|
53
|
+
type Body<T = Keytype> = Cell & {
|
|
54
|
+
data: T;
|
|
55
|
+
sortKey?: string | number;
|
|
56
|
+
onLabelRender?(value: T): ReactElement;
|
|
57
|
+
};
|
|
58
|
+
type Footer<T = Keytype> = Cell & {
|
|
59
|
+
data: T;
|
|
60
|
+
onLabelRender?(value: T): ReactElement;
|
|
39
61
|
};
|
|
40
|
-
type Body = Cell & {};
|
|
41
62
|
}
|
|
42
|
-
type
|
|
63
|
+
type Row<K extends Keytype = Keytype, T = Keytype> = {
|
|
43
64
|
row_id?: RowID;
|
|
65
|
+
/**
|
|
66
|
+
* for checker
|
|
67
|
+
*/
|
|
44
68
|
isSelected?: boolean;
|
|
45
69
|
isFilterMatched?: boolean;
|
|
46
70
|
isVisible?: boolean;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
searchKey?: string;
|
|
72
|
+
onRowClick?(event: React.MouseEvent<HTMLTableRowElement, MouseEvent>): void;
|
|
73
|
+
} & Partial<Record<K, Cell.Body<T> | RowID | boolean | Function>>;
|
|
74
|
+
type Header<K extends Keytype = Keytype> = Cell.Head<K>[];
|
|
75
|
+
type Body<K extends Keytype = Keytype> = Row<K>[];
|
|
76
|
+
type InternalRow<K extends Keytype = Keytype, T = Keytype> = {
|
|
77
|
+
row_id?: RowID;
|
|
78
|
+
/**
|
|
79
|
+
* for checker
|
|
80
|
+
*/
|
|
81
|
+
isSelected?: boolean;
|
|
82
|
+
isFilterMatched?: boolean;
|
|
83
|
+
isVisible?: boolean;
|
|
84
|
+
searchKey?: string;
|
|
85
|
+
draggerIndex?: number;
|
|
86
|
+
onRowClick?(event: React.MouseEvent<HTMLTableRowElement, MouseEvent>): void;
|
|
87
|
+
} & Partial<Record<K, Cell.Body<T>>>;
|
|
88
|
+
type Footer<K extends Keytype = Keytype, T = Keytype> = Partial<Record<K, Cell.Footer<T> | RowID>>;
|
|
89
|
+
type Input<K extends Keytype = Keytype> = {
|
|
56
90
|
tone?: Tones;
|
|
57
91
|
datagridID?: string;
|
|
92
|
+
props?: Records;
|
|
93
|
+
/**
|
|
94
|
+
* default 100
|
|
95
|
+
*/
|
|
96
|
+
maxRows?: number;
|
|
58
97
|
colLength?: number;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
98
|
+
/**
|
|
99
|
+
* If true, the header will not be rendered.
|
|
100
|
+
*/
|
|
101
|
+
headerless?: boolean;
|
|
102
|
+
header: Header<K>;
|
|
103
|
+
body: Body<K>;
|
|
104
|
+
footer?: Footer<K>;
|
|
62
105
|
defaultSearchKey?: string;
|
|
63
|
-
|
|
106
|
+
rowStyles?: StyleProps.StyleProps;
|
|
107
|
+
cellStyles?: StyleProps.StyleProps & {
|
|
108
|
+
onHeader?: StyleProps.StyleProps;
|
|
109
|
+
onBody?: StyleProps.StyleProps;
|
|
110
|
+
onTop?: StyleProps.StyleProps;
|
|
111
|
+
onBottom?: StyleProps.StyleProps;
|
|
112
|
+
onLeft?: StyleProps.StyleProps;
|
|
113
|
+
onRight?: StyleProps.StyleProps;
|
|
114
|
+
};
|
|
64
115
|
cellClassName?: string;
|
|
65
|
-
onCellStyles?(props: CellPosition, def: StyleProps.
|
|
116
|
+
onCellStyles?(props: CellPosition, def: StyleProps.StyleProps): StyleProps.StyleProps;
|
|
66
117
|
className?: string;
|
|
67
|
-
onNoRecordsRender
|
|
68
|
-
onRowClick?(
|
|
69
|
-
onCellClick?(opt: CellPosition, event: React.MouseEvent<
|
|
70
|
-
onSorted?(
|
|
71
|
-
onSelected?(
|
|
118
|
+
onNoRecordsRender?(): ReactElement;
|
|
119
|
+
onRowClick?(row: Row, event: React.MouseEvent<HTMLTableRowElement, MouseEvent>): void;
|
|
120
|
+
onCellClick?(opt: CellPosition, event: React.MouseEvent<HTMLTableCellElement, MouseEvent>): void;
|
|
121
|
+
onSorted?(col: number, sort: SortType): void;
|
|
122
|
+
onSelected?(rows: Row[]): void;
|
|
123
|
+
onDragged?(rows: Row[]): void;
|
|
72
124
|
} & StyleProps.States;
|
|
73
125
|
type Config = {
|
|
74
126
|
datagridID: string;
|
|
75
127
|
colLength: number;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
128
|
+
body: InternalRow[];
|
|
129
|
+
filter: {
|
|
130
|
+
keyword: string;
|
|
131
|
+
current: (string[])[];
|
|
132
|
+
};
|
|
133
|
+
sort: {
|
|
134
|
+
col: number;
|
|
135
|
+
dir: SortType;
|
|
136
|
+
};
|
|
82
137
|
paging: {
|
|
83
138
|
rows: number;
|
|
84
139
|
total: number;
|
|
85
140
|
current: number;
|
|
86
141
|
};
|
|
142
|
+
draggable?: boolean;
|
|
87
143
|
};
|
|
88
|
-
namespace Config {
|
|
89
|
-
namespace Sort {
|
|
90
|
-
type Meta = {
|
|
91
|
-
col: number;
|
|
92
|
-
dir: SortType;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
type FilterMeta = {
|
|
96
|
-
keyword: string;
|
|
97
|
-
current: (string[])[];
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
144
|
type Props = {
|
|
101
145
|
input: Input;
|
|
102
146
|
val_config: Config;
|
|
103
147
|
set_config: React.Dispatch<React.SetStateAction<Config>>;
|
|
104
148
|
};
|
|
105
|
-
type
|
|
149
|
+
type RemoteProps = {
|
|
106
150
|
val_config: Config;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
type FNs = {
|
|
112
|
-
genBodyRow(cells: Cell.Body[], meta?: RowMeta): Row.Body;
|
|
113
|
-
getData(datagridID: string): Row.Body[];
|
|
114
|
-
Table: React.FC<Table>;
|
|
115
|
-
Head: React.FC<TableHead>;
|
|
116
|
-
Body: React.FC<TableBody>;
|
|
117
|
-
Row: React.FC<TR>;
|
|
118
|
-
TH: React.FC<TableCell>;
|
|
119
|
-
TD: React.FC<TableCell>;
|
|
120
|
-
RightIndicator: Cell;
|
|
121
|
-
SearchInput: React.FC<{
|
|
122
|
-
datagridID: string;
|
|
123
|
-
onChange(keyword: string): void;
|
|
124
|
-
}>;
|
|
125
|
-
Info: React.FC<{
|
|
126
|
-
datagridID: string;
|
|
127
|
-
}>;
|
|
128
|
-
Paging: React.FC<{
|
|
129
|
-
datagridID: string;
|
|
130
|
-
}>;
|
|
131
|
-
RowLength: React.FC<{
|
|
132
|
-
datagridID: string;
|
|
133
|
-
lengthSelect: number[];
|
|
134
|
-
}>;
|
|
151
|
+
remoteUpdate: {
|
|
152
|
+
paging(pageIdx: number): void;
|
|
153
|
+
maxRow(maxRows: number): void;
|
|
154
|
+
searchKey(keyword: string): void;
|
|
135
155
|
};
|
|
136
|
-
}
|
|
137
|
-
type
|
|
156
|
+
};
|
|
157
|
+
type Component = <K extends string = string>(props: DataGrid.Input<K>) => ReactElement;
|
|
158
|
+
type FNs = {
|
|
159
|
+
getBodyRows(datagridID: string): Body[];
|
|
160
|
+
Table: React.FC<Table>;
|
|
161
|
+
Head: React.FC<TableHead>;
|
|
162
|
+
Body: React.FC<TableBody>;
|
|
163
|
+
Row: React.FC<TR>;
|
|
164
|
+
Cell: React.FC<TableCell & {
|
|
165
|
+
isTH?: boolean;
|
|
166
|
+
}>;
|
|
167
|
+
TH: React.FC<TableCell>;
|
|
168
|
+
TD: React.FC<TableCell>;
|
|
169
|
+
RightIndicator: Cell.Body;
|
|
170
|
+
SearchInput: React.FC<Input.TextField.Input & {
|
|
171
|
+
datagridID: string;
|
|
172
|
+
}>;
|
|
173
|
+
Info: React.FC<{
|
|
174
|
+
datagridID: string;
|
|
175
|
+
}>;
|
|
176
|
+
Paging: React.FC<{
|
|
177
|
+
datagridID: string;
|
|
178
|
+
}>;
|
|
179
|
+
RowCount: React.FC<{
|
|
180
|
+
datagridID: string;
|
|
181
|
+
options: number[];
|
|
182
|
+
}>;
|
|
183
|
+
};
|
|
184
|
+
type Methods = Component & FNs;
|
|
138
185
|
}
|
|
139
|
-
export declare const
|
|
140
|
-
export declare const onDefaultCellStyles: (args: DataGrid.CellPosition, prev: StyleProps.States) => StyleProps.Properties;
|
|
186
|
+
export declare const onDefaultCellStyles: (args: DataGrid.CellPosition, prev: StyleProps.StyleProps) => StyleProps.StyleProps;
|
|
141
187
|
declare const DataGrid: DataGrid.Methods;
|
|
142
188
|
export { DataGrid, DataGrid as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c}from"../../chunk-C5N2D3ZX.js";import{jsx as r,jsxs as R}from"react/jsx-runtime";import m,{useStore as M,UUID as I}from"jmini";import{useState as L,useEffect as P}from"react";import{useRefresh as y}from"../../@utils";import{Box as S,Flex as v,FAI as C,Span as B}from"../../atoms";import{Literal as H,Row as x}from"../../mols";import{Button as w}from"../Button";import u from"../Input";import{TableClasses as F}from"../../@styles/componentClasses";const E=e=>{if(e=="plain")return{};let o={};return m.isOneOf(e,"border","border.horizontal")&&(o.borderBottom="2.normal"),m.isOneOf(e,"border","border.vertical")&&(o.borderRight="2.normal"),a({padding:"1/2",backgroundColor:"layer.1",transition:"short",textAlign:"center"},o)},ee=(e,o)=>{let t=a({},o);return e.isRightCell&&(t.borderRight="unset"),e.isTopCell&&(e.isLeftCell&&(t.borderTopLeftRadius="inherit"),e.isRightCell&&(t.borderTopRightRadius="inherit")),e.isBottomCell&&(t.borderBottom="unset",e.isLeftCell&&(t.borderBottomLeftRadius="inherit"),e.isRightCell&&(t.borderBottomRightRadius="inherit")),t},T={index:e=>r(f.Table,{className:F("Table"),children:R(f.Body,{children:[r(T.Header,a({},e)),r(T.Body,a({},e))]})}),Header:e=>{let{val_config:o}=e;return r(f.Row,{children:o.head.map(t=>r(f.TH,{children:t.label||t.data},t.sortKey||t.data))})},Body:e=>r(f.Row,{})},G=e=>{console.log(e),e=c(a({datagridID:I(),tone:"border",header:[],colLength:0,borderRadius:"1.tone.primary",backgroundColor:"layer.1"},e),{cellStyles:a(a({},E(e.tone||"border")),e.cellStyles)});let o=e.header||[],[t,g]=L(m.scope(()=>{var i,p,d,b,D;let n={datagridID:e.datagridID||I(),colLength:(p=(i=e.colLength)!=null?i:o.length)!=null?p:0,head:o,body:e.body||[],checker:o.map(l=>!!(l!=null&&l.checkable)),filter:Object.assign(o.map(l=>!!(l!=null&&l.filterable)),{keyword:e.defaultSearchKey||"",current:[]}),sort:Object.assign(o.map(l=>{var h;return(h=l.sortable)!=null?h:1}),{col:0,dir:1}),dragger:-1,paging:{rows:100,total:1,current:1}};{let l=(d=o==null?void 0:o.filter(h=>h.defSort))==null?void 0:d[0];l&&(n.sort.col=(b=o.indexOf(l))!=null?b:-1,n.sort.dir=(D=l==null?void 0:l.sortable)!=null?D:1)}return o.forEach((l,h)=>{l!=null&&l.draggable&&(n.dragger=h)}),n}));P(()=>{},[]);let s={input:e,val_config:t,set_config:g};return r(T.index,a({},s))},k={genBodyRow:(e,o)=>Object.assign(e,o),getData:e=>{var o,t;return((t=(o=M.get(e))==null?void 0:o.getRowData)==null?void 0:t.call(o))||[]},Table:e=>r(S,c(a({htmlTag:"table"},e),{border:e.border})),Head:e=>r(S,a({htmlTag:"thead"},e)),Body:e=>r(S,a({htmlTag:"tbody"},e)),Row:e=>r(S,a({htmlTag:"tr"},e)),TH:e=>r(S,a({htmlTag:"th"},e)),TD:e=>r(S,a({htmlTag:"td"},e)),RightIndicator:{type:"td",unitWidth:3,data:"",label:r(C.AngleRight,{fontColor:"theme",fontSize:"4.thirdTitle"})},SearchInput:e=>{let o=y.catch(e.datagridID);if(!o)return null;let{val_config:t,set_config:g}=o;return r(u.TextField,{label:"\u691C\u7D22...",clearButton:!0,padding:"2/3",paddingRight:3,rightIcon:r(u.RightIcon,{ssSphere:2,fontColor:"5.translucent",right:"2/3",children:r(C.Search,{})}),value:t.filter.keyword,onUpdateValidValue:s=>{e.onChange(s),m.interval.once(()=>{g(n=>c(a({},n),{paging:c(a({},n.paging),{current:1}),filter:c(a({},n.filter),{keyword:s,current:Array.from({length:n.colLength},()=>[])})}))},200,"InputSearchTime")}})},Info:e=>{let o=y.catch(e.datagridID);if(!o)return null;let{val_config:t}=o,g=t.body.filter(n=>n.isFilterMatched).length,s=g.ratio(t.paging.total)||0;return R(v,{verticalAlign:"baseline",gap:"1/2",fontSize:"1.mini",fontColor:"3.blur",children:[r(B,{fontSize:"4.thirdTitle",fontColor:"theme",children:g.toLocaleString()}),"/ ",t.paging.total.toLocaleString(),"\u4EF6 (",s,"%)"]})},Paging:e=>{let o=y.catch(e.datagridID);if(!o)return null;let{val_config:t,set_config:g}=o,s=[];for(let i=0;i<t.paging.total;i++)s.push({value:i+1,label:(i+1).toString()});const n=i=>{let p=Math.min(Math.max(1,i),t.paging.total),d=a({},t);d.paging.current=p,g(b=>c(a({},b),{paging:c(a({},b.paging),{current:p})}))};return r(u.Select,{emptySelect:!1,padding:["1/3","2/3"],override:"force",gap:0,leftIcon:r(u.LeftIcon,{freeCSS:{left:2,pointerEvents:"all"},children:r(w.Sub.S,{color:"cloud",fontColor:"4.thin",ssSquare:2.5,unitWidth:2,onClick:()=>{if(t.paging.current==1){n(t.paging.total);return}n(t.paging.current-1)},children:r(C.ChevronLeft,{})})}),rightIcon:r(u.RightIcon,{freeCSS:{right:2,pointerEvents:"all"},children:r(w.Sub.S,{color:"cloud",fontColor:"4.thin",ssSquare:2.5,unitWidth:2,onClick:()=>{if(t.paging.current==t.paging.total){n(1);return}n(t.paging.current+1)},children:r(C.ChevronRight,{})})}),options:s.map(i=>({value:i.value,label:R(x.Left,{gap:"1/3",verticalAlign:"baseline",children:[i.label,R(H,{fontColor:"4.thin",fontSize:"0.xs",children:["/ ",t.paging.total]})]})})),value:t.paging.current,onUpdateValidValue:i=>{n(i)}})},RowLength:e=>{let o=y.catch(e.datagridID);if(!o)return null;let{val_config:t,set_config:g}=o,s=t.body.filter(d=>d.isFilterMatched).length,n=t.paging.rows,i=0,p=e.lengthSelect.map(d=>(i|=+(d==n),{value:d,label:d.toString()}));return i||p.push({value:n,label:n.toString()}),r(x.Center,{gap:"1/2",children:r(u.Select,{emptySelect:!1,override:"force",padding:"1/3",paddingLeft:3,paddingRight:2,pickerStyles:{freeCSS:{minWidth:12*9}},pickerPosition:4,value:t.paging.rows,leftIcon:r(u.LeftIcon,{fontSize:"0.xs",fontColor:"4.thin",freeCSS:{left:6},children:"\u8868\u793A"}),rightIcon:r(u.RightIcon,{fontSize:"0.xs",fontColor:"4.thin",freeCSS:{right:6},children:"\u4EF6"}),options:p.toASC("value"),onUpdateValidValue:d=>{g(b=>c(a({},b),{paging:{rows:Number(d),current:1,total:Math.ceil(s/Number(d))}}))}})})}},f=Object.assign(G,k);export{f as DataGrid,E as DefaultCellStyles,f as default,ee as onDefaultCellStyles};
|
|
1
|
+
import{b as i,c as p,d as V,e as se}from"../../chunk-C5N2D3ZX.js";import{Fragment as we,jsx as r,jsxs as U}from"react/jsx-runtime";import b,{useStore as ce,UUID as ge}from"jmini";import re,{useState as me,useEffect as Z,useMemo as he}from"react";import{ExtractStyles as _,GenerateHTMLProps as Se,DragEffect as le,useRemote as Y}from"../../@utils";import{faArrowUp as Ce}from"@fortawesome/free-solid-svg-icons/faArrowUp";import{faUpDown as Re}from"@fortawesome/free-solid-svg-icons/faUpDown";import{Box as k,Flex as xe,FAI as v,Span as Ie}from"../../atoms";import{Literal as ae,Row as A,MarkerPen as pe}from"../../mols";import{Button as ee}from"../Button";import E from"../Input";import{TableClasses as Te}from"../../@styles/componentClasses";import{faGripVertical as ue}from"@fortawesome/free-solid-svg-icons/faGripVertical";import{Tips as ye}from"../Tips";const x={toSafetyData:o=>{var n,s,d;let{header:e=[]}=o,t={datagridID:o.datagridID||ge(),colLength:o.colLength||e.length||0,body:o.body||[],filter:{keyword:o.defaultSearchKey||"",current:[]},sort:{col:-1,dir:1},paging:{rows:o.maxRows||100,total:1,current:1},draggable:!!e.some(l=>l.draggable)};t.body.forEach((l,a)=>{var m;l.row_id=(m=l.row_id)!=null?m:a,l.isFilterMatched=!0,l.isVisible=!0,l.draggerIndex=a+1,l.searchKey="",e.forEach((I,P)=>{var c;let g=l[I.key];b.isNullish(g)||(b.isRecord(g)||(g={data:g}),g.sortKey=(c=g.sortKey)!=null?c:String(g.data),l.searchKey+=String(g.sortKey)+" ",l[I.key]=g)})});{let l=(n=e==null?void 0:e.filter(a=>a.defSort))==null?void 0:n[0];l&&(t.sort.col=(s=e.indexOf(l))!=null?s:-1,t.sort.dir=(d=l==null?void 0:l.sortable)!=null?d:1)}return t.draggable,x.updateRowMeta(t,o)},updateRowMeta:(o,e)=>{let t=i({},o);if(t.sort.col>=0&&t.sort.dir){let n=e.header[t.sort.col].key;t.sort.dir==1?t.body.toASC(n+".data"):t.body.toDESC(n+".data")}{let n=String(t.filter.keyword)||"";t.body.forEach(s=>{var l;if(s.isFilterMatched=!0,!n)return;let d=!!((l=s.searchKey)!=null&&l.match(new RegExp(n.escapeRegExChar(),"i")));s.isFilterMatched=d})}{let n=t.paging.rows;t.paging.total=Math.ceil(t.body.filter(a=>a.isFilterMatched).length/n);let s=n*(t.paging.current-1),d=s+n,l=0;t.body.forEach(a=>{a.isVisible=!1,a.isFilterMatched&&(a.isVisible=l>=s&&l<d,l++)})}return t.draggable&&t.body.toASC("draggerIndex"),t},index:o=>{var I,P,g;let[e,t]=me(()=>x.toSafetyData(o));const n=re.useRef(!1);Z(()=>{if(e){if(!n.current){n.current=!0;return}t(x.toSafetyData(o))}},[he(()=>o.props,[o.props])]),Z(()=>{e&&(ce.set({["rows-"+e.datagridID]:e.body}),Y.bridge(e.datagridID,{val_config:e,remoteUpdate:{paging:c=>{t(u=>x.updateRowMeta(p(i({},u),{paging:p(i({},u.paging),{current:Math.max(1,Math.min(u.paging.total,c))})}),o))},maxRow:c=>{t(u=>x.updateRowMeta(p(i({},u),{paging:p(i({},u.paging),{rows:c,current:1})}),o))},searchKey:c=>{b.interval.once(()=>{t(u=>{let w=p(i({},u),{paging:p(i({},u.paging),{current:1}),filter:p(i({},u.filter),{keyword:String(c||"").trim()})});return x.updateRowMeta(w,o)})},300,"InputSearchTime")}}}))},[e]);const s=re.useRef(!1);Z(()=>{if(e&&o.onSelected){if(!s.current){s.current=!0;return}o.onSelected(e.body.filter(c=>c.isSelected))}},[(I=e==null?void 0:e.body)==null?void 0:I.filter(c=>c.isSelected).length]);const d=re.useRef(!1);Z(()=>{if(e&&o.onSorted){if(!d.current){d.current=!0;return}o.onSorted(e.sort.col,e.sort.dir)}},[(P=e==null?void 0:e.sort)==null?void 0:P.col,(g=e==null?void 0:e.sort)==null?void 0:g.dir]);let l={input:o,val_config:e,set_config:t},{className:a,style:m}=Se(o);return r(k,{className:a,style:m,children:r(D.Table,{className:Te("DataGrid"),borderRadius:"inherit",children:U(D.Body,{children:[r(x.Header,i({},l)),r(x.Body,i({},l)),r(x.Footer,i({},l))]})})})},Checker:o=>r(k,{onClick:e=>{e.stopPropagation()},children:r(E.Checker,p(i({wrapStyles:{display:"inlineBlock"},cellStyles:{gap:0}},o),{label:!1}))}),Header:o=>{let{input:e,val_config:t,set_config:n}=o;if(e.headerless)return null;let s="datagrid-dragger-"+t.datagridID,d=["datagrid",t.datagridID,""].join("-"),l=1+t.body.filter(a=>a.isVisible).length+ +!!e.footer;return r(le.DropArea,p(i({component:D.Row,id:d},e.rowStyles),{dragInfo:{type:s,id:d,idx:0,marker:"bottom"},children:e.header.map((a,m)=>{var W,q,$,Q,J;let[I,P]=_(a),j=P,{isTH:g,key:c,label:u,checkable:w,draggable:S,defSort:G,sortable:B,filterable:z,isHidden:O}=j,M=V(j,["isTH","key","label","checkable","draggable","defSort","sortable","filterable","isHidden"]);if(O)return null;let T={rowIdx:0,colIdx:m,topIdx:0,leftIdx:m,rightIdx:t.colLength-m-1,bottomIdx:l-1,isHeader:!0,isBody:!1,isFooter:!1},H=S,L=B!=0,C=m==t.sort.col,F=b.deepMerge(b.deepCopy(e.cellStyles),ie(T,{}),(W=e.cellStyles)==null?void 0:W.onHeader,!T.leftIdx&&((q=e.cellStyles)==null?void 0:q.onLeft),!T.rightIdx&&(($=e.cellStyles)==null?void 0:$.onRight),!T.topIdx&&((Q=e.cellStyles)==null?void 0:Q.onTop),!T.bottomIdx&&((J=e.cellStyles)==null?void 0:J.onBottom),I);e.onCellStyles&&(F=e.onCellStyles(T,F||{}));let K=[r(k,{flexSizing:0,children:u||c},"data")];return L&&K.unshift(r(v,{fontSize:"1.mini",opacity:C?"max":"low",transition:"middle",xcss:{transform:C&&t.sort.dir==-1?"rotate(180deg)":"none"},icon:C?Ce:Re},"sort")),w=="left"&&K.unshift(r(x.Checker,{value:t.body.every(y=>y.isSelected),onUpdateValue:y=>{n(R=>{let f=i({},R);return f.body.forEach(h=>{h.isFilterMatched&&(h.isSelected=!!y)}),f})}},"check")),H&&K.unshift(r(ee.Clear.S,{ssSphere:2,fontColor:"theme",onMouseOver:y=>{ye.open(y.currentTarget,U(ae.Supplement,{children:[r(v,{icon:ue}),"\u30C9\u30E9\u30C3\u30B0\u3067\u5217\u306E\u9806\u756A\u3092\u5909\u66F4"]}),22)},onMouseLeave:y=>ye.abort(),onClick:y=>{y.stopPropagation()},children:r(v.QuestionCircle,{})},"drag")),w=="right"&&K.push(r(x.Checker,{value:t.body.every(y=>y.isSelected),onUpdateValue:y=>{n(R=>{let f=i({},R);return f.body.forEach(h=>{h.isFilterMatched&&(h.isSelected=!!y)}),f})}},"check")),r(D.Cell,p(i(i({isTH:!!g,ssPushable:!!B},_(F||{})[0]),M),{className:[e.cellClassName,M.className].join(" "),onClick:y=>{M.onClick&&M.onClick(y),e.onCellClick&&e.onCellClick(T,y),L&&n(R=>{let f=i({},R);return f.sort={col:m,dir:C?R.sort.dir*-1:B},x.updateRowMeta(f,e)})},children:r(A.Left,{gap:"1/3",children:K})}),m)})}))},Body:o=>{var l;let{input:e,val_config:t,set_config:n}=o,s=t.body.filter(a=>a.isVisible),d=+!e.headerless+s.length+ +!!e.footer;return U(we,{children:[!s.length&&r(D.Row,p(i({},e.rowStyles),{children:r(D.Cell,{colSpan:t.colLength,padding:1,children:(l=e.onNoRecordsRender)==null?void 0:l.call(e)})})),s.map((a,m)=>{let I=m;e.headerless||(I+=1);let P="datagrid-dragger-"+t.datagridID,g=["datagrid",t.datagridID,a.row_id].join("-");return r(le.DropArea,p(i({component:D.Row,id:g,ssPushable:!!e.onRowClick||!!a.onRowClick},e.rowStyles),{onClick:c=>{a.onRowClick&&a.onRowClick(c),e.onRowClick&&e.onRowClick(a,c)},dragInfo:{type:P,id:g,idx:a.draggerIndex,disabled:!t.draggable,marker:"bottom"},children:e.header.map((c,u)=>{var W,q,$,Q,J,y;let w=c.draggable,S=a[c.key];if(!S)return null;b.isRecord(S)||(S={data:S});let[G,B]=_(S),j=B,{isTH:z,sortKey:O,data:M,label:T,onLabelRender:H}=j,L=V(j,["isTH","sortKey","data","label","onLabelRender"]),C={rowIdx:I,colIdx:u,topIdx:I,leftIdx:u,rightIdx:t.colLength-u-1,bottomIdx:d-I-1,isHeader:!1,isBody:!0,isFooter:!1},F=b.deepMerge(b.deepCopy(e.cellStyles),ie(C,{}),(W=e.cellStyles)==null?void 0:W.onBody,!C.leftIdx&&((q=e.cellStyles)==null?void 0:q.onLeft),!C.rightIdx&&(($=e.cellStyles)==null?void 0:$.onRight),!C.topIdx&&((Q=e.cellStyles)==null?void 0:Q.onTop),!C.bottomIdx&&((J=e.cellStyles)==null?void 0:J.onBottom),G);e.onCellStyles&&(F=e.onCellStyles(C,F||{}));let K=[r(k,{flexSizing:0,children:(y=H==null?void 0:H(M))!=null?y:pe(T!=null?T:String(M),t.filter.keyword)},"data")];return c.checkable=="left"&&K.unshift(r(x.Checker,{override:"force",value:!!a.isSelected,onUpdateValue:R=>{n(f=>p(i({},f),{body:f.body.map(h=>(h.row_id==a.row_id&&(h.isSelected=!!R),h))}))}},"check")),w&&K.unshift(r(ee.Clear.S,{tabIndex:-1,isRounded:!0,ssSphere:2.5,fontColor:"6.clear",onPointerDown:R=>{let f=b("#"+g)[0],h=f.cloneNode(!0);h.style.width=f.offsetWidth+"px",le.Start(P,{dragElement:h,startEvent:R,originId:g,horizontal:!1,allowPrevDataOnDropend:!1},de=>se(void 0,null,function*(){let te=m,N=Number(de.idx);if(b.isNullish(N)||N==-1||(N>te&&N--,te==N)||!de.end)return;let X=b.deepCopy(t.body||[]),fe=X.splice(te,1)[0];X.splice(N,0,fe),X.forEach((oe,be)=>{oe.draggerIndex=be+1}),e.onDragged&&e.onDragged(X),n(oe=>p(i({},oe),{body:X}))}))},children:r(A.Center,{gap:"1/4",children:r(v,{icon:ue})})},"drag")),c.checkable=="right"&&K.push(r(x.Checker,{override:"force",value:!!a.isSelected,onUpdateValue:R=>{n(f=>p(i({},f),{body:f.body.map(h=>(h.row_id==a.row_id&&(h.isSelected=!!R),h))}))}},"check")),r(D.Cell,p(i(i({isTH:!!z},_(F||{})[0]),L),{className:[e.cellClassName,L.className].join(" "),onClick:R=>{L.onClick&&L.onClick(R),e.onCellClick&&e.onCellClick(C,R)},children:r(A.Left,{gap:"1/3",children:K})}),u)})}),String(a.row_id))})]})},Footer:o=>{let{input:e,val_config:t,set_config:n}=o;if(!e.footer)return null;let s=+!e.headerless+t.body.filter(d=>d.isVisible).length+1;return r(D.Row,p(i({},e.rowStyles),{children:e.header.map((d,l)=>{var z,O,M,T,H,L;let a=e.footer[d.key];if(!a)return null;b.isRecord(a)||(a={data:a});let[m,I]=_(a),B=I,{isTH:P,data:g,label:c,onLabelRender:u}=B,w=V(B,["isTH","data","label","onLabelRender"]),S={rowIdx:s-1,colIdx:l,topIdx:s-1,leftIdx:l,rightIdx:t.colLength-l-1,bottomIdx:0,isHeader:!1,isBody:!1,isFooter:!0},G=b.deepMerge(b.deepCopy(e.cellStyles),ie(S,{}),(z=e.cellStyles)==null?void 0:z.onBody,!S.leftIdx&&((O=e.cellStyles)==null?void 0:O.onLeft),!S.rightIdx&&((M=e.cellStyles)==null?void 0:M.onRight),!S.topIdx&&((T=e.cellStyles)==null?void 0:T.onTop),!S.bottomIdx&&((H=e.cellStyles)==null?void 0:H.onBottom),m);return e.onCellStyles&&(G=e.onCellStyles(S,G||{})),r(D.Cell,p(i(i({isTH:!!P},_(G||{})[0]),w),{className:[e.cellClassName,w.className].join(" "),onClick:C=>{w.onClick&&w.onClick(C),e.onCellClick&&e.onCellClick(S,C)},children:r(k,{flexSizing:0,children:(L=u==null?void 0:u(g))!=null?L:pe(c!=null?c:String(g),t.filter.keyword)})}),l)})}))}},ie=(o,e)=>{let t=i({},e);return o.topIdx||(t.borderTop="unset"),o.bottomIdx||(t.borderBottom="unset"),o.rightIdx||(t.borderRight="unset"),o.leftIdx||(t.borderLeft="unset"),o.topIdx||(o.leftIdx||(t.borderTopLeftRadius="inherit"),o.rightIdx||(t.borderTopRightRadius="inherit")),o.bottomIdx||(o.leftIdx||(t.borderBottomLeftRadius="inherit"),o.rightIdx||(t.borderBottomRightRadius="inherit")),t},De=o=>(o=i({datagridID:ge(),tone:"border",colLength:0,maxRows:100,onNoRecordsRender:()=>r(A.Center,{children:r(ae.Supplement,{fontColor:"4.thin",children:"(\u30C7\u30FC\u30BF\u306A\u3057)"})})},o),o.rowStyles=i({backgroundColor:"layer.0"},o.rowStyles),o.cellStyles=i(p(i({},b.scope(()=>{if(!o.tone)return{};let e={};return b.isOneOf(o.tone,"border","border.horizontal")&&(e.borderBottom="2.normal"),b.isOneOf(o.tone,"border","border.vertical")&&(e.borderRight="2.normal"),e})),{padding:"1/3",transition:"short"}),o.cellStyles),o.tone&&(o=i({border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"},o)),o.header=o.header||[],o.header.forEach((e,t)=>{var n;e.sortable=(n=e.sortable)!=null?n:1,e.checkable===!0&&(e.checkable="left")}),r(x.index,i({},o))),ne={getBodyRows:o=>ce.get("rows-"+o)||[],Table:o=>r(k,p(i({htmlTag:"table",borderRadius:"inherit"},o),{border:o.border})),Head:o=>r(k,i({htmlTag:"thead",borderRadius:"inherit"},o)),Body:o=>r(k,i({htmlTag:"tbody",borderRadius:"inherit"},o)),Row:o=>r(k,i({htmlTag:"tr",borderRadius:"inherit"},o)),TH:o=>r(k,i({htmlTag:"th"},o)),TD:o=>r(k,i({htmlTag:"td"},o)),Cell:o=>{let n=o,{isTH:e}=n,t=V(n,["isTH"]);return e?r(ne.TH,i({},t)):r(ne.TD,i({},t))},RightIndicator:{unitWidth:3,data:"",label:r(v.AngleRight,{fontColor:"theme",fontSize:"4.thirdTitle"})},SearchInput:o=>{let d=o,{datagridID:e}=d,t=V(d,["datagridID"]),n=Y.catch(o.datagridID);if(!n)return console.warn("[DataGrid] SearchInput must be used inside DataGrid."),null;let{val_config:s}=n;return r(E.TextField,p(i({label:"\u691C\u7D22...",clearButton:!0,padding:["1/2","2/3"],rightIcon:r(E.RightIcon,{ssSphere:2,fontColor:"5.translucent",right:"2/3",children:r(v.Search,{})}),value:s.filter.keyword},t),{onUpdateValidValue:(...l)=>{t.onUpdateValidValue&&t.onUpdateValidValue(...l),n.remoteUpdate.searchKey(l[0])}}))},Info:o=>{let e=Y.catch(o.datagridID);if(!e)return null;let{val_config:t}=e,n=t.body.filter(d=>d.isFilterMatched).length,s=n.ratio(t.paging.total)||0;return U(xe,{verticalAlign:"baseline",gap:"1/2",fontSize:"1.mini",fontColor:"3.blur",children:[r(Ie,{fontSize:"4.thirdTitle",fontColor:"theme",children:n.toLocaleString()}),"/ ",t.paging.total.toLocaleString(),"\u4EF6 (",s,"%)"]})},Paging:o=>{let e=Y.catch(o.datagridID);if(!e)return null;let{val_config:t}=e,n=[];for(let d=0;d<t.paging.total;d++)n.push({value:d+1,label:(d+1).toString()});const s=d=>{let l=Math.min(Math.max(1,d),t.paging.total),a=i({},t);a.paging.current=l,e.remoteUpdate.paging(l)};return r(E.Select,{emptySelect:!1,padding:["1/3","2/3"],override:"force",gap:0,leftIcon:r(E.LeftIcon,{xcss:{left:2,pointerEvents:"all"},children:r(ee.Sub.S,{color:"cloud",fontColor:"4.thin",ssSquare:2.5,unitWidth:2,onClick:()=>{if(t.paging.current==1){s(t.paging.total);return}s(t.paging.current-1)},children:r(v.ChevronLeft,{})})}),rightIcon:r(E.RightIcon,{xcss:{right:2,pointerEvents:"all"},children:r(ee.Sub.S,{color:"cloud",fontColor:"4.thin",ssSquare:2.5,unitWidth:2,onClick:()=>{if(t.paging.current==t.paging.total){s(1);return}s(t.paging.current+1)},children:r(v.ChevronRight,{})})}),options:n.map(d=>({value:d.value||0,label:U(A.Left,{gap:"1/3",verticalAlign:"baseline",children:[d.label,U(ae,{fontColor:"4.thin",fontSize:"0.xs",children:["/ ",t.paging.total]})]})})),value:t.paging.current,onUpdateValidValue:d=>{s(d)}})},RowCount:o=>{let e=Y.catch(o.datagridID);if(!e)return null;let{val_config:t}=e,n=t.body.filter(a=>a.isFilterMatched).length,s=t.paging.rows,d=0,l=o.options.map(a=>(d|=+(a==s),{value:a,label:a.toString()}));return d||l.push({value:s,label:s.toString()}),r(A.Center,{gap:"1/2",children:r(E.Select,{emptySelect:!1,override:"force",padding:"1/3",paddingLeft:3,paddingRight:2,pickerStyles:{xcss:{minWidth:12*9}},pickerPosition:4,leftIcon:r(E.LeftIcon,{fontSize:"0.xs",fontColor:"4.thin",xcss:{left:6},children:"\u8868\u793A"}),rightIcon:r(E.RightIcon,{fontSize:"0.xs",fontColor:"4.thin",xcss:{right:6},children:"\u4EF6"}),value:t.paging.rows,options:l.toASC("value"),onUpdateValidValue:a=>{e.remoteUpdate.maxRow(Number(a))}})})}},D=Object.assign(De,ne);export{D as DataGrid,D as default,ie as onDefaultCellStyles};
|
package/dist/fn/Effect/Fade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as i,d as
|
|
1
|
+
import{b as a,c as i,d as r}from"../../chunk-C5N2D3ZX.js";import{jsx as y}from"react/jsx-runtime";import{UUID as d}from"jmini";import{$$fromRoot as u}from"../../@utils";import{useState as l,useEffect as I}from"react";import{Box as f}from"../../atoms";const x=m=>{let n=m,{animationDelay:p=100,animationTime:s=300,componentId:c=d()}=n,t=r(n,["animationDelay","animationTime","componentId"]),[e]=l(c);return I(()=>{setTimeout(()=>{let o=u('[data-component-id="'+e+'"]');o[0]&&o.css({transition:s+"ms"}).await(1).css({opacity:1})},p)},[]),y(f,i(a({},t),{xcss:i(a({},t.xcss),{opacity:0}),componentId:e}))},F=m=>{let n=m,{animationDelay:p=100,animationTime:s=300,componentId:c=d()}=n,t=r(n,["animationDelay","animationTime","componentId"]),[e]=l(c);return I(()=>{setTimeout(()=>{let o=u('[data-component-id="'+e+'"]');o[0]&&o.css({transition:s+"ms"}).await(1).css({opacity:1,paddingTop:0})},p)},[]),y(f,i(a({paddingTop:2},t),{xcss:i(a({},t.xcss),{opacity:0}),componentId:e}))};export{x as FadeIn,F as FadeUp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-C5N2D3ZX.js";import t from"jmini";import{Config as
|
|
1
|
+
import"../../chunk-C5N2D3ZX.js";import t from"jmini";import{Config as i}from"../../@utils";import{EffectClasses as e}from"../../@styles/componentClasses";const d={Wrapper:()=>(typeof window=="undefined"||t(i.get().appRoot).removeEvent("PuddingClick").onEvent("click",function(n){t(n.target).removeClass(e("PuddingEffect")).await(1).addClass(e("PuddingEffect")).await(510).removeClass(e("PuddingEffect"))},{eventID:"PuddingClick",target:'[data-effect-pudding="1"]'}),null)};export{d as Pudding,d as default};
|
package/dist/fn/Effect/Ripple.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import"../../chunk-C5N2D3ZX.js";import p,{UUID as
|
|
2
|
-
<div class="${
|
|
3
|
-
|
|
1
|
+
import"../../chunk-C5N2D3ZX.js";import p,{UUID as D,Time as c}from"jmini";import{Config as E}from"../../@utils";import{EffectClasses as i}from"../../@styles/componentClasses";const n={RippleElementTag:'[data-effect-ripple="1"]',Start:t=>{let s=c().ms,u=t.target,e=p(u);if(!e[0])return;let o=e.getAttribute("data-effect-tone");if(!o){let l=e.parent('[data-effect-ripple="1"]');if(!l[0])return;e=l,o=l.getAttribute("data-effect-tone")}if(!o)return;let a="RippleWrap-"+D(),{left:r,top:f,height:y,width:v}=e.position(),{pageXOffset:h,pageYOffset:g}=p.getScreenSize(),{x:T,y:M}=p.getCursor(t),m=Math.min(v*1.5,300),I=Math.max(T-(r+h),0),w=Math.max(M-(f+g),0),d={RippleElement:e,startedAt:s,size:m};p(document).onEvent("mouseup",()=>{n.End(d)},{eventID:"RippleMouseUp"}).onEvent("touchend",()=>{setTimeout(()=>{n.End(d)},20)},{eventID:"RippleTouchEnd"}),p(e).addClass(i("RippleElement"),i("Color_"+o)).append(`<div class="${i("RippleWrap")}" id="${a}">
|
|
2
|
+
<div class="${i("Wave")}" />
|
|
3
|
+
</div>`).onEvent("mouseout",l=>{n.End(d)},{eventID:"RippleMouseOut"}).find("#"+a).find("."+i("Wave")).css({left:I,top:w}).await(10).css({height:m,width:m,opacity:".3",transition:".25s"})},End:t=>{let{RippleElement:s,startedAt:u,size:e}=t,a=c().ms-u<=400?".75s":".55s",r=e*2.5;p(document).removeEvent(["RippleMouseUp","RippleTouchMove","RippleTouchEnd","RippleMouseOut"]),s.removeEvent(["RippleMouseOut"]).find("."+i("Wave")).css({height:r,width:r,opacity:"0",transition:a}).await(750).parent().callback(f=>{f.remove()})}},R={Wrapper:()=>(typeof window=="undefined"||p(E.get().appRoot).removeEvent(["RippleTouchStart","RippleMouseDown"]).onEvent("touchstart",t=>{n.Start(t)},{eventID:"RippleTouchStart",target:n.RippleElementTag}).onEvent("mousedown",t=>{E.get().isTouchDevice||n.Start(t)},{eventID:"RippleMouseDown",target:n.RippleElementTag}),null)};export{R as Ripple,R as default};
|
|
@@ -24,7 +24,7 @@ declare namespace Autocomplete {
|
|
|
24
24
|
onDynamicSearchOptionsDelay?: number;
|
|
25
25
|
onSelectorRender?(p: onSelectorRenderProps<T>): React.JSX.Element;
|
|
26
26
|
onSelectedRender?(p: onSelectedRenderProps<T>): React.JSX.Element;
|
|
27
|
-
pickerStyles?: StyleProps.
|
|
27
|
+
pickerStyles?: StyleProps.StyleProps;
|
|
28
28
|
pickerPosition?: 1 | 2 | 3 | 4;
|
|
29
29
|
};
|
|
30
30
|
type Value<T = any> = T extends infer V ? V : string | number | boolean | Records | void | null;
|
|
@@ -76,8 +76,8 @@ declare namespace Autocomplete {
|
|
|
76
76
|
set_optionsModified: React.Dispatch<React.SetStateAction<boolean>>;
|
|
77
77
|
val_keyword: string;
|
|
78
78
|
set_keyword: React.Dispatch<React.SetStateAction<string>>;
|
|
79
|
-
val_status: InputTypes.Status
|
|
80
|
-
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status
|
|
79
|
+
val_status: InputTypes.Status<Value[]>;
|
|
80
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status>>;
|
|
81
81
|
};
|
|
82
82
|
type Component = {
|
|
83
83
|
<T = Value>(p: Input<Value<T>>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as f,d as G,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as N,jsx as u,jsxs as V}from"react/jsx-runtime";import{useState as A,useEffect as F,useRef as ne}from"react";import a,{UUID as v}from"jmini";import{Config as oe}from"../../@utils";import{Box as X,Span as ie,FAI as B,Column as q}from"../../atoms";import{Literal as K,Row as M}from"../../mols";import{Button as $}from"../Button";import{Loader as le}from"../Loader";import{Sheet as ae}from"../Sheet";import{OptionalInputWrapper as re,BoxWrapper as se,CoreEffects as z,DefaultBoxishStyles as ue}from"./core";import{InputAutocompleteClasses as L}from"../../@styles/componentClasses";import{InputLabel as ce}from"./Label";import{RightIcon as Q}from".";function pe(t){let{value:e,states:i}=t,{required:s,options:d,min:m,max:o}=i;m=m||0,o=o||65535;let n=[],p=e.filter(h=>h!==null).length;return s&&(p||n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),p<m&&n.push({type:"invalid",label:m+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),p>o&&n.push({type:"invalid",label:o+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!n.filter(({type:h})=>h=="invalid").length,notice:n}}const R={InitOptions:t=>{let e=[];return t.forEach(i=>{if(!i)return;let{type:s,label:d,value:m,searchValue:o}=i,n=o||a.isString(d)&&d||""||a.isString(m)&&m||a.Stringify(m||"")||"";a.isNullish(d)&&(d=String(m)),e.push(f(l({id:v(8)},i),{searchValue:n,type:s||"selector",label:d,value:m}))}),e},FilterSelectableOptions:(t,e,i)=>{let s=t;return i||(s=t.filter(d=>(d==null?void 0:d.type)!="label")),a.scope(()=>{if(!e)return;let d=e.toLower().replace(/ /g,"");s=s.filter(m=>(m.searchValue||"").toLower().replace(/ /g,"").includes(d))}),s},Button:t=>{let{rootStates:e,val_keyword:i,set_keyword:s,val_optionFocused:d,set_optionFocused:m,val_status:o,set_status:n}=t,J=e,{tone:p,required:h,form:O,className:r,multiSelect:c,enableFormSubmit:y,checkValidationAtFirst:S,onValidate:g,onValidateDelay:I,onUpdateValue:C,onUpdateValidValue:x,onUserAction:P,value:E="",options:_,leftIndicator:D,rightIndicator:k,leftIcon:de,rightIcon:fe,componentId:me,status_id:Se,wrapStyles:ve,emptySelect:ye,searchInputPlaceholder:he,onSelectedRender:ge,onSelectorRender:Ie,pickerStyles:be,pickerPosition:Oe,onDynamicSearchOptions:ke,onDynamicSearchOptionsDelay:_e}=J,T=G(J,["tone","required","form","className","multiSelect","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","searchInputPlaceholder","onSelectedRender","onSelectorRender","pickerStyles","pickerPosition","onDynamicSearchOptions","onDynamicSearchOptionsDelay"]),W="SearchInput_"+e.componentId;return F(()=>{var b;if(e.disabled||!o.isPickerOpen||a.isExist(d))return;let w=R.FilterSelectableOptions(t.val_options,i,!1);m(((b=w[0])==null?void 0:b.id)||"")},[i]),F(()=>{if(o.eventType!="init"&&o.eventType!="override"&&e.max==o.rawValue.length){s(""),n(w=>f(l({},w),{eventID:v(8),isPickerOpen:!1}));return}},[o.rawValue]),F(()=>{let w="autocomplete-click-"+e.componentId;if(!o.isPickerOpen){a(document).removeEvent([w]);return}a('[data-input-origin="'+e.componentId+'"]')&&a(document).addEvent({eventID:w,eventType:"mousedown",callback:U=>{let j=a(U.target),Z=!!a(j).parent("."+L("Core")).length,ee=!!a(j).parent("."+L("Selector")).length;Z||ee||n(te=>f(l({},te),{eventID:v(8),isFocusing:!1,isPickerOpen:!1}))},options:{passive:!1}})},[o.isPickerOpen]),V(N,{children:[u(X,f(l({tabIndex:-1},T),{"data-disabled":e.disabled,"data-show-validation":z.isShowValidation(o,!!S),"data-component-id":o.componentId,"data-input-origin":o.componentId,"data-focus":o.isFocusing||o.isPickerOpen,className:[r,L("Core")].join(" "),onClick:w=>{if(T!=null&&T.onClick&&(T==null||T.onClick(w)),e.disabled)return;let b=document.activeElement;(b==null?void 0:b.id)!=W&&(oe.get().isTouchDevice||a("#"+W).focus()),n(U=>f(l({},U),{eventID:v(8),isPickerOpen:!0,isFocusing:!0}))},onKeyDown:w=>{let b=document.activeElement;(b==null?void 0:b.id)!=W&&(w.preventDefault(),a("#"+W).focus())},children:V(M.Left,{gap:0,children:[u(ie,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),V(M.Left,{flexWrap:!0,flexSizing:0,gap:"1/2",verticalAlign:"unset",freeCSS:{letterSpacing:".5px"},children:[u(R.Selected,l({},t)),u(R.SearchInput,l({},t))]}),o.rawValue.length>1&&u($.Clear,{tabIndex:-1,color:"nega",fontColor:"4.thin",ssSphere:2,onClick:w=>{n(b=>f(l({},b),{eventType:"update",eventID:v(8),rawValue:[]}))},children:u(B.X,{})})]})})),u(R.Picker,l({},t))]})},SearchInput:t=>{let{rootStates:e,val_status:i,set_status:s}=t;if(e.disabled)return null;let d=!!i.isFocusing||!!i.isPickerOpen||!!i.rawValue.length;i.isFocusing||e.multiSelect||i.rawValue.length&&(d=!1);let m=e.searchInputPlaceholder||"\u691C\u7D22...";return u(X,{htmlTag:"input",id:"SearchInput_"+e.componentId,"data-input-value-shallow":i.componentId,placeholder:m,opacity:d?"max":"trans",transition:"middle",flexSizing:0,fontSize:"inherit",border:"0.trans",backgroundColor:"trans",isRounded:!0,padding:[0,"2/3"],value:t.val_keyword,className:[L("SearchInput"),d&&L("isActive")].join(" "),freeCSS:{outline:"none",minWidth:12*4},onFocus:o=>{s(n=>f(l({},n),{eventID:v(8),isFocusing:!0,isPickerOpen:!0}))},onBlur:o=>H(void 0,null,function*(){s(n=>f(l({},n),{eventID:v(8),isFocusing:!1}))}),onCompositionStart:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!0}))},onCompositionEnd:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!1}))},onKeyDown:o=>{let{key:n,metaKey:p,ctrlKey:h}=o,O=p||h;n=="Escape"?s(r=>f(l({},r),{eventID:v(12),isPickerOpen:!1})):n=="Tab"?s(r=>f(l({},r),{eventID:v(8),isFocusing:!1,isPickerOpen:!1})):n==" "?a.scope(()=>{i.isPickerOpen||t.val_keyword||(o.preventDefault(),s(r=>f(l({},r),{eventID:v(8),isPickerOpen:!0})))}):n=="Backspace"?a.scope(()=>{if(t.val_keyword)return;let r=[...t.val_status.rawValue];r.pop(),O&&(r=[]),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1}))}):n=="Enter"&&a.scope(()=>{if(i.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!i.isPickerOpen){s(y=>f(l({},y),{eventID:v(8),isPickerOpen:!0}));return}if(!t.val_optionFocused)return;let r=t.val_options.find(y=>(y==null?void 0:y.id)==t.val_optionFocused);if(!r)return;let{value:c}=r;s(y=>{let S=[...y.rawValue];return a.scope(()=>{if(c===null)return S=[];y.rawValue.includes(c)?S=S.filter(I=>I!==c):e.multiSelect?S.push(c):S=[c]}),f(l({},y),{rawValue:S,eventType:"update",eventID:v(8),isInspected:!1})}),t.set_optionsModified(!0),t.set_keyword("")}),a.scope(()=>{if(!a.isOneOf(n,"ArrowDown","ArrowUp"))return;if(o.preventDefault(),!i.isPickerOpen){s(g=>f(l({},g),{eventID:v(8),isPickerOpen:!0}));return}let r=n=="ArrowDown"?1:-1,c=R.FilterSelectableOptions(t.val_options,t.val_keyword),y=c.length-1,S=null;a.scope(()=>{var I,C,x,P,E,_,D;let g=c.findIndex(k=>(k==null?void 0:k.id)==t.val_optionFocused);if(g==-1){S=(I=c[0])==null?void 0:I.id;return}if(r==1){if(S=(C=c[0])==null?void 0:C.id,O){S=(x=c[y])==null?void 0:x.id;return}if(g==-1||g==y)return;S=(P=c[g+1])==null?void 0:P.id}else{if(S=(E=c[y])==null?void 0:E.id,O){S=(_=c[0])==null?void 0:_.id;return}if(g==-1||g==0)return;S=(D=c[g-1])==null?void 0:D.id}}),t.set_optionFocused(S)}),e.enableFormSubmit&&z.SubmitForm(o,t.rootStates.form)},onChange:o=>{let p=o.target.value;t.set_keyword(p),t.set_optionFocused(""),p&&s(h=>f(l({},h),{eventID:v(8),isPickerOpen:!0}))}},"searchInput")},Picker:t=>{var n;let{rootStates:e,val_status:i}=t,[s,d]=A("idle");F(()=>{if(!e.onDynamicSearchOptions||!i.isPickerOpen)return;if(t.val_optionsModified)return t.set_optionsModified(!1);if(i.isComposing)return;d("fetch");let p="autocomplete-search-"+e.componentId;t.set_optionFocused(""),a.interval.once(()=>H(void 0,null,function*(){var r;let h=yield e.onDynamicSearchOptions(t.val_keyword);d("idle");let O=R.InitOptions(h||[]);t.set_options(O),t.set_optionFocused(((r=O[0])==null?void 0:r.id)||"")}),e.onDynamicSearchOptionsDelay||500,p)},[t.val_keyword,i.isComposing]),F(()=>{let p=a(`[data-selector-id="${i.componentId}"]`)[0];if(!p)return;let h=a(`[data-autocomplete-input-value="${t.val_optionFocused}"]`)[0];h&&(p.scrollTop=h.offsetTop-24)},[t.val_optionFocused]);let m=R.FilterSelectableOptions(t.val_options,e.onDynamicSearchOptions?"":t.val_keyword,!0),o={};{let p=e.pickerPosition||0;a.isOneOf(p,1,2)?o.bottom="100%":a.isOneOf(p,3,4)&&(o.top="100%"),a.isOneOf(p,1,3)?o.left=0:a.isOneOf(p,2,4)&&(o.right=0)}return i.isPickerOpen?u(X,f(l({position:"absolute",padding:"1/3"},o),{freeCSS:l({minWidth:"75%",zIndex:1e3},o.freeCSS),children:u(ae.Body,f(l({className:L("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,tabIndex:-1,boxShadow:"1.normal",overflow:"auto","data-selector-id":i.componentId},e.pickerStyles),{freeCSS:l({maxHeight:12*24},(n=e.pickerStyles)==null?void 0:n.freeCSS),children:V(q,{gap:"1/12",padding:[1,0],children:[s=="fetch"&&u(M.Center,{padding:"1/2",children:u(le.Theme.R,{showInitial:!0})}),s!="fetch"&&V(N,{children:[!m.length&&u(K.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),m.map((p,h)=>{if(!p)return null;let{type:O,value:r}=p,c=t.val_optionFocused==p.id,y=i.rawValue.includes(r),S=e.onSelectorRender;return u(q,{"data-autocomplete-input-value":p.id,children:u(S,{option:p,isFocused:c,isSelected:y,onAdd:()=>{t.set_status(g=>{let I=[...g.rawValue];return a.scope(()=>{if(r===null)return I=[];if(g.rawValue.includes(r)){I=I.filter(x=>x!==r);return}e.multiSelect?I.push(r):I=[r]}),f(l({},g),{rawValue:I,eventType:"update",eventID:v(8),isFocusing:e.max!=I.length,isInspected:!1})})},onKeyDown:g=>{let{key:I}=g;I=="Tab"&&(t.set_optionFocused(""),t.set_status(C=>f(l({},C),{eventID:v(8),isPickerOpen:!1,isFocusing:!1})))}})},p.id)})]})]})}))})):null},Selected:t=>{let{rootStates:e,val_status:i,set_status:s,val_optionsDict:d}=t,m=[];return i.rawValue.forEach(o=>{let n=d[a.Stringify(o)];if(!n)return;let p=e.onSelectedRender,h=(n==null?void 0:n.selectedLabel)||(n==null?void 0:n.label);(n==null?void 0:n.value)===null&&(h=""),m.push(u(q,{position:"relative",flexCenter:!0,freeCSS:{userSelect:"none"},children:u(p,{value:n==null?void 0:n.value,label:h,onRemove:O=>{if(e.disabled)return;let r=[...i.rawValue];r=r.filter(c=>c!==o),s(c=>f(l({},c),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1,isFocusing:e.max!=r.length,isPickerOpen:!0}))}})},a.Stringify(n==null?void 0:n.value)||v(8)))}),u(N,{children:m})},Core:t=>{var x,P,E;let{value:e}=t,[i,s]=A(!1),[d,m]=A(""),[o,n]=A(t.options),[p,h]=A(((x=t.options.find(_=>{var D;return(_==null?void 0:_.value)===((D=t.value)==null?void 0:D[0])}))==null?void 0:x.id)||((P=t.options[0])==null?void 0:P.id)||""),[O,r]=A({}),[c,y]=A(z.DefaultStatus(t.componentId,e)),S=ne(!1);F(()=>{i||(S.current?n(t.options):S.current=!0)},[a.Stringify((E=t.options)==null?void 0:E.map(_=>_.value))]),F(()=>{if(!o.length)return;let _=[...o],D=l({},O);_.forEach(k=>{(k==null?void 0:k.type)!="label"&&(D[a.Stringify(k==null?void 0:k.value)]=k)}),r(D)},[o]);let g={rootStates:t,val_options:o,set_options:n,val_optionFocused:p,set_optionFocused:h,val_optionsDict:O,set_optionsDict:r,val_optionsModified:i,set_optionsModified:s,val_keyword:d,set_keyword:m,val_status:c,set_status:y},I=!!t.multiSelect;z.CommonEffects({type:I?"autocomplete.multi":"autocomplete.single",states:t,val_status:c,set_status:y,SystemValidation:pe});let C=c.rawValue.length&&c.rawValue[0]!==null||c.isPickerOpen||c.isFocusing;return V(se,{val_status:c,set_status:y,states:t,children:[u(ce,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:C}),u(R.Button,l({},g))]})}},Y=t=>{let e=l({},t);return e=f(l({value:[],min:0,max:65535,multiSelect:!0,emptySelect:!0,onSelectorRender:i=>{var s;return i.option?((s=i.option)==null?void 0:s.type)=="label"?u(N,{children:i.option.label}):u($.Sub.S,{color:"cloud",tabIndex:-1,backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["2/3",1.5],isActive:i.isFocused,isActiveStyles:{backgroundColor:"cloud"},onClick:i.onAdd,onKeyDown:i.onKeyDown,children:V(M.Left,{gap:"1/2",children:[i.isSelected&&u(B.Check,{fontColor:"theme"}),u(K.Supplement,{transition:"short",children:i.option.label})]})}):null},onSelectedRender:i=>V(M.Left,{ssCardBox:!0,borderRadius:"1.tone.primary",fontSize:"1.mini",padding:"1/3",gap:0,children:[u(K,{padding:[0,"1/2"],children:i.label}),u($.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,ssSphere:2,onClick:i.onRemove,freeCSS:{lineHeight:1,aspectRatio:"1/1"},children:u(B.X,{})})]}),pickerPosition:3},e),{freeCSS:l({cursor:"pointer"},e.freeCSS)}),e.multiSelect||(e.min=0,e.max=1),e.options=e.options||[],e.emptySelect&&(e.options=[{value:null,label:u(K.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...e.options]),e.value=a.Arrayify(e.value),e.options=R.InitOptions(e.options),a.isNullish(e.rightIcon)&&(e.rightIcon=u(Q,{children:u(B.Search,{})}),e.disabled&&(e.rightIcon=u(Q,{fontColor:"5.translucent",children:u(B.Ban,{})}))),e.rightIcon&&(e=l({paddingRight:3},e)),e.leftIcon&&(e=l({paddingLeft:3},e)),u(re,{componentId:e.componentId,children:R.Core,states:ue(e)})};export{Y as Autocomplete,Y as default};
|
|
1
|
+
import{b as l,c as f,d as Z,e as H}from"../../chunk-C5N2D3ZX.js";import{Fragment as N,jsx as c,jsxs as V}from"react/jsx-runtime";import{useState as A,useEffect as F,useRef as ne}from"react";import a,{UUID as v}from"jmini";import{Config as oe}from"../../@utils";import{Box as X,Span as ie,FAI as B,Column as q}from"../../atoms";import{Literal as K,Row as M}from"../../mols";import{Button as $}from"../Button";import{Loader as le}from"../Loader";import{Sheet as ae}from"../Sheet";import{OptionalInputWrapper as re,BoxWrapper as se,CoreEffects as z,DefaultBoxishStyles as ue}from"./core";import{InputAutocompleteClasses as L}from"../../@styles/componentClasses";import{InputLabel as ce}from"./Label";import{RightIcon as G}from".";function pe(t){let{value:e,states:i}=t,{required:s,options:d,min:m,max:o}=i;m=m||0,o=o||65535;let n=[],p=e.filter(h=>h!==null).length;return s&&(p||n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),p<m&&n.push({type:"invalid",label:m+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),p>o&&n.push({type:"invalid",label:o+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!n.filter(({type:h})=>h=="invalid").length,notice:n}}const R={InitOptions:t=>{let e=[];return t.forEach(i=>{if(!i)return;let{type:s,label:d,value:m,searchValue:o}=i,n=o||a.isString(d)&&d||""||a.isString(m)&&m||a.Stringify(m||"")||"";a.isNullish(d)&&(d=String(m)),e.push(f(l({id:v(8)},i),{searchValue:n,type:s||"selector",label:d,value:m}))}),e},FilterSelectableOptions:(t,e,i)=>{let s=t;return i||(s=t.filter(d=>(d==null?void 0:d.type)!="label")),a.scope(()=>{if(!e)return;let d=e.toLower().replace(/ /g,"");s=s.filter(m=>(m.searchValue||"").toLower().replace(/ /g,"").includes(d))}),s},Button:t=>{let{rootStates:e,val_keyword:i,set_keyword:s,val_optionFocused:d,set_optionFocused:m,val_status:o,set_status:n}=t,J=e,{tone:p,required:h,form:O,className:r,multiSelect:u,enableFormSubmit:y,showInitValidation:S,onValidate:g,onValidateDelay:I,onUpdateValue:x,onUpdateValidValue:C,onUserAction:P,value:E="",options:w,leftIndicator:D,rightIndicator:_,leftIcon:de,rightIcon:fe,componentId:me,status_id:Se,wrapStyles:ve,emptySelect:ye,searchInputPlaceholder:he,onSelectedRender:ge,onSelectorRender:Ie,pickerStyles:be,pickerPosition:Oe,onDynamicSearchOptions:_e,onDynamicSearchOptionsDelay:we}=J,T=Z(J,["tone","required","form","className","multiSelect","enableFormSubmit","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","searchInputPlaceholder","onSelectedRender","onSelectorRender","pickerStyles","pickerPosition","onDynamicSearchOptions","onDynamicSearchOptionsDelay"]),W="SearchInput_"+e.componentId;return F(()=>{var b;if(e.disabled||!o.isPickerOpen||a.isExist(d))return;let k=R.FilterSelectableOptions(t.val_options,i,!1);m(((b=k[0])==null?void 0:b.id)||"")},[i]),F(()=>{if(o.eventType!="init"&&o.eventType!="override"&&e.max==o.rawValue.length){s(""),n(k=>f(l({},k),{eventID:v(8),isPickerOpen:!1}));return}},[o.rawValue]),F(()=>{let k="autocomplete-click-"+e.componentId;if(!o.isPickerOpen){a(document).removeEvent([k]);return}a('[data-input-origin="'+e.componentId+'"]')&&a(document).onEvent("mousedown",U=>{let j=a(U.target),Y=!!a(j).parent("."+L("Core")).length,ee=!!a(j).parent("."+L("Selector")).length;Y||ee||n(te=>f(l({},te),{eventID:v(8),isFocusing:!1,isPickerOpen:!1}))},{eventID:k,passive:!1})},[o.isPickerOpen]),V(N,{children:[c(X,f(l({tabIndex:-1},T),{"data-disabled":e.disabled,"data-show-validation":z.isShowValidation(o,!!S),"data-component-id":o.componentId,"data-input-origin":o.componentId,"data-focus":o.isFocusing||o.isPickerOpen,className:[r,L("Core")].join(" "),onClick:k=>{if(T!=null&&T.onClick&&(T==null||T.onClick(k)),e.disabled)return;let b=document.activeElement;(b==null?void 0:b.id)!=W&&(oe.get().isTouchDevice||a("#"+W).focus()),n(U=>f(l({},U),{eventID:v(8),isPickerOpen:!0,isFocusing:!0}))},onKeyDown:k=>{let b=document.activeElement;(b==null?void 0:b.id)!=W&&(k.preventDefault(),a("#"+W).focus())},children:V(M.Left,{gap:0,children:[c(ie,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),V(M.Left,{flexWrap:!0,flexSizing:0,gap:"1/2",verticalAlign:"unset",xcss:{letterSpacing:".5px"},children:[c(R.Selected,l({},t)),c(R.SearchInput,l({},t))]}),o.rawValue.length>1&&c($.Clear,{tabIndex:-1,color:"nega",fontColor:"4.thin",ssSphere:2,onClick:k=>{n(b=>f(l({},b),{eventType:"update",eventID:v(8),rawValue:[]}))},children:c(B.X,{})})]})})),c(R.Picker,l({},t))]})},SearchInput:t=>{let{rootStates:e,val_status:i,set_status:s}=t;if(e.disabled)return null;let d=!!i.isFocusing||!!i.isPickerOpen||!!i.rawValue.length;i.isFocusing||e.multiSelect||i.rawValue.length&&(d=!1);let m=e.searchInputPlaceholder||"\u691C\u7D22...";return c(X,{htmlTag:"input",id:"SearchInput_"+e.componentId,"data-input-value-shallow":i.componentId,placeholder:m,opacity:d?"max":"trans",transition:"middle",flexSizing:0,fontSize:"inherit",border:"0.trans",backgroundColor:"trans",isRounded:!0,padding:[0,"2/3"],value:t.val_keyword,className:[L("SearchInput"),d&&L("isActive")].join(" "),xcss:{outline:"none",minWidth:12*4},onFocus:o=>{s(n=>f(l({},n),{eventID:v(8),isFocusing:!0,isPickerOpen:!0}))},onBlur:o=>H(void 0,null,function*(){s(n=>f(l({},n),{eventID:v(8),isFocusing:!1}))}),onCompositionStart:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!0}))},onCompositionEnd:o=>{s(n=>f(l({},n),{eventID:v(8),isComposing:!1}))},onKeyDown:o=>{let{key:n,metaKey:p,ctrlKey:h}=o,O=p||h;n=="Escape"?s(r=>f(l({},r),{eventID:v(12),isPickerOpen:!1})):n=="Tab"?s(r=>f(l({},r),{eventID:v(8),isFocusing:!1,isPickerOpen:!1})):n==" "?a.scope(()=>{i.isPickerOpen||t.val_keyword||(o.preventDefault(),s(r=>f(l({},r),{eventID:v(8),isPickerOpen:!0})))}):n=="Backspace"?a.scope(()=>{if(t.val_keyword)return;let r=[...t.val_status.rawValue];r.pop(),O&&(r=[]),s(u=>f(l({},u),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1}))}):n=="Enter"&&a.scope(()=>{if(i.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!i.isPickerOpen){s(y=>f(l({},y),{eventID:v(8),isPickerOpen:!0}));return}if(!t.val_optionFocused)return;let r=t.val_options.find(y=>(y==null?void 0:y.id)==t.val_optionFocused);if(!r)return;let{value:u}=r;s(y=>{let S=[...y.rawValue];return a.scope(()=>{if(u===null)return S=[];y.rawValue.includes(u)?S=S.filter(I=>I!==u):e.multiSelect?S.push(u):S=[u]}),f(l({},y),{rawValue:S,eventType:"update",eventID:v(8),isInspected:!1})}),t.set_optionsModified(!0),t.set_keyword("")}),a.scope(()=>{if(!a.isOneOf(n,"ArrowDown","ArrowUp"))return;if(o.preventDefault(),!i.isPickerOpen){s(g=>f(l({},g),{eventID:v(8),isPickerOpen:!0}));return}let r=n=="ArrowDown"?1:-1,u=R.FilterSelectableOptions(t.val_options,t.val_keyword),y=u.length-1,S=null;a.scope(()=>{var I,x,C,P,E,w,D;let g=u.findIndex(_=>(_==null?void 0:_.id)==t.val_optionFocused);if(g==-1){S=(I=u[0])==null?void 0:I.id;return}if(r==1){if(S=(x=u[0])==null?void 0:x.id,O){S=(C=u[y])==null?void 0:C.id;return}if(g==-1||g==y)return;S=(P=u[g+1])==null?void 0:P.id}else{if(S=(E=u[y])==null?void 0:E.id,O){S=(w=u[0])==null?void 0:w.id;return}if(g==-1||g==0)return;S=(D=u[g-1])==null?void 0:D.id}}),t.set_optionFocused(S)}),e.enableFormSubmit&&z.SubmitForm(o,t.rootStates.form)},onChange:o=>{let p=o.target.value;t.set_keyword(p),t.set_optionFocused(""),p&&s(h=>f(l({},h),{eventID:v(8),isPickerOpen:!0}))}},"searchInput")},Picker:t=>{var n;let{rootStates:e,val_status:i}=t,[s,d]=A("idle");F(()=>{if(!e.onDynamicSearchOptions||!i.isPickerOpen)return;if(t.val_optionsModified)return t.set_optionsModified(!1);if(i.isComposing)return;d("fetch");let p="autocomplete-search-"+e.componentId;t.set_optionFocused(""),a.interval.once(()=>H(void 0,null,function*(){var r;let h=yield e.onDynamicSearchOptions(t.val_keyword);d("idle");let O=R.InitOptions(h||[]);t.set_options(O),t.set_optionFocused(((r=O[0])==null?void 0:r.id)||"")}),e.onDynamicSearchOptionsDelay||500,p)},[t.val_keyword,i.isComposing]),F(()=>{let p=a(`[data-selector-id="${i.componentId}"]`)[0];if(!p)return;let h=a(`[data-autocomplete-input-value="${t.val_optionFocused}"]`)[0];h&&(p.scrollTop=h.offsetTop-24)},[t.val_optionFocused]);let m=R.FilterSelectableOptions(t.val_options,e.onDynamicSearchOptions?"":t.val_keyword,!0),o={};{let p=e.pickerPosition||0;a.isOneOf(p,1,2)?o.bottom="100%":a.isOneOf(p,3,4)&&(o.top="100%"),a.isOneOf(p,1,3)?o.left=0:a.isOneOf(p,2,4)&&(o.right=0)}return i.isPickerOpen?c(X,f(l({position:"absolute",ssZIndex:1e3,padding:"1/3"},o),{xcss:l({minWidth:"75%"},o.xcss),children:c(ae.Body,f(l({className:L("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,tabIndex:-1,boxShadow:"1.normal",overflow:"auto","data-selector-id":i.componentId},e.pickerStyles),{xcss:l({maxHeight:12*24},(n=e.pickerStyles)==null?void 0:n.xcss),children:V(q,{gap:"1/12",padding:[1,0],children:[s=="fetch"&&c(M.Center,{padding:"1/2",children:c(le.Theme.R,{showInitial:!0})}),s!="fetch"&&V(N,{children:[!m.length&&c(K.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),m.map((p,h)=>{if(!p)return null;let{type:O,value:r}=p,u=t.val_optionFocused==p.id,y=i.rawValue.includes(r),S=e.onSelectorRender;return c(q,{"data-autocomplete-input-value":p.id,children:c(S,{option:p,isFocused:u,isSelected:y,onAdd:()=>{t.set_status(g=>{let I=[...g.rawValue];return a.scope(()=>{if(r===null)return I=[];if(g.rawValue.includes(r)){I=I.filter(C=>C!==r);return}e.multiSelect?I.push(r):I=[r]}),f(l({},g),{rawValue:I,eventType:"update",eventID:v(8),isFocusing:e.max!=I.length,isInspected:!1})})},onKeyDown:g=>{let{key:I}=g;I=="Tab"&&(t.set_optionFocused(""),t.set_status(x=>f(l({},x),{eventID:v(8),isPickerOpen:!1,isFocusing:!1})))}})},p.id)})]})]})}))})):null},Selected:t=>{let{rootStates:e,val_status:i,set_status:s,val_optionsDict:d}=t,m=[];return i.rawValue.forEach(o=>{let n=d[a.Stringify(o)];if(!n)return;let p=e.onSelectedRender,h=(n==null?void 0:n.selectedLabel)||(n==null?void 0:n.label);(n==null?void 0:n.value)===null&&(h=""),m.push(c(q,{position:"relative",flexCenter:!0,xcss:{userSelect:"none"},children:c(p,{value:n==null?void 0:n.value,label:h,onRemove:O=>{if(e.disabled)return;let r=[...i.rawValue];r=r.filter(u=>u!==o),s(u=>f(l({},u),{rawValue:r,eventType:"update",eventID:v(8),isInspected:!1,isFocusing:e.max!=r.length,isPickerOpen:!0}))}})},a.Stringify(n==null?void 0:n.value)||v(8)))}),c(N,{children:m})},Core:t=>{var C,P,E;let{value:e}=t,[i,s]=A(!1),[d,m]=A(""),[o,n]=A(t.options),[p,h]=A(((C=t.options.find(w=>{var D;return(w==null?void 0:w.value)===((D=t.value)==null?void 0:D[0])}))==null?void 0:C.id)||((P=t.options[0])==null?void 0:P.id)||""),[O,r]=A({}),[u,y]=A(z.DefaultStatus(t.componentId,e)),S=ne(!1);F(()=>{i||(S.current?n(t.options):S.current=!0)},[a.Stringify((E=t.options)==null?void 0:E.map(w=>w.value))]),F(()=>{if(!o.length)return;let w=[...o],D=l({},O);w.forEach(_=>{(_==null?void 0:_.type)!="label"&&(D[a.Stringify(_==null?void 0:_.value)]=_)}),r(D)},[o]);let g={rootStates:t,val_options:o,set_options:n,val_optionFocused:p,set_optionFocused:h,val_optionsDict:O,set_optionsDict:r,val_optionsModified:i,set_optionsModified:s,val_keyword:d,set_keyword:m,val_status:u,set_status:y},I=!!t.multiSelect;z.CommonEffects({type:I?"autocomplete.multi":"autocomplete.single",states:t,val_status:u,set_status:y,SystemValidation:pe});let x=u.rawValue.length&&u.rawValue[0]!==null||u.isPickerOpen||u.isFocusing;return V(se,{val_status:u,set_status:y,states:t,children:[c(ce,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:x,val_status:u}),c(R.Button,l({},g))]})}},Q=t=>{let e=l({},t);return e=f(l({value:[],min:0,max:65535,multiSelect:!0,emptySelect:!0,onSelectorRender:i=>{var s;return i.option?((s=i.option)==null?void 0:s.type)=="label"?c(N,{children:i.option.label}):c($.Sub.S,{color:"cloud",tabIndex:-1,backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["2/3",1.5],isActive:i.isFocused,isActiveStyles:{backgroundColor:"cloud"},onClick:i.onAdd,onKeyDown:i.onKeyDown,children:V(M.Left,{gap:"1/2",children:[i.isSelected&&c(B.Check,{fontColor:"theme"}),c(K.Supplement,{transition:"short",children:i.option.label})]})}):null},onSelectedRender:i=>V(M.Left,{ssCardBox:!0,borderRadius:"1.tone.primary",fontSize:"1.mini",padding:"1/3",gap:0,children:[c(K,{padding:[0,"1/2"],children:i.label}),c($.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,ssSphere:2,onClick:i.onRemove,xcss:{lineHeight:1,aspectRatio:"1/1"},children:c(B.X,{})})]}),pickerPosition:3},e),{xcss:l({cursor:"pointer"},e.xcss)}),e.multiSelect||(e.min=0,e.max=1),e.options=e.options||[],e.emptySelect&&(e.options=[{value:null,label:c(K.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...e.options]),e.value=a.Arrayify(e.value),e.options=R.InitOptions(e.options),a.isNullish(e.rightIcon)&&(e.rightIcon=c(G,{children:c(B.Search,{})}),e.disabled&&(e.rightIcon=c(G,{fontColor:"5.translucent",children:c(B.Ban,{})}))),e.rightIcon&&(e=l({paddingRight:3},e)),e.leftIcon&&(e=l({paddingLeft:3},e)),c(re,{componentId:e.componentId,children:R.Core,states:ue(e)})};export{Q as Autocomplete,Q as default};
|
package/dist/fn/Input/Color.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as a,d as v}from"../../chunk-C5N2D3ZX.js";import{jsx as d}from"react/jsx-runtime";import{UUID as m}from"jmini";import{useState as
|
|
1
|
+
import{b as n,c as a,d as v}from"../../chunk-C5N2D3ZX.js";import{jsx as d}from"react/jsx-runtime";import{UUID as m}from"jmini";import{useState as T}from"react";import x from"../../atoms/Box";import{OptionalInputWrapper as F,BoxWrapper as h,CoreEffects as c,DefaultBoxishStyles as w}from"./core";import{InputSwitchClasses as B}from"../../@styles/componentClasses";function S(e){let{value:r,states:I}=e,{required:p}=I,l=[];return p&&!r&&l.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!l.filter(({type:f})=>f=="invalid").length,notice:l}}const U=e=>{let g=e,{componentId:r,required:I,form:p,enableFormSubmit:l,showInitValidation:f,onChange:C,onKeyDown:y,onValidate:E,onValidateDelay:R,onUpdateValue:W,onUpdateValidValue:_,onUserAction:H,value:b=""}=g,t=v(g,["componentId","required","form","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value"]),[i,s]=T(c.DefaultStatus(e.componentId||"",b));return c.CommonEffects({type:"color",states:e,val_status:i,set_status:s,SystemValidation:S}),d(h,{val_status:i,set_status:s,states:e,children:d(x,n({htmlTag:"input",type:"color","data-component-id":i.componentId,value:i.rawValue,className:B("Input"),onKeyDown:o=>{y&&y(o),l&&c.SubmitForm(o,p)},onChange:o=>{let{value:u}=o.target;s(D=>a(n({},D),{rawValue:u,eventType:"update",eventID:m(12),isInspected:!1,isValidated:!1,notice:[]})),C&&C(o)},onFocus:o=>{t!=null&&t.onFocus&&(t==null||t.onFocus(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!0}))},onBlur:o=>{t!=null&&t.onBlur&&(t==null||t.onBlur(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!1}))}},t))})},V=e=>{let r=a(n(a(n({},w(e)),{backgroundColor:"cloud",unitHeight:3}),e),{xcss:n({minWidth:108},e.xcss)});return d(F,{componentId:e.componentId,children:U,states:r})};export{V as Color,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as
|
|
1
|
+
import{b as o,c as l,d as y}from"../../chunk-C5N2D3ZX.js";import{jsx as d}from"react/jsx-runtime";import{UUID as w}from"jmini";import{useState as R}from"react";import{OptionalInputWrapper as D,BoxWrapper as S,CoreEffects as s,DefaultBoxishStyles as g}from"./core";import{Box as B}from"../../atoms";function U(t){let{value:e,states:c}=t,{required:u}=c,n=[];return u&&!e&&n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!n.filter(({type:r})=>r=="invalid").length,notice:n}}const F=t=>{let f=t,{componentId:e,tone:c,required:u,form:n,value:r,enableFormSubmit:h,showInitValidation:T,onInput:m,onKeyDown:I,onValidate:H,onValidateDelay:L,onUpdateValue:M,onUpdateValidValue:_,onUserAction:W,children:x="",leftIndicator:q,rightIndicator:A,leftIcon:K,rightIcon:k,xcss:N,wrapStyles:O}=f,E=y(f,["componentId","tone","required","form","value","enableFormSubmit","showInitValidation","onInput","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","children","leftIndicator","rightIndicator","leftIcon","rightIcon","xcss","wrapStyles"]),[i,p]=R(s.DefaultStatus(e,r));return s.CommonEffects({type:"contenteditable",states:t,val_status:i,set_status:p,SystemValidation:U}),d(S,{val_status:i,set_status:p,states:t,children:d(B,l(o({contentEditable:!0,"data-show-validation":s.isShowValidation(i,!!T),"data-component-id":i.componentId,onKeyDown:a=>{I&&I(a),h&&s.SubmitForm(a,n)},onInput:a=>{let V=a.currentTarget,{innerHTML:z,innerText:C}=V;p(v=>l(o({},v),{rawValue:C,eventType:"update",eventID:w(12),isInspected:!1,isValidated:!1,notice:[]})),m&&m(a)}},E),{children:x}))})},b=t=>{t=l(o({rows:5},t),{xcss:o({whiteSpace:"pre-wrap"},t.xcss)});let e=g(t);return d(D,{componentId:t.componentId,children:F,states:e})};export{b as Contenteditable,b as default};
|
|
@@ -10,7 +10,7 @@ declare namespace DigitCharacters {
|
|
|
10
10
|
tabIndex?: number;
|
|
11
11
|
id?: string;
|
|
12
12
|
value?: string | number;
|
|
13
|
-
listStyles?: StyleProps.
|
|
13
|
+
listStyles?: StyleProps.StyleProps;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
declare const DigitCharacters: React.FC<DigitCharacters.Input>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as o,d as T}from"../../chunk-C5N2D3ZX.js";import{jsx as
|
|
1
|
+
import{b as t,c as o,d as T}from"../../chunk-C5N2D3ZX.js";import{jsx as x}from"react/jsx-runtime";import{useState as P}from"react";import V,{UUID as g}from"jmini";import{$$fromRoot as _,GenerateHTMLProps as K}from"../../@utils";import{OptionalInputWrapper as U,BoxWrapper as W,CoreEffects as F,DefaultBoxishStyles as k}from"./core";import{Flex as $}from"../../atoms";import{InputClasses as R}from"../../@styles/componentClasses";function z(e){let{value:n,states:u}=e,{required:d,numericOnly:p=!1,digits:D}=u,r=[];return d&&!n&&r.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),n&&(p&&n.match(/\D/)&&r.push({type:"invalid",label:"\u6570\u5B57\u306E\u307F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),n.length!=D&&r.push({type:"warn",label:"\u6700\u5F8C\u307E\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"})),{ok:!r.filter(({type:h})=>h=="invalid"||h=="warn").length,notice:r}}const q=(e,n="")=>{let u=String(n),d=[];for(let p=0;p<e;p++)d[p]=u[p]||"";return{safeValue:d,rawValue:u}},B=(e="")=>{let n=e,u=n.join("");return{safeValue:n,rawValue:u}},X=e=>{let S=e,{tone:n,required:u,form:d,name:p,className:D="",digits:r,numericOnly:C=!1,enableFormSubmit:h,showInitValidation:j,onChange:G,onKeyDown:J,onValidate:Q,onValidateDelay:Y,onUpdateValue:Z,onUpdateValidValue:ee,onUserAction:te,value:A="",override:ne,xcss:ae,wrapStyles:ie,combineInput:se,componentId:re,listStyles:E}=S,a=T(S,["tone","required","form","name","className","digits","numericOnly","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","override","xcss","wrapStyles","combineInput","componentId","listStyles"]),[c,f]=P(()=>o(t({componentId:e.componentId||""},q(r,A)),{eventType:"init",eventID:g(12)}));F.CommonEffects({type:"textfield",states:e,val_status:c,set_status:f,SystemValidation:z});let b=[];for(let i=0;i<r;i++){let M=c.safeValue[i],H={},v=D;e.combineInput&&(v=[D,R("DigitCharacterCell"),R("Combined")].join(" ")),b.push(x("input",{type:"text",inputMode:C?"numeric":e.inputMode||"text",value:M,id:"Digit-"+i+"-"+c.componentId,className:v,style:t(t({},e.style),H),onKeyDown:m=>{let{key:l,code:L}=m;if(l=="Tab")return;m.preventDefault();let y=null;if(l=="Backspace"){let s=c.safeValue;s[i]="",f(I=>o(t(t({},I),B(s)),{eventType:"update",eventID:g(12),isInspected:!1})),y=i-1}else if(V.isOneOf(l,"ArrowLeft","ArrowRight")){let s=+(l=="ArrowRight")*2-1;y=i+s}else h&&F.SubmitForm(m,d),(()=>{let s=L.match(/^(Key(.)|Digit(\d)|Numpad(\d))/);if(!s)return;let I=s[2]||s[3]||s[4];if(C&&!I.match(/\d/)||!I)return;let w=c.safeValue;w[i]=I,f(N=>o(t(t({},N),B(w)),{eventType:"update",eventID:g(12),isInspected:!1})),y=i+1})();V.isExist(y)&&_("#Digit-"+y+"-"+c.componentId).focus()},onChange:()=>{},onFocus:m=>{a!=null&&a.onFocus&&(a==null||a.onFocus(m)),f(l=>o(t({},l),{eventID:g(12),isFocusing:!0}))},onBlur:m=>{a!=null&&a.onBlur&&(a==null||a.onBlur(m)),f(l=>o(t({},l),{eventID:g(12),isFocusing:!1}))}},i))}return x(W,{val_status:c,set_status:f,states:e,children:x($,o(t({gap:"1/2",flexChilds:"even",flexWrap:!1,flexSizing:"auto"},E),{children:b}))})},O=e=>{e=t({},e),e=t({textAlign:"center",width:0},e),e.combineInput&&(e=o(t({textAlign:"center",width:0},e),{xcss:t({minWidth:12*2,marginRight:-1},e.xcss),listStyles:t({borderRadius:"2.tone.secondary",border:"unset",gap:0},e.listStyles)}));let n=K(k(e));return x(U,{componentId:e.componentId,children:X,states:n})};export{O as DigitCharacters,O as default};
|
package/dist/fn/Input/Drum.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ declare namespace Drum {
|
|
|
27
27
|
rootStates: Input & {
|
|
28
28
|
value: Value[];
|
|
29
29
|
};
|
|
30
|
-
val_status: InputTypes.Status
|
|
31
|
-
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status
|
|
30
|
+
val_status: InputTypes.Status<Value>;
|
|
31
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status>>;
|
|
32
32
|
};
|
|
33
33
|
type Component = {
|
|
34
34
|
<T = Value>(p: Input<Value<T>>): React.JSX.Element;
|
package/dist/fn/Input/Drum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as a,c as p,d as _}from"../../chunk-C5N2D3ZX.js";import{Fragment as G,jsx as r,jsxs as W}from"react/jsx-runtime";import x,{UUID as I}from"jmini";import{useState as k,useEffect as H}from"react";import{$$fromRoot as $}from"../../@utils";import{Box as v,Column as j,CacheRender as q}from"../../atoms";import{Button as N}from"../Button";import{OptionalInputWrapper as Z,BoxWrapper as X,CoreEffects as V,DefaultBoxishStyles as J}from"./core";function Y(o){let{value:e,states:n}=o,{required:l}=n,t=[];return l&&e===null&&t.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!t.filter(({type:u})=>u=="invalid").length,notice:t}}const f={Original:o=>{let{rootStates:e,val_status:n,set_status:l}=o,C=e,{required:t,form:u,className:d,isHorizontal:s,enableFormSubmit:E,showInitValidation:z,onValidate:K,onValidateDelay:Q,onUpdateValue:ee,onUpdateValidValue:te,onUserAction:oe,value:ne="",options:D,componentId:R,status_id:ae,wrapStyles:re}=C,B=_(C,["required","form","className","isHorizontal","enableFormSubmit","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","componentId","status_id","wrapStyles"]),[i,A]=k(null);return H(()=>{let c=$(`[data-component-id="${R}"]`);if(!c[0])return;A(c[0]);let h="onscrollend"in window,y="scroll.Drum-"+R,g=h?50:150;return c.onEvent(h&&"scrollend"||"scroll",S=>{x.interval.once(()=>{let{top:m,left:L,width:M,height:P}=c.position();const b=document.elementFromPoint(L+M/2,m+P/2);if(!b||!b.id)return;let[F,le,U]=b.id.split("-");if(F!=n.componentId)return;let w=D[Number(U)];w&&l(T=>T.rawValue==w.value?p(a({},T),{eventID:I(12)}):p(a({},T),{rawValue:w.value,eventType:"update",eventID:I(12),isInspected:!1,isValidated:!1,notice:[]}))},g,"update-drum-input-value")},{eventID:y}),()=>{c.removeEvent(y)}},[]),H(()=>{if(!i)return;let c=D.findIndex(m=>(m==null?void 0:m.value)==n.rawValue);if(c===-1)return;let h=x("#"+[n.componentId,"opt",c].join("-"))[0];if(!h)return;let y=i.position(),g=h.position();if(s){let m=h.offsetLeft-y.width/2+g.width/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({left:m,behavior:"smooth"});return}i.scrollLeft=m;return}let S=h.offsetTop-y.height/2+g.height/2;if(n.eventType=="update"||n.eventType=="override"){i==null||i.scroll({top:S,behavior:"smooth"});return}i.scrollTop=S},[i,n.rawValue]),W(j,p(a({gap:"1/4",tabIndex:0,position:"relative"},B),{"data-disabled":e.disabled,"data-show-validation":V.isShowValidation(n,!!z),"data-component-id":n.componentId,"data-input-origin":n.componentId,children:[r(f.Marker,p(a({},o),{val_parent:i})),r(f.EdgePadding,{}),r(f.Options,a({},o)),r(f.EdgePadding,{})]}))},Options:o=>{let{rootStates:e,val_status:n,set_status:l}=o;return r(G,{children:e.options.map((t,u)=>{if(!t)return null;let d=x.isEqual(t==null?void 0:t.value,n.rawValue);return t.type=="label"?r(v,{children:t.label||t.value},I(12)):r(q,{params:{value:t.value,isSelected:d},forceRender:(s,E)=>s.isSelected!=E.isSelected,children:r(N.Clear,{id:[n.componentId,"opt",u].join("-"),tabIndex:-1,padding:"1/2",color:"cloud",border:"0.trans",ssEffectsOnActive:!1,isActive:d,isActiveStyles:{isSemiBoldFont:!0},xcss:{scrollSnapAlign:"center"},onClick:()=>{d||l(s=>p(a({},s),{rawValue:t.value,eventType:"update",eventID:I(12),isInspected:!1,isValidated:!1,notice:[]}))},children:t.label||t.value})},[u,t==null?void 0:t.value].join("-"))})})},Marker:o=>{let{rootStates:e,val_parent:n,val_status:l}=o,t=!e.isHorizontal;if(!n)return null;let u=e.options.findIndex(s=>(s==null?void 0:s.value)==l.rawValue);if(u===-1)return null;let d=x("#"+[l.componentId,"opt",u].join("-"))[0];return d?r(v,p(a({flexSizing:"none",transition:"short",position:"sticky"},t?{height:0}:{width:0}),{flexCenter:!0,ssZIndex:3,xcss:a({pointerEvents:"none"},t?{top:"50%",transform:"translateY(-50%)"}:{left:"50%",transform:"translateX(-50%)"}),children:r(v,{transition:"short",boxShadow:"0.remark",borderRadius:"2.tone.secondary",backgroundColor:"theme.opa.few",border:!0,borderColor:"theme",flexSizing:"none",xcss:{height:d.position().height||0,width:d.position().width||0}})})):null},EdgePadding:()=>r(v,{flexSizing:"none",xcss:{width:"50%",height:"50%",pointerEvents:"none"}}),EdgeShadow:o=>o.position=="top"||o.position=="bottom"?r(v,{position:"absolute",borderRadius:"1.tone.primary",ssZIndex:10,gradients:{deg:o.position=="top"?0:180,colors:["hsla(var(--color-layer0-hsl),0)","hsla(var(--color-layer0-hsl),.8)"]},xcss:{[o.position]:1,left:1,right:1,height:"35%",pointerEvents:"none"}}):r(v,{position:"absolute",borderRadius:"1.tone.primary",ssZIndex:10,xcss:{[o.position]:1,top:1,bottom:1,width:"35%",pointerEvents:"none"}}),Core:o=>{let[e,n]=k(V.DefaultStatus(o.componentId,o.value)),l={rootStates:o,val_status:e,set_status:n};return V.CommonEffects({type:"drum",states:o,val_status:e,set_status:n,SystemValidation:Y}),W(X,{val_status:e,set_status:n,states:o,children:[r(f.EdgeShadow,{position:o.isHorizontal?"left":"top"}),r(f.Original,a({},l)),r(f.EdgeShadow,{position:o.isHorizontal?"right":"bottom"})]})}},O=o=>{var n,l;let e=a({},o);return e=a({padding:"1/2",overflow:"auto"},e),e.isHorizontal?e=p(a({flexType:"row",flexWrap:!1},e),{xcss:a({whiteSpace:"nowrap",scrollSnapType:"x mandatory",maxWidth:12*24},e.xcss)}):e=p(a({},e),{xcss:a({scrollSnapType:"y mandatory",maxHeight:12*20,minWidth:12*6},e.xcss)}),e.value=(n=e.value)!=null?n:null,(l=e.options)==null||l.forEach((t,u)=>{if(!t)return;let{type:d,value:s}=t;e.options[u]=p(a({id:I(12)},t),{value:s,type:d||"selector"})}),r(Z,{componentId:e.componentId,children:f.Core,states:J(e)})};export{O as Drum,O as default};
|
package/dist/fn/Input/Filer.d.ts
CHANGED
|
@@ -23,14 +23,14 @@ declare namespace Filer {
|
|
|
23
23
|
rootStates: Input & {
|
|
24
24
|
limit: number;
|
|
25
25
|
};
|
|
26
|
-
val_status: InputTypes.Status
|
|
27
|
-
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status
|
|
26
|
+
val_status: InputTypes.Status<CustomFile[]>;
|
|
27
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status<CustomFile[]>>>;
|
|
28
28
|
};
|
|
29
29
|
type ListCellInput = WrapperStates & {
|
|
30
30
|
index: number;
|
|
31
31
|
val_file: File;
|
|
32
|
-
val_status: InputTypes.Status
|
|
33
|
-
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status
|
|
32
|
+
val_status: InputTypes.Status<CustomFile[]>;
|
|
33
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status<CustomFile[]>>>;
|
|
34
34
|
};
|
|
35
35
|
namespace Methods {
|
|
36
36
|
type Component = React.FC<Input>;
|