amotify 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@declaration/_.js +1 -1
- package/dist/@declaration/property.d.ts +2 -2
- package/dist/@styles/componentClasses/_.css +66 -65
- package/dist/@styles/componentClasses/_.js +39 -39
- package/dist/@styles/index.css +66 -65
- package/dist/@styles/index.js +39 -39
- package/dist/@styles/init.css +1 -1
- package/dist/@styles/style.css +96 -65
- package/dist/@styles/style.js +39 -39
- package/dist/@styles/var.css +1 -1
- package/dist/@utils/GenerateClassName.js +1 -470
- package/dist/@utils/LaunchReactApp.d.ts +1 -1
- package/dist/@utils/LaunchReactApp.js +1 -78
- package/dist/@utils/_.js +1 -12
- package/dist/@utils/collectForm.js +1 -96
- package/dist/@utils/color.js +1 -103
- package/dist/@utils/config.js +1 -101
- package/dist/@utils/fin.js +1 -39
- package/dist/@utils/getElement.js +1 -13
- package/dist/@utils/jsminEx.js +1 -172
- package/dist/@utils/pageTransit.js +1 -33
- package/dist/@utils/useRecycle.js +1 -44
- package/dist/@utils/useStore.js +1 -54
- package/dist/atoms/Box.js +1 -20
- package/dist/atoms/FAI.js +1 -148
- package/dist/atoms/Flex.js +1 -34
- package/dist/atoms/Grid.js +1 -17
- package/dist/atoms/Img.js +1 -65
- package/dist/atoms/Logo.js +51 -359
- package/dist/atoms/P.js +1 -20
- package/dist/atoms/Placeholder.js +1 -44
- package/dist/atoms/Span.js +1 -20
- package/dist/atoms/_.js +1 -9
- package/dist/fn/Button.js +1 -316
- package/dist/fn/Cropper.js +1 -1009
- package/dist/fn/Effect/Fade.js +1 -88
- package/dist/fn/Effect/Pudding.js +1 -22
- package/dist/fn/Effect/Ripple.js +3 -117
- package/dist/fn/Effect/_.js +1 -14
- package/dist/fn/Input/AutoHeightText.js +1 -112
- package/dist/fn/Input/Checker.js +1 -36
- package/dist/fn/Input/Chips/Selector.js +1 -472
- package/dist/fn/Input/Chips/_.js +1 -349
- package/dist/fn/Input/Contenteditable.js +1 -160
- package/dist/fn/Input/DigitCharacters.js +1 -275
- package/dist/fn/Input/Filer.js +1 -619
- package/dist/fn/Input/Hidden.js +1 -48
- package/dist/fn/Input/List.js +1 -450
- package/dist/fn/Input/Parts.js +1 -121
- package/dist/fn/Input/Plain.js +1 -12
- package/dist/fn/Input/RichSelect.js +1 -279
- package/dist/fn/Input/Search.js +1 -53
- package/dist/fn/Input/Segmented.js +1 -245
- package/dist/fn/Input/Select.js +1 -278
- package/dist/fn/Input/Slider.js +1 -538
- package/dist/fn/Input/Switch.js +1 -221
- package/dist/fn/Input/Text.js +1 -626
- package/dist/fn/Input/TextArea.js +1 -151
- package/dist/fn/Input/Time/Picker.js +1 -1457
- package/dist/fn/Input/Time/_.js +1 -867
- package/dist/fn/Input/_.js +1 -48
- package/dist/fn/Input/core.js +1 -626
- package/dist/fn/Layout/PageNotFound.js +1 -90
- package/dist/fn/Layout/PageRouter.js +1 -87
- package/dist/fn/Layout/PageViewController.js +1 -29
- package/dist/fn/Layout/Plate.js +1 -37
- package/dist/fn/Layout/RootViewController.js +1 -315
- package/dist/fn/Layout/SwipeView.js +1 -348
- package/dist/fn/Layout/TabBar.js +1 -72
- package/dist/fn/Layout/_.js +1 -22
- package/dist/fn/Loader/_.js +1 -104
- package/dist/fn/Loader/corner.js +1 -85
- package/dist/fn/Loader/mini.js +1 -125
- package/dist/fn/Loader/top.js +1 -73
- package/dist/fn/Sheet.d.ts +1 -0
- package/dist/fn/Sheet.js +1 -1101
- package/dist/fn/Snackbar.js +1 -216
- package/dist/fn/Table/Data.js +1 -974
- package/dist/fn/Table/Drag.js +1 -435
- package/dist/fn/Table/Normal.js +1 -136
- package/dist/fn/Table/Parts.js +1 -41
- package/dist/fn/Table/Wrapper.js +1 -60
- package/dist/fn/Table/_.js +1 -16
- package/dist/fn/Table/cellStyling.js +1 -51
- package/dist/fn/Tooltips.js +1 -58
- package/dist/fn/_.js +1 -10
- package/dist/index.js +1 -20
- package/dist/mols/Accordion.js +1 -152
- package/dist/mols/Column.js +1 -16
- package/dist/mols/LinkifyText.js +1 -42
- package/dist/mols/List.js +1 -42
- package/dist/mols/Row.js +1 -47
- package/dist/mols/Text.js +1 -67
- package/dist/mols/_.js +1 -6
- package/dist/temps/_.js +1 -1
- package/dist/temps/designBook.js +20 -3639
- package/package.json +1 -1
- package/dist/chunk-JJ3PEWPN.js +0 -60
|
@@ -1,472 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async,
|
|
3
|
-
__objRest,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-JJ3PEWPN.js";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
useState,
|
|
10
|
-
useEffect,
|
|
11
|
-
useRef
|
|
12
|
-
} from "react";
|
|
13
|
-
import {
|
|
14
|
-
$$,
|
|
15
|
-
$$fromRoot,
|
|
16
|
-
useStore
|
|
17
|
-
} from "../../../@utils/_";
|
|
18
|
-
import Box from "../../../atoms/Box";
|
|
19
|
-
import FAI from "../../../atoms/FAI";
|
|
20
|
-
import Span from "../../../atoms/Span";
|
|
21
|
-
import Column from "../../../mols/Column";
|
|
22
|
-
import Row from "../../../mols/Row";
|
|
23
|
-
import Button from "../../Button";
|
|
24
|
-
import Sheet from "../../Sheet";
|
|
25
|
-
import Loader from "../../Loader/_";
|
|
26
|
-
import Text from "../Text";
|
|
27
|
-
import Parts from "../Parts";
|
|
28
|
-
import { InputChipsClasses } from "../../../@styles/componentClasses/_";
|
|
29
|
-
const Component = (params) => {
|
|
30
|
-
let [val_status, set_status] = useState("show");
|
|
31
|
-
let [val_keyword, set_keyword] = useState("");
|
|
32
|
-
let [val_componentID] = useState($$.uuid.gen());
|
|
33
|
-
let [val_options, set_options] = useState(params.options);
|
|
34
|
-
let [val_focus, set_focus] = useState(val_options[0] || null);
|
|
35
|
-
let [val_selected, set_selected] = useState(params.selected);
|
|
36
|
-
let [val_keyEvent, set_keyEvent] = useState("init");
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
useStore.set({
|
|
39
|
-
key: params.selectorID,
|
|
40
|
-
value: {
|
|
41
|
-
updateOptions: (options) => {
|
|
42
|
-
set_options(options);
|
|
43
|
-
},
|
|
44
|
-
updateSelected: (selected) => {
|
|
45
|
-
set_selected(selected);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}, []);
|
|
50
|
-
const mountedOptions = useRef(false);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (mountedOptions.current) {
|
|
53
|
-
Sheet.reposition(params.selectorID);
|
|
54
|
-
} else {
|
|
55
|
-
mountedOptions.current = true;
|
|
56
|
-
}
|
|
57
|
-
}, [val_options]);
|
|
58
|
-
const mountedKeyword = useRef(false);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
if (mountedKeyword.current) {
|
|
61
|
-
set_status("interlude");
|
|
62
|
-
set_focus(val_options[0] || null);
|
|
63
|
-
if (params.onDynamicSearch) {
|
|
64
|
-
$$.interval.clear(val_componentID + "-dynamicSearch");
|
|
65
|
-
$$.interval.standBy(
|
|
66
|
-
val_componentID + "-dynamicSearch",
|
|
67
|
-
400,
|
|
68
|
-
() => __async(void 0, null, function* () {
|
|
69
|
-
let {
|
|
70
|
-
options
|
|
71
|
-
} = yield params.onDynamicSearch(val_keyword);
|
|
72
|
-
set_options(options);
|
|
73
|
-
set_status("show");
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
} else {
|
|
77
|
-
$$.interval.clear(val_componentID + "-staticSearch");
|
|
78
|
-
$$.interval.standBy(
|
|
79
|
-
val_componentID + "-staticSearch",
|
|
80
|
-
400,
|
|
81
|
-
() => __async(void 0, null, function* () {
|
|
82
|
-
let regExp = new RegExp(val_keyword, "ig");
|
|
83
|
-
let newSelection = [];
|
|
84
|
-
[...params.options].forEach((o) => {
|
|
85
|
-
var _a;
|
|
86
|
-
let match = Boolean(!val_keyword || ((_a = String(o.label)) != null ? _a : String(o.value)).match(regExp));
|
|
87
|
-
if (match)
|
|
88
|
-
newSelection.push(o);
|
|
89
|
-
});
|
|
90
|
-
set_options(newSelection);
|
|
91
|
-
set_status("show");
|
|
92
|
-
})
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
mountedKeyword.current = true;
|
|
97
|
-
}
|
|
98
|
-
}, [val_keyword]);
|
|
99
|
-
const mountedSelected = useRef(false);
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
if (mountedSelected.current) {
|
|
102
|
-
params.onUpdated({
|
|
103
|
-
values: val_selected
|
|
104
|
-
});
|
|
105
|
-
} else {
|
|
106
|
-
mountedSelected.current = true;
|
|
107
|
-
}
|
|
108
|
-
}, [val_selected]);
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
$$.scope(() => {
|
|
111
|
-
if ($$.is.nullish(val_focus))
|
|
112
|
-
return;
|
|
113
|
-
if (val_keyEvent == "MouseEvent")
|
|
114
|
-
return;
|
|
115
|
-
let Wrapper = $$fromRoot("#" + val_componentID + "-Selector-Cell-Wrap");
|
|
116
|
-
if (!Wrapper[0])
|
|
117
|
-
return;
|
|
118
|
-
let focusCell = $$fromRoot('[data-chips-selector-cell="' + val_componentID + "-" + JSON.stringify((val_focus == null ? void 0 : val_focus.value) || "").replace(/\"/ig, "") + '"]');
|
|
119
|
-
if (!focusCell[0])
|
|
120
|
-
return;
|
|
121
|
-
let { top: pTop, height: pHeight } = Wrapper.position();
|
|
122
|
-
let { top: cTop, height: cHeight } = focusCell.position();
|
|
123
|
-
if (pTop <= cTop && cTop + cHeight <= pTop + pHeight)
|
|
124
|
-
return;
|
|
125
|
-
let scroll = Wrapper[0].scrollTop + (cTop - pTop);
|
|
126
|
-
if (val_keyEvent == "ArrowDown") {
|
|
127
|
-
scroll -= pHeight - cHeight - 20;
|
|
128
|
-
} else if (val_keyEvent == "ArrowUp") {
|
|
129
|
-
scroll -= 20;
|
|
130
|
-
}
|
|
131
|
-
Wrapper[0].scrollTop = scroll;
|
|
132
|
-
});
|
|
133
|
-
}, [val_focus]);
|
|
134
|
-
let List = [];
|
|
135
|
-
if (val_status == "interlude") {
|
|
136
|
-
List = [/* @__PURE__ */ jsxs(
|
|
137
|
-
Row.Center,
|
|
138
|
-
{
|
|
139
|
-
padding: 2,
|
|
140
|
-
gap: 0,
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ jsx(
|
|
143
|
-
Loader.Theme.R,
|
|
144
|
-
{
|
|
145
|
-
showInitial: true
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
Box,
|
|
150
|
-
{
|
|
151
|
-
padding: [0, 1],
|
|
152
|
-
fontSize: "1.mini",
|
|
153
|
-
fontColor: "4.thin",
|
|
154
|
-
children: "\u691C\u7D22\u4E2D..."
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
)];
|
|
160
|
-
} else {
|
|
161
|
-
List = [
|
|
162
|
-
val_options.map((option, index) => {
|
|
163
|
-
let {
|
|
164
|
-
value,
|
|
165
|
-
label
|
|
166
|
-
} = option;
|
|
167
|
-
let safeValue = String(JSON.stringify(value));
|
|
168
|
-
let findIndex = val_selected.findIndex((v) => JSON.stringify(v.value) == safeValue);
|
|
169
|
-
let isSelected = findIndex != -1;
|
|
170
|
-
let isFocused = JSON.stringify((val_focus == null ? void 0 : val_focus.value) || "") == safeValue;
|
|
171
|
-
let styles = {};
|
|
172
|
-
if (isSelected || isFocused) {
|
|
173
|
-
styles = {
|
|
174
|
-
fontColor: "theme",
|
|
175
|
-
isSemiBoldFont: true
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
if (isFocused)
|
|
179
|
-
styles.backgroundColor = "cloud";
|
|
180
|
-
if (isSelected)
|
|
181
|
-
styles.backgroundColor = "tcOpFew";
|
|
182
|
-
return /* @__PURE__ */ jsx(
|
|
183
|
-
Button.Button.Clear.R,
|
|
184
|
-
__spreadProps(__spreadValues({
|
|
185
|
-
borderRadius: "3.tone.tertiary",
|
|
186
|
-
color: "cloud",
|
|
187
|
-
padding: "1/3",
|
|
188
|
-
tabIndex: -1,
|
|
189
|
-
textAlign: "left",
|
|
190
|
-
"data-chips-selector-cell": val_componentID + "-" + safeValue.replace(/\"/ig, ""),
|
|
191
|
-
isActive: isSelected || isFocused,
|
|
192
|
-
isActiveStyles: styles
|
|
193
|
-
}, styles), {
|
|
194
|
-
onMouseOver: () => {
|
|
195
|
-
set_keyEvent("MouseEvent");
|
|
196
|
-
set_focus(option);
|
|
197
|
-
},
|
|
198
|
-
onClick: () => {
|
|
199
|
-
let newSelected = [...val_selected];
|
|
200
|
-
if (isSelected) {
|
|
201
|
-
newSelected.splice(findIndex, 1);
|
|
202
|
-
} else {
|
|
203
|
-
newSelected = [
|
|
204
|
-
...newSelected,
|
|
205
|
-
option
|
|
206
|
-
];
|
|
207
|
-
if (params.limit && newSelected.length > params.limit) {
|
|
208
|
-
newSelected.shift();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
set_selected(newSelected);
|
|
212
|
-
},
|
|
213
|
-
children: /* @__PURE__ */ jsx(
|
|
214
|
-
params.SelectorCellComponent,
|
|
215
|
-
{
|
|
216
|
-
isSelected,
|
|
217
|
-
isFocused,
|
|
218
|
-
value,
|
|
219
|
-
label
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
}),
|
|
223
|
-
index
|
|
224
|
-
);
|
|
225
|
-
})
|
|
226
|
-
];
|
|
227
|
-
}
|
|
228
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
229
|
-
/* @__PURE__ */ jsxs(
|
|
230
|
-
Column,
|
|
231
|
-
{
|
|
232
|
-
padding: "2/3",
|
|
233
|
-
gap: "2/3",
|
|
234
|
-
borderBottom: true,
|
|
235
|
-
children: [
|
|
236
|
-
/* @__PURE__ */ jsxs(Row.Separate, { children: [
|
|
237
|
-
/* @__PURE__ */ jsx(
|
|
238
|
-
Text.Normal,
|
|
239
|
-
{
|
|
240
|
-
value: val_keyword,
|
|
241
|
-
onUpdateValidValue: ({ value }) => {
|
|
242
|
-
set_keyword(value);
|
|
243
|
-
},
|
|
244
|
-
id: params.selectorID + "-KeywordInput",
|
|
245
|
-
padding: "2/3",
|
|
246
|
-
placeholder: "\u691C\u7D22...",
|
|
247
|
-
leftIcon: /* @__PURE__ */ jsx(
|
|
248
|
-
Parts.LeftIcon,
|
|
249
|
-
{
|
|
250
|
-
right: "2/3",
|
|
251
|
-
fontSize: "1.mini",
|
|
252
|
-
fontColor: "3.blur",
|
|
253
|
-
children: /* @__PURE__ */ jsx(FAI.Search, {})
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
onKeyDown: (event) => {
|
|
257
|
-
let {
|
|
258
|
-
key,
|
|
259
|
-
metaKey,
|
|
260
|
-
ctrlKey
|
|
261
|
-
} = event;
|
|
262
|
-
let auxKey = metaKey || ctrlKey;
|
|
263
|
-
if (["ArrowDown", "ArrowUp"].includes(key)) {
|
|
264
|
-
let dir = Number(key == "ArrowDown") * 2 - 1;
|
|
265
|
-
if (auxKey) {
|
|
266
|
-
let next = val_options[dir == 1 ? val_options.length - 1 : 0];
|
|
267
|
-
set_focus(next);
|
|
268
|
-
} else {
|
|
269
|
-
let nextIndex = val_options.findIndex((v) => JSON.stringify(v.value) == JSON.stringify((val_focus == null ? void 0 : val_focus.value) || "")) + dir;
|
|
270
|
-
if (val_options[nextIndex]) {
|
|
271
|
-
set_focus(val_options[nextIndex]);
|
|
272
|
-
} else {
|
|
273
|
-
set_focus(val_options[dir == 1 ? 0 : val_options.length - 1] || null);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} else if (key == "Enter") {
|
|
277
|
-
let selectedIndex = val_selected.findIndex((v) => JSON.stringify(v.value) == JSON.stringify((val_focus == null ? void 0 : val_focus.value) || ""));
|
|
278
|
-
let isSelected = selectedIndex != -1;
|
|
279
|
-
let newSelected = [...val_selected];
|
|
280
|
-
if (isSelected) {
|
|
281
|
-
newSelected.splice(selectedIndex, 1);
|
|
282
|
-
} else {
|
|
283
|
-
let optionsIndex = val_options.findIndex((v) => JSON.stringify(v.value) == JSON.stringify((val_focus == null ? void 0 : val_focus.value) || ""));
|
|
284
|
-
if (optionsIndex == -1)
|
|
285
|
-
return;
|
|
286
|
-
newSelected = [
|
|
287
|
-
...newSelected,
|
|
288
|
-
val_options[optionsIndex]
|
|
289
|
-
];
|
|
290
|
-
if (params.limit && newSelected.length > params.limit) {
|
|
291
|
-
newSelected.shift();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
set_selected(newSelected);
|
|
295
|
-
}
|
|
296
|
-
set_keyEvent(key);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
),
|
|
300
|
-
/* @__PURE__ */ jsx(
|
|
301
|
-
Button.Button.Border.S,
|
|
302
|
-
{
|
|
303
|
-
marginRight: "1/3",
|
|
304
|
-
ssSphere: 2,
|
|
305
|
-
backgroundColor: "cloud",
|
|
306
|
-
borderRadius: "2.tone.secondary",
|
|
307
|
-
onClick: () => {
|
|
308
|
-
Sheet.close(params.selectorID);
|
|
309
|
-
},
|
|
310
|
-
children: /* @__PURE__ */ jsx(FAI.Times, {})
|
|
311
|
-
}
|
|
312
|
-
)
|
|
313
|
-
] }),
|
|
314
|
-
/* @__PURE__ */ jsxs(Row.Separate, { children: [
|
|
315
|
-
/* @__PURE__ */ jsxs(
|
|
316
|
-
Row.Left,
|
|
317
|
-
{
|
|
318
|
-
gap: "1/2",
|
|
319
|
-
verticalAlign: "baseline",
|
|
320
|
-
children: [
|
|
321
|
-
/* @__PURE__ */ jsx(
|
|
322
|
-
Span,
|
|
323
|
-
{
|
|
324
|
-
fontColor: "theme",
|
|
325
|
-
children: val_options.length
|
|
326
|
-
}
|
|
327
|
-
),
|
|
328
|
-
/* @__PURE__ */ jsx(
|
|
329
|
-
Box,
|
|
330
|
-
{
|
|
331
|
-
fontSize: "1.mini",
|
|
332
|
-
fontColor: "3.blur",
|
|
333
|
-
children: "\u4EF6\u306E\u30D2\u30C3\u30C8"
|
|
334
|
-
}
|
|
335
|
-
)
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
),
|
|
339
|
-
/* @__PURE__ */ jsx(Row.Right, { children: !!params.limit && /* @__PURE__ */ jsxs(
|
|
340
|
-
Span,
|
|
341
|
-
{
|
|
342
|
-
fontColor: "3.blur",
|
|
343
|
-
fontSize: "1.mini",
|
|
344
|
-
children: [
|
|
345
|
-
/* @__PURE__ */ jsx(
|
|
346
|
-
Span,
|
|
347
|
-
{
|
|
348
|
-
fontSize: "3.paragraph",
|
|
349
|
-
fontColor: "theme",
|
|
350
|
-
isSemiBoldFont: true,
|
|
351
|
-
children: val_selected.length
|
|
352
|
-
}
|
|
353
|
-
),
|
|
354
|
-
" / ",
|
|
355
|
-
params.limit,
|
|
356
|
-
" \u4EF6"
|
|
357
|
-
]
|
|
358
|
-
}
|
|
359
|
-
) })
|
|
360
|
-
] })
|
|
361
|
-
]
|
|
362
|
-
}
|
|
363
|
-
),
|
|
364
|
-
/* @__PURE__ */ jsx(
|
|
365
|
-
Column,
|
|
366
|
-
{
|
|
367
|
-
gap: "1/4",
|
|
368
|
-
padding: "1/2",
|
|
369
|
-
overflow: "auto",
|
|
370
|
-
freeCSS: {
|
|
371
|
-
maxHeight: 12 * 26,
|
|
372
|
-
maxWidth: 12 * 26
|
|
373
|
-
},
|
|
374
|
-
id: val_componentID + "-Selector-Cell-Wrap",
|
|
375
|
-
className: InputChipsClasses("SelectorWrapper"),
|
|
376
|
-
children: List
|
|
377
|
-
}
|
|
378
|
-
),
|
|
379
|
-
params.bottomContent
|
|
380
|
-
] });
|
|
381
|
-
};
|
|
382
|
-
const Selector = {
|
|
383
|
-
openSelector: (params) => {
|
|
384
|
-
let _a = params, {
|
|
385
|
-
selectorID,
|
|
386
|
-
options,
|
|
387
|
-
selected,
|
|
388
|
-
limit,
|
|
389
|
-
bottomContent,
|
|
390
|
-
onDynamicSearch,
|
|
391
|
-
SelectorCellComponent,
|
|
392
|
-
onUpdated,
|
|
393
|
-
onClosed,
|
|
394
|
-
parent
|
|
395
|
-
} = _a, sheetarams = __objRest(_a, [
|
|
396
|
-
"selectorID",
|
|
397
|
-
"options",
|
|
398
|
-
"selected",
|
|
399
|
-
"limit",
|
|
400
|
-
"bottomContent",
|
|
401
|
-
"onDynamicSearch",
|
|
402
|
-
"SelectorCellComponent",
|
|
403
|
-
"onUpdated",
|
|
404
|
-
"onClosed",
|
|
405
|
-
"parent"
|
|
406
|
-
]);
|
|
407
|
-
let sheetID = selectorID;
|
|
408
|
-
SelectorCellComponent = SelectorCellComponent || ((params2) => {
|
|
409
|
-
return /* @__PURE__ */ jsx(Row.Left, { children: params2.label });
|
|
410
|
-
});
|
|
411
|
-
Sheet.open(__spreadProps(__spreadValues({
|
|
412
|
-
parent,
|
|
413
|
-
sheetID,
|
|
414
|
-
type: "custom",
|
|
415
|
-
gravityPoint: 22,
|
|
416
|
-
padding: [1, 0],
|
|
417
|
-
hold_state: true,
|
|
418
|
-
close_option: {
|
|
419
|
-
aroundClick: true,
|
|
420
|
-
escapeKeyDown: true
|
|
421
|
-
}
|
|
422
|
-
}, sheetarams), {
|
|
423
|
-
content: /* @__PURE__ */ jsx(
|
|
424
|
-
Box,
|
|
425
|
-
{
|
|
426
|
-
borderRadius: "2.tone.secondary",
|
|
427
|
-
backgroundColor: "1.layer.base",
|
|
428
|
-
border: true,
|
|
429
|
-
boxShadow: "1.normal",
|
|
430
|
-
overflow: "hidden",
|
|
431
|
-
children: /* @__PURE__ */ jsx(
|
|
432
|
-
Component,
|
|
433
|
-
{
|
|
434
|
-
selectorID,
|
|
435
|
-
options,
|
|
436
|
-
limit,
|
|
437
|
-
selected,
|
|
438
|
-
onUpdated,
|
|
439
|
-
SelectorCellComponent,
|
|
440
|
-
bottomContent,
|
|
441
|
-
onDynamicSearch
|
|
442
|
-
},
|
|
443
|
-
JSON.stringify(selected)
|
|
444
|
-
)
|
|
445
|
-
}
|
|
446
|
-
),
|
|
447
|
-
openAfter: () => {
|
|
448
|
-
$$fromRoot("#" + params.selectorID + "-KeywordInput").focus();
|
|
449
|
-
},
|
|
450
|
-
closeAfter: () => {
|
|
451
|
-
onClosed();
|
|
452
|
-
}
|
|
453
|
-
}));
|
|
454
|
-
},
|
|
455
|
-
closeSelector: (selectorID) => {
|
|
456
|
-
Sheet.close(selectorID);
|
|
457
|
-
},
|
|
458
|
-
updateOptions: (selectorID, options) => {
|
|
459
|
-
let C = useStore.get(selectorID);
|
|
460
|
-
if (C && C.updateOptions)
|
|
461
|
-
C.updateOptions(options);
|
|
462
|
-
},
|
|
463
|
-
updateSelected: (selectorID, selected) => {
|
|
464
|
-
let C = useStore.get(selectorID);
|
|
465
|
-
if (C && C.updateSelected)
|
|
466
|
-
C.updateSelected(selected);
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
export {
|
|
470
|
-
Selector,
|
|
471
|
-
Selector as default
|
|
472
|
-
};
|
|
1
|
+
import{b as E,c as J,d as W,e as K}from"../../../chunk-VY3566IV.js";import{Fragment as j,jsx as n,jsxs as O}from"react/jsx-runtime";import{useState as I,useEffect as R,useRef as L}from"react";import{$$ as w,$$fromRoot as P,useStore as U}from"../../../@utils/_";import F from"../../../atoms/Box";import _ from"../../../atoms/FAI";import $ from"../../../atoms/Span";import H from"../../../mols/Column";import b from"../../../mols/Row";import V from"../../Button";import k from"../../Sheet";import G from"../../Loader/_";import Q from"../Text";import X from"../Parts";import{InputChipsClasses as Y}from"../../../@styles/componentClasses/_";const Z=e=>{let[y,r]=I("show"),[h,N]=I(""),[u]=I(w.uuid.gen()),[l,g]=I(e.options),[o,C]=I(l[0]||null),[S,x]=I(e.selected),[D,T]=I("init");R(()=>{U.set({key:e.selectorID,value:{updateOptions:t=>{g(t)},updateSelected:t=>{x(t)}}})},[]);const B=L(!1);R(()=>{B.current?k.reposition(e.selectorID):B.current=!0},[l]);const z=L(!1);R(()=>{z.current?(r("interlude"),C(l[0]||null),e.onDynamicSearch?(w.interval.clear(u+"-dynamicSearch"),w.interval.standBy(u+"-dynamicSearch",400,()=>K(void 0,null,function*(){let{options:t}=yield e.onDynamicSearch(h);g(t),r("show")}))):(w.interval.clear(u+"-staticSearch"),w.interval.standBy(u+"-staticSearch",400,()=>K(void 0,null,function*(){let t=new RegExp(h,"ig"),p=[];[...e.options].forEach(a=>{var c;!!(!h||((c=String(a.label))!=null?c:String(a.value)).match(t))&&p.push(a)}),g(p),r("show")})))):z.current=!0},[h]);const M=L(!1);R(()=>{M.current?e.onUpdated({values:S}):M.current=!0},[S]),R(()=>{w.scope(()=>{if(w.is.nullish(o)||D=="MouseEvent")return;let t=P("#"+u+"-Selector-Cell-Wrap");if(!t[0])return;let p=P('[data-chips-selector-cell="'+u+"-"+JSON.stringify((o==null?void 0:o.value)||"").replace(/\"/ig,"")+'"]');if(!p[0])return;let{top:a,height:v}=t.position(),{top:c,height:d}=p.position();if(a<=c&&c+d<=a+v)return;let i=t[0].scrollTop+(c-a);D=="ArrowDown"?i-=v-d-20:D=="ArrowUp"&&(i-=20),t[0].scrollTop=i})},[o]);let A=[];return y=="interlude"?A=[O(b.Center,{padding:2,gap:0,children:[n(G.Theme.R,{showInitial:!0}),n(F,{padding:[0,1],fontSize:"1.mini",fontColor:"4.thin",children:"\u691C\u7D22\u4E2D..."})]})]:A=[l.map((t,p)=>{let{value:a,label:v}=t,c=String(JSON.stringify(a)),d=S.findIndex(f=>JSON.stringify(f.value)==c),i=d!=-1,s=JSON.stringify((o==null?void 0:o.value)||"")==c,m={};return(i||s)&&(m={fontColor:"theme",isSemiBoldFont:!0}),s&&(m.backgroundColor="cloud"),i&&(m.backgroundColor="tcOpFew"),n(V.Button.Clear.R,J(E({borderRadius:"3.tone.tertiary",color:"cloud",padding:"1/3",tabIndex:-1,textAlign:"left","data-chips-selector-cell":u+"-"+c.replace(/\"/ig,""),isActive:i||s,isActiveStyles:m},m),{onMouseOver:()=>{T("MouseEvent"),C(t)},onClick:()=>{let f=[...S];i?f.splice(d,1):(f=[...f,t],e.limit&&f.length>e.limit&&f.shift()),x(f)},children:n(e.SelectorCellComponent,{isSelected:i,isFocused:s,value:a,label:v})}),p)})],O(j,{children:[O(H,{padding:"2/3",gap:"2/3",borderBottom:!0,children:[O(b.Separate,{children:[n(Q.Normal,{value:h,onUpdateValidValue:({value:t})=>{N(t)},id:e.selectorID+"-KeywordInput",padding:"2/3",placeholder:"\u691C\u7D22...",leftIcon:n(X.LeftIcon,{right:"2/3",fontSize:"1.mini",fontColor:"3.blur",children:n(_.Search,{})}),onKeyDown:t=>{let{key:p,metaKey:a,ctrlKey:v}=t,c=a||v;if(["ArrowDown","ArrowUp"].includes(p)){let d=+(p=="ArrowDown")*2-1;if(c){let i=l[d==1?l.length-1:0];C(i)}else{let i=l.findIndex(s=>JSON.stringify(s.value)==JSON.stringify((o==null?void 0:o.value)||""))+d;l[i]?C(l[i]):C(l[d==1?0:l.length-1]||null)}}else if(p=="Enter"){let d=S.findIndex(m=>JSON.stringify(m.value)==JSON.stringify((o==null?void 0:o.value)||"")),i=d!=-1,s=[...S];if(i)s.splice(d,1);else{let m=l.findIndex(f=>JSON.stringify(f.value)==JSON.stringify((o==null?void 0:o.value)||""));if(m==-1)return;s=[...s,l[m]],e.limit&&s.length>e.limit&&s.shift()}x(s)}T(p)}}),n(V.Button.Border.S,{marginRight:"1/3",ssSphere:2,backgroundColor:"cloud",borderRadius:"2.tone.secondary",onClick:()=>{k.close(e.selectorID)},children:n(_.Times,{})})]}),O(b.Separate,{children:[O(b.Left,{gap:"1/2",verticalAlign:"baseline",children:[n($,{fontColor:"theme",children:l.length}),n(F,{fontSize:"1.mini",fontColor:"3.blur",children:"\u4EF6\u306E\u30D2\u30C3\u30C8"})]}),n(b.Right,{children:!!e.limit&&O($,{fontColor:"3.blur",fontSize:"1.mini",children:[n($,{fontSize:"3.paragraph",fontColor:"theme",isSemiBoldFont:!0,children:S.length})," / ",e.limit," \u4EF6"]})})]})]}),n(H,{gap:"1/4",padding:"1/2",overflow:"auto",freeCSS:{maxHeight:12*26,maxWidth:12*26},id:u+"-Selector-Cell-Wrap",className:Y("SelectorWrapper"),children:A}),e.bottomContent]})},q={openSelector:e=>{let T=e,{selectorID:y,options:r,selected:h,limit:N,bottomContent:u,onDynamicSearch:l,SelectorCellComponent:g,onUpdated:o,onClosed:C,parent:S}=T,x=W(T,["selectorID","options","selected","limit","bottomContent","onDynamicSearch","SelectorCellComponent","onUpdated","onClosed","parent"]),D=y;g=g||(B=>n(b.Left,{children:B.label})),k.open(J(E({parent:S,sheetID:D,type:"custom",gravityPoint:22,padding:[1,0],hold_state:!0,close_option:{aroundClick:!0,escapeKeyDown:!0}},x),{content:n(F,{borderRadius:"2.tone.secondary",backgroundColor:"1.layer.base",border:!0,boxShadow:"1.normal",overflow:"hidden",children:n(Z,{selectorID:y,options:r,limit:N,selected:h,onUpdated:o,SelectorCellComponent:g,bottomContent:u,onDynamicSearch:l},JSON.stringify(h))}),openAfter:()=>{P("#"+e.selectorID+"-KeywordInput").focus()},closeAfter:()=>{C()}}))},closeSelector:e=>{k.close(e)},updateOptions:(e,y)=>{let r=U.get(e);r&&r.updateOptions&&r.updateOptions(y)},updateSelected:(e,y)=>{let r=U.get(e);r&&r.updateSelected&&r.updateSelected(y)}};export{q as Selector,q as default};
|