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.
Files changed (98) hide show
  1. package/dist/@declaration/_.js +1 -1
  2. package/dist/@declaration/property.d.ts +2 -2
  3. package/dist/@styles/componentClasses/_.css +66 -65
  4. package/dist/@styles/componentClasses/_.js +39 -39
  5. package/dist/@styles/index.css +66 -65
  6. package/dist/@styles/index.js +39 -39
  7. package/dist/@styles/init.css +1 -1
  8. package/dist/@styles/style.css +96 -65
  9. package/dist/@styles/style.js +39 -39
  10. package/dist/@styles/var.css +1 -1
  11. package/dist/@utils/GenerateClassName.js +1 -470
  12. package/dist/@utils/LaunchReactApp.d.ts +1 -1
  13. package/dist/@utils/LaunchReactApp.js +1 -78
  14. package/dist/@utils/_.js +1 -12
  15. package/dist/@utils/collectForm.js +1 -96
  16. package/dist/@utils/color.js +1 -103
  17. package/dist/@utils/config.js +1 -101
  18. package/dist/@utils/fin.js +1 -39
  19. package/dist/@utils/getElement.js +1 -13
  20. package/dist/@utils/jsminEx.js +1 -172
  21. package/dist/@utils/pageTransit.js +1 -33
  22. package/dist/@utils/useRecycle.js +1 -44
  23. package/dist/@utils/useStore.js +1 -54
  24. package/dist/atoms/Box.js +1 -20
  25. package/dist/atoms/FAI.js +1 -148
  26. package/dist/atoms/Flex.js +1 -34
  27. package/dist/atoms/Grid.js +1 -17
  28. package/dist/atoms/Img.js +1 -65
  29. package/dist/atoms/Logo.js +51 -359
  30. package/dist/atoms/P.js +1 -20
  31. package/dist/atoms/Placeholder.js +1 -44
  32. package/dist/atoms/Span.js +1 -20
  33. package/dist/atoms/_.js +1 -9
  34. package/dist/fn/Button.js +1 -316
  35. package/dist/fn/Cropper.js +1 -1009
  36. package/dist/fn/Effect/Fade.js +1 -88
  37. package/dist/fn/Effect/Pudding.js +1 -22
  38. package/dist/fn/Effect/Ripple.js +3 -117
  39. package/dist/fn/Effect/_.js +1 -14
  40. package/dist/fn/Input/AutoHeightText.js +1 -112
  41. package/dist/fn/Input/Checker.js +1 -36
  42. package/dist/fn/Input/Chips/Selector.js +1 -472
  43. package/dist/fn/Input/Chips/_.js +1 -349
  44. package/dist/fn/Input/Contenteditable.js +1 -160
  45. package/dist/fn/Input/DigitCharacters.js +1 -275
  46. package/dist/fn/Input/Filer.js +1 -619
  47. package/dist/fn/Input/Hidden.js +1 -48
  48. package/dist/fn/Input/List.js +1 -450
  49. package/dist/fn/Input/Parts.js +1 -121
  50. package/dist/fn/Input/Plain.js +1 -12
  51. package/dist/fn/Input/RichSelect.js +1 -279
  52. package/dist/fn/Input/Search.js +1 -53
  53. package/dist/fn/Input/Segmented.js +1 -245
  54. package/dist/fn/Input/Select.js +1 -278
  55. package/dist/fn/Input/Slider.js +1 -538
  56. package/dist/fn/Input/Switch.js +1 -221
  57. package/dist/fn/Input/Text.js +1 -626
  58. package/dist/fn/Input/TextArea.js +1 -151
  59. package/dist/fn/Input/Time/Picker.js +1 -1457
  60. package/dist/fn/Input/Time/_.js +1 -867
  61. package/dist/fn/Input/_.js +1 -48
  62. package/dist/fn/Input/core.js +1 -626
  63. package/dist/fn/Layout/PageNotFound.js +1 -90
  64. package/dist/fn/Layout/PageRouter.js +1 -87
  65. package/dist/fn/Layout/PageViewController.js +1 -29
  66. package/dist/fn/Layout/Plate.js +1 -37
  67. package/dist/fn/Layout/RootViewController.js +1 -315
  68. package/dist/fn/Layout/SwipeView.js +1 -348
  69. package/dist/fn/Layout/TabBar.js +1 -72
  70. package/dist/fn/Layout/_.js +1 -22
  71. package/dist/fn/Loader/_.js +1 -104
  72. package/dist/fn/Loader/corner.js +1 -85
  73. package/dist/fn/Loader/mini.js +1 -125
  74. package/dist/fn/Loader/top.js +1 -73
  75. package/dist/fn/Sheet.d.ts +1 -0
  76. package/dist/fn/Sheet.js +1 -1101
  77. package/dist/fn/Snackbar.js +1 -216
  78. package/dist/fn/Table/Data.js +1 -974
  79. package/dist/fn/Table/Drag.js +1 -435
  80. package/dist/fn/Table/Normal.js +1 -136
  81. package/dist/fn/Table/Parts.js +1 -41
  82. package/dist/fn/Table/Wrapper.js +1 -60
  83. package/dist/fn/Table/_.js +1 -16
  84. package/dist/fn/Table/cellStyling.js +1 -51
  85. package/dist/fn/Tooltips.js +1 -58
  86. package/dist/fn/_.js +1 -10
  87. package/dist/index.js +1 -20
  88. package/dist/mols/Accordion.js +1 -152
  89. package/dist/mols/Column.js +1 -16
  90. package/dist/mols/LinkifyText.js +1 -42
  91. package/dist/mols/List.js +1 -42
  92. package/dist/mols/Row.js +1 -47
  93. package/dist/mols/Text.js +1 -67
  94. package/dist/mols/_.js +1 -6
  95. package/dist/temps/_.js +1 -1
  96. package/dist/temps/designBook.js +20 -3639
  97. package/package.json +1 -1
  98. package/dist/chunk-JJ3PEWPN.js +0 -60
@@ -1,619 +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
- } from "react";
12
- import {
13
- $$,
14
- $$fromRoot,
15
- useStore,
16
- GenerateClassName
17
- } from "../../@utils/_";
18
- import Box from "../../atoms/Box";
19
- import FAI from "../../atoms/FAI";
20
- import Flex from "../../atoms/Flex";
21
- import Column from "../../mols/Column";
22
- import Row from "../../mols/Row";
23
- import Button from "../Button";
24
- import Snackbar from "../Snackbar";
25
- import {
26
- Wrapper,
27
- BoxWrapper,
28
- CommonEffects,
29
- DefaultStyles
30
- } from "./core";
31
- import Text from "./Text";
32
- import { InputFilerClasses } from "../../@styles/componentClasses/_";
33
- import { faCloudArrowUp } from "@fortawesome/free-solid-svg-icons/faCloudArrowUp";
34
- function DefaultValidation(props) {
35
- let { value, params } = props;
36
- let { required } = params;
37
- let notice = [];
38
- if (required && !value.length) {
39
- notice.push({ type: "invalid", label: "\u5FC5\u9808\u9805\u76EE\u3067\u3059" });
40
- }
41
- return {
42
- ok: !notice.filter(({ type }) => type == "invalid").length,
43
- notice
44
- };
45
- }
46
- const Comps = {
47
- List: (props) => {
48
- let {
49
- files,
50
- params,
51
- val_status,
52
- set_status
53
- } = props;
54
- let Left = (params.limit || 1) - val_status.dataValue.length;
55
- let Files = files.map((file, index) => {
56
- return /* @__PURE__ */ jsx(
57
- Comps.Cell,
58
- {
59
- index,
60
- file,
61
- className: params.cellClassName,
62
- val_status,
63
- set_status,
64
- fileNameEdit: params.fileNameEdit
65
- },
66
- file.name
67
- );
68
- });
69
- if (Left > 0) {
70
- Files.push(/* @__PURE__ */ jsx(
71
- "label",
72
- {
73
- className: [params.cellClassName, InputFilerClasses("AddButton")].join(" "),
74
- "data-component-id": val_status.componentID,
75
- htmlFor: params.id,
76
- tabIndex: params.tabIndex,
77
- onKeyDown: (event) => {
78
- let { key } = event;
79
- if (params.tabIndex != -1) {
80
- if ([" ", "Enter"].includes(key)) {
81
- $$fromRoot("#" + params.id).click();
82
- }
83
- }
84
- },
85
- children: /* @__PURE__ */ jsxs(
86
- Row.Center,
87
- {
88
- padding: ["1/3", 0],
89
- children: [
90
- /* @__PURE__ */ jsx(
91
- Box,
92
- {
93
- isRounded: true,
94
- className: InputFilerClasses("AddIcon"),
95
- children: /* @__PURE__ */ jsx(
96
- FAI,
97
- {
98
- icon: faCloudArrowUp,
99
- className: InputFilerClasses("Icon"),
100
- fontColor: "theme",
101
- fontSize: "4.thirdTitle",
102
- backgroundColor: "tcOpLow",
103
- ssSphere: 3,
104
- padding: "1/2"
105
- }
106
- )
107
- }
108
- ),
109
- /* @__PURE__ */ jsxs(Box, { children: [
110
- /* @__PURE__ */ jsx(
111
- Box,
112
- {
113
- children: `\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\uFF08${Left}\uFF09`,
114
- fontColor: "theme",
115
- fontSize: "2.normal",
116
- isSemiBoldFont: true
117
- }
118
- ),
119
- /* @__PURE__ */ jsx(
120
- Box,
121
- {
122
- isSemiBoldFont: true,
123
- fontColor: "4.thin",
124
- fontSize: "0.xs",
125
- children: "\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7"
126
- }
127
- )
128
- ] })
129
- ]
130
- }
131
- )
132
- },
133
- "AddButton"
134
- ));
135
- }
136
- return /* @__PURE__ */ jsx(
137
- Column,
138
- {
139
- flexSizing: "auto",
140
- className: params.className,
141
- children: Files
142
- }
143
- );
144
- },
145
- Cell: (props) => {
146
- let {
147
- index,
148
- file,
149
- className,
150
- val_status,
151
- set_status,
152
- fileNameEdit = true
153
- } = props;
154
- let {
155
- name: fileName,
156
- size,
157
- type
158
- } = file;
159
- let [val_edit, set_edit] = useState(false);
160
- let FileID = $$.uuid.gen();
161
- let Size = size.rank();
162
- let [name, extension] = fileName.replace(/\s/, "").replace(/(.*)\.(.*)$/, "$1 $2").split(" ");
163
- let FileName = "\u30D5\u30A1\u30A4\u30EB";
164
- if (type.match(/image/)) {
165
- FileName = type.replace(/image\//, "");
166
- } else if (type.match(/pdf/)) {
167
- FileName = "PDF";
168
- } else if (type.match(/csv/)) {
169
- FileName = "CSV";
170
- } else if (type.match(/spreadsheet/)) {
171
- FileName = "SpreadSheet";
172
- } else if (type.match(/presentation/)) {
173
- FileName = "PowerPoint";
174
- } else if (type.match(/word/)) {
175
- FileName = "Word";
176
- } else if (type.match(/zip/)) {
177
- FileName = "Zip";
178
- } else if (type.match(/powerpoint/)) {
179
- FileName = "PowerPoint";
180
- } else if (type.match(/html/)) {
181
- FileName = "HTML";
182
- } else if (type.match(/js/)) {
183
- FileName = "JavaScript";
184
- } else if (type.match(/css/)) {
185
- FileName = "CSS";
186
- } else if (type.match(/text\/plain/)) {
187
- FileName = "\u30C6\u30AD\u30B9\u30C8";
188
- }
189
- useEffect(() => {
190
- if (val_edit) {
191
- setTimeout(() => {
192
- $$fromRoot("#" + FileID).focus();
193
- }, 100);
194
- }
195
- }, [val_edit]);
196
- return /* @__PURE__ */ jsxs(
197
- Flex,
198
- {
199
- verticalAlign: "center",
200
- flexWrap: false,
201
- gap: 1,
202
- className,
203
- children: [
204
- /* @__PURE__ */ jsx(
205
- FAI.File,
206
- {
207
- fontSize: "4.thirdTitle",
208
- fontColor: "4.thin"
209
- }
210
- ),
211
- /* @__PURE__ */ jsxs(Box, { flexSizing: 0, children: [
212
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
213
- Flex,
214
- {
215
- verticalAlign: "center",
216
- gap: "2/3",
217
- flexWrap: false,
218
- className: InputFilerClasses("FileName"),
219
- children: !val_edit ? /* @__PURE__ */ jsxs(Fragment, { children: [
220
- fileName,
221
- !!fileNameEdit && /* @__PURE__ */ jsx(
222
- Button.Button.Clear.R,
223
- {
224
- ssSphere: 2.5,
225
- flexSizing: "none",
226
- color: "cloud",
227
- fontColor: "4.thin",
228
- padding: "1/3",
229
- ssEffectsOnActive: "expand",
230
- onClick: () => {
231
- set_edit(true);
232
- },
233
- children: /* @__PURE__ */ jsx(FAI.Pen, {})
234
- }
235
- )
236
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
237
- Column,
238
- {
239
- gap: "1/2",
240
- flexSizing: 0,
241
- children: [
242
- /* @__PURE__ */ jsxs(
243
- Flex,
244
- {
245
- gap: "2/3",
246
- verticalAlign: "center",
247
- children: [
248
- /* @__PURE__ */ jsx(
249
- Text.Normal,
250
- {
251
- tone: "border",
252
- wrapStyles: {
253
- flexSizing: "auto"
254
- },
255
- restrict: "fileName",
256
- name: "name",
257
- required: true,
258
- id: FileID,
259
- form: "form-" + FileID,
260
- enableFormSubmit: true,
261
- value: name,
262
- onKeyDown: (event) => {
263
- let { key } = event;
264
- if (key == "Escape")
265
- set_edit(false);
266
- }
267
- }
268
- ),
269
- /* @__PURE__ */ jsxs(Box, { children: [
270
- ". ",
271
- extension
272
- ] })
273
- ]
274
- }
275
- ),
276
- /* @__PURE__ */ jsxs(
277
- Flex,
278
- {
279
- gap: "2/3",
280
- horizontalAlign: "right",
281
- flexWrap: false,
282
- children: [
283
- /* @__PURE__ */ jsx(
284
- Button.Button.Sub.R,
285
- {
286
- padding: ["2/3", 1],
287
- children: "\u9589\u3058\u308B",
288
- onClick: () => {
289
- set_edit(false);
290
- }
291
- }
292
- ),
293
- /* @__PURE__ */ jsx(
294
- Button.Button.Prime.R,
295
- {
296
- padding: ["2/3", 1],
297
- submitOption: {
298
- formName: "form-" + FileID,
299
- callback: (form) => __async(void 0, null, function* () {
300
- let { name: name2 } = form;
301
- let nextFiles = [...val_status.dataValue];
302
- let prevFile = nextFiles[index];
303
- let id = prevFile.id;
304
- if (!prevFile)
305
- return;
306
- let { target } = yield prevFile.read();
307
- if (!target)
308
- return;
309
- let dataUrl = String(target.result);
310
- let newBlob = yield dataUrl.toBlob(file.type);
311
- if (!newBlob)
312
- return;
313
- let newFile = new File([newBlob], name2 + "." + extension, { type: prevFile.type });
314
- newFile.id = id;
315
- nextFiles[index] = newFile;
316
- set_status(__spreadProps(__spreadValues({}, val_status), {
317
- dataValue: nextFiles,
318
- eventType: "update",
319
- eventID: $$.uuid.gen()
320
- }));
321
- set_edit(false);
322
- })
323
- },
324
- children: "\u6C7A\u5B9A"
325
- }
326
- )
327
- ]
328
- }
329
- )
330
- ]
331
- }
332
- ) })
333
- }
334
- ) }),
335
- !val_edit && /* @__PURE__ */ jsx(
336
- Box,
337
- {
338
- fontSize: "1.mini",
339
- fontColor: "4.thin",
340
- flexSizing: 0,
341
- children: FileName + "\u30D5\u30A1\u30A4\u30EB / " + Size + "B"
342
- }
343
- )
344
- ] }),
345
- /* @__PURE__ */ jsx(
346
- Button.Button.Sub.R,
347
- {
348
- color: "cloud",
349
- fontColor: "4.thin",
350
- ssSphere: 3,
351
- onClick: () => {
352
- let nextFiles = [...val_status.dataValue];
353
- let prevFile = nextFiles[index];
354
- if (!prevFile)
355
- return;
356
- nextFiles.splice(index, 1);
357
- set_status(__spreadProps(__spreadValues({}, val_status), {
358
- dataValue: nextFiles,
359
- eventType: "update",
360
- eventID: $$.uuid.gen()
361
- }));
362
- },
363
- children: /* @__PURE__ */ jsx(FAI.Times, {})
364
- }
365
- )
366
- ]
367
- }
368
- );
369
- }
370
- };
371
- const FileInput = (params) => {
372
- let _a = params, {
373
- tone,
374
- required,
375
- form,
376
- fileNameEdit = true,
377
- systemOnly = false,
378
- accept = "*",
379
- limit = 1,
380
- checkValidationAtFirst,
381
- onChange,
382
- onValidate,
383
- onUpdateValue,
384
- onUpdateValidValue,
385
- value = [],
386
- className,
387
- cellStyles,
388
- cellClassName,
389
- componentID,
390
- status_id,
391
- enableFormSubmit
392
- } = _a, others = __objRest(_a, [
393
- "tone",
394
- "required",
395
- "form",
396
- "fileNameEdit",
397
- "systemOnly",
398
- "accept",
399
- "limit",
400
- "checkValidationAtFirst",
401
- "onChange",
402
- "onValidate",
403
- "onUpdateValue",
404
- "onUpdateValidValue",
405
- "value",
406
- "className",
407
- "cellStyles",
408
- "cellClassName",
409
- "componentID",
410
- "status_id",
411
- "enableFormSubmit"
412
- ]);
413
- let Default_Status = {
414
- componentID: params.componentID || "",
415
- dataValue: value,
416
- eventType: "init",
417
- eventID: $$.uuid.gen()
418
- };
419
- let [val_status, set_status] = useState(Default_Status);
420
- let [val_validate, set_validate] = useState({
421
- ok: false,
422
- notice: []
423
- });
424
- CommonEffects({
425
- type: "file",
426
- params,
427
- val_status,
428
- set_status,
429
- val_validate,
430
- set_validate,
431
- DefaultValidation,
432
- onUpdateValue,
433
- onUpdateValidValue,
434
- ExtraOverrideParams: {
435
- dataValue: value,
436
- formatValue: value
437
- },
438
- ExtraStoreParams: {
439
- AddFiles: (files) => __async(void 0, null, function* () {
440
- let currentFiles = useStore.get(val_status.componentID).Files;
441
- let newFiles = [];
442
- for (var i = 0; i < (files == null ? void 0 : files.length); i++) {
443
- let file = files[i];
444
- let { type, name } = file;
445
- if (i + 1 + currentFiles.length > limit) {
446
- Snackbar.add({
447
- componentID: name,
448
- secondsToClose: 12e3,
449
- children: `\u30D5\u30A1\u30A4\u30EB\u9078\u629E\u4E0A\u9650\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${name}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,
450
- backgroundColor: "nega"
451
- });
452
- continue;
453
- }
454
- if (accept) {
455
- if (accept == "image") {
456
- if (!type.match(/image/)) {
457
- Snackbar.add({
458
- componentID: name,
459
- secondsToClose: 12e3,
460
- children: `\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u7570\u306A\u308B\u305F\u3081\u3001${name} \u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,
461
- backgroundColor: "nega"
462
- });
463
- continue;
464
- }
465
- }
466
- }
467
- newFiles.push(file);
468
- }
469
- set_status(__spreadProps(__spreadValues({}, val_status), {
470
- dataValue: [...currentFiles, ...newFiles],
471
- eventType: "update",
472
- eventID: $$.uuid.gen()
473
- }));
474
- })
475
- }
476
- });
477
- let Accept = "";
478
- if (accept) {
479
- if (accept == "image")
480
- Accept = "image/png,image/jpeg";
481
- else
482
- Accept = accept;
483
- }
484
- return /* @__PURE__ */ jsxs(
485
- BoxWrapper,
486
- {
487
- val_status,
488
- set_status,
489
- val_validate,
490
- params,
491
- children: [
492
- /* @__PURE__ */ jsx(
493
- "input",
494
- __spreadProps(__spreadValues({
495
- type: "file",
496
- className: InputFilerClasses("Input"),
497
- "data-form": form,
498
- "data-input-type": "file",
499
- "data-component-id": val_status.componentID,
500
- "data-validation": val_validate.ok,
501
- accept: Accept,
502
- multiple: limit == 1 ? false : true,
503
- onChange: (event) => __async(void 0, null, function* () {
504
- let Input = event.target;
505
- let files = Input.files;
506
- let newFiles = [];
507
- for (var i = 0; i < (files == null ? void 0 : files.length); i++) {
508
- let file = files[i];
509
- let fileName = file.name;
510
- file.id = $$.uuid.gen();
511
- if (i + 1 + val_status.dataValue.length > limit) {
512
- Snackbar.add({
513
- componentID: fileName,
514
- secondsToClose: 12e3,
515
- children: `\u30D5\u30A1\u30A4\u30EB\u767B\u9332\u6570\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${fileName}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,
516
- backgroundColor: "nega"
517
- });
518
- continue;
519
- }
520
- newFiles.push(file);
521
- }
522
- set_status(__spreadProps(__spreadValues({}, val_status), {
523
- dataValue: [...val_status.dataValue, ...newFiles],
524
- eventType: "update",
525
- eventID: $$.uuid.gen()
526
- }));
527
- Input.value = "";
528
- })
529
- }, others), {
530
- tabIndex: -1,
531
- value: ""
532
- })
533
- ),
534
- !systemOnly && /* @__PURE__ */ jsx(
535
- Comps.List,
536
- {
537
- files: val_status.dataValue,
538
- params,
539
- val_status,
540
- set_status
541
- }
542
- )
543
- ]
544
- }
545
- );
546
- };
547
- $$(document).addEvent({
548
- eventType: "dragover",
549
- callback: (event) => {
550
- event.preventDefault();
551
- $$fromRoot("." + InputFilerClasses("AddButton")).addClass(InputFilerClasses("Draggable"));
552
- },
553
- options: {
554
- passive: false
555
- }
556
- }).addEvent({
557
- eventType: "drop",
558
- callback: (event) => {
559
- event.preventDefault();
560
- $$fromRoot("." + InputFilerClasses("AddButton")).removeClass(InputFilerClasses("Draggable"));
561
- let Files = event.dataTransfer.files;
562
- if (Files.length) {
563
- let Target = event.target;
564
- if ($$fromRoot(Target).hasClass(InputFilerClasses("AddButton"))) {
565
- let { componentId } = Target.dataset;
566
- let component = useStore.get(componentId);
567
- if (component && component.AddFiles)
568
- component.AddFiles(Files);
569
- }
570
- }
571
- },
572
- options: { passive: false }
573
- });
574
- const Filer = (rawParams) => {
575
- rawParams = __spreadValues({}, rawParams);
576
- rawParams.override = "force";
577
- let params = GenerateClassName(rawParams);
578
- params.cellClassName = [
579
- params.cellClassName,
580
- DefaultStyles.Boxish(__spreadProps(__spreadValues({}, params.cellStyles), {
581
- tone: params.tone
582
- })).className
583
- ].join(" ");
584
- return /* @__PURE__ */ jsx(
585
- Wrapper,
586
- {
587
- componentID: rawParams.componentID,
588
- children: FileInput,
589
- params
590
- }
591
- );
592
- };
593
- Filer.fn = {
594
- openDialog: (params) => {
595
- let {
596
- multiple,
597
- accept
598
- } = params;
599
- return new Promise((resolve) => {
600
- const input = document.createElement("input");
601
- input.type = "file";
602
- input.multiple = multiple != null ? multiple : true;
603
- if (accept) {
604
- if (accept == "image")
605
- input.accept = "image/png,image/jpeg";
606
- else
607
- input.accept = accept;
608
- }
609
- input.onchange = (event) => {
610
- resolve(event.target.files);
611
- };
612
- input.click();
613
- });
614
- }
615
- };
616
- export {
617
- Filer,
618
- Filer as default
619
- };
1
+ import{b as g,c as x,d as Z,e as $}from"../../chunk-VY3566IV.js";import{Fragment as ee,jsx as n,jsxs as d}from"react/jsx-runtime";import{useState as q,useEffect as te}from"react";import{$$ as h,$$fromRoot as P,useStore as Q,GenerateClassName as ae}from"../../@utils/_";import y from"../../atoms/Box";import L from"../../atoms/FAI";import O from"../../atoms/Flex";import X from"../../mols/Column";import le from"../../mols/Row";import W from"../Button";import H from"../Snackbar";import{Wrapper as ne,BoxWrapper as ie,CommonEffects as oe,DefaultStyles as se}from"./core";import re from"./Text";import{InputFilerClasses as m}from"../../@styles/componentClasses/_";import{faCloudArrowUp as pe}from"@fortawesome/free-solid-svg-icons/faCloudArrowUp";function ue(e){let{value:t,params:a}=e,{required:s}=a,l=[];return s&&!t.length&&l.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!l.filter(({type:p})=>p=="invalid").length,notice:l}}const Y={List:e=>{let{files:t,params:a,val_status:s,set_status:l}=e,p=(a.limit||1)-s.dataValue.length,c=t.map((u,S)=>n(Y.Cell,{index:S,file:u,className:a.cellClassName,val_status:s,set_status:l,fileNameEdit:a.fileNameEdit},u.name));return p>0&&c.push(n("label",{className:[a.cellClassName,m("AddButton")].join(" "),"data-component-id":s.componentID,htmlFor:a.id,tabIndex:a.tabIndex,onKeyDown:u=>{let{key:S}=u;a.tabIndex!=-1&&[" ","Enter"].includes(S)&&P("#"+a.id).click()},children:d(le.Center,{padding:["1/3",0],children:[n(y,{isRounded:!0,className:m("AddIcon"),children:n(L,{icon:pe,className:m("Icon"),fontColor:"theme",fontSize:"4.thirdTitle",backgroundColor:"tcOpLow",ssSphere:3,padding:"1/2"})}),d(y,{children:[n(y,{children:`\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\uFF08${p}\uFF09`,fontColor:"theme",fontSize:"2.normal",isSemiBoldFont:!0}),n(y,{isSemiBoldFont:!0,fontColor:"4.thin",fontSize:"0.xs",children:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7"})]})]})},"AddButton")),n(X,{flexSizing:"auto",className:a.className,children:c})},Cell:e=>{let{index:t,file:a,className:s,val_status:l,set_status:p,fileNameEdit:c=!0}=e,{name:u,size:S,type:i}=a,[V,b]=q(!1),N=h.uuid.gen(),_=S.rank(),[G,M]=u.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" "),o="\u30D5\u30A1\u30A4\u30EB";return i.match(/image/)?o=i.replace(/image\//,""):i.match(/pdf/)?o="PDF":i.match(/csv/)?o="CSV":i.match(/spreadsheet/)?o="SpreadSheet":i.match(/presentation/)?o="PowerPoint":i.match(/word/)?o="Word":i.match(/zip/)?o="Zip":i.match(/powerpoint/)?o="PowerPoint":i.match(/html/)?o="HTML":i.match(/js/)?o="JavaScript":i.match(/css/)?o="CSS":i.match(/text\/plain/)&&(o="\u30C6\u30AD\u30B9\u30C8"),te(()=>{V&&setTimeout(()=>{P("#"+N).focus()},100)},[V]),d(O,{verticalAlign:"center",flexWrap:!1,gap:1,className:s,children:[n(L.File,{fontSize:"4.thirdTitle",fontColor:"4.thin"}),d(y,{flexSizing:0,children:[n(y,{children:n(O,{verticalAlign:"center",gap:"2/3",flexWrap:!1,className:m("FileName"),children:V?n(ee,{children:d(X,{gap:"1/2",flexSizing:0,children:[d(O,{gap:"2/3",verticalAlign:"center",children:[n(re.Normal,{tone:"border",wrapStyles:{flexSizing:"auto"},restrict:"fileName",name:"name",required:!0,id:N,form:"form-"+N,enableFormSubmit:!0,value:G,onKeyDown:f=>{let{key:k}=f;k=="Escape"&&b(!1)}}),d(y,{children:[". ",M]})]}),d(O,{gap:"2/3",horizontalAlign:"right",flexWrap:!1,children:[n(W.Button.Sub.R,{padding:["2/3",1],children:"\u9589\u3058\u308B",onClick:()=>{b(!1)}}),n(W.Button.Prime.R,{padding:["2/3",1],submitOption:{formName:"form-"+N,callback:f=>$(void 0,null,function*(){let{name:k}=f,w=[...l.dataValue],T=w[t],U=T.id;if(!T)return;let{target:r}=yield T.read();if(!r)return;let D=yield String(r.result).toBlob(a.type);if(!D)return;let z=new File([D],k+"."+M,{type:T.type});z.id=U,w[t]=z,p(x(g({},l),{dataValue:w,eventType:"update",eventID:h.uuid.gen()})),b(!1)})},children:"\u6C7A\u5B9A"})]})]})}):d(ee,{children:[u,!!c&&n(W.Button.Clear.R,{ssSphere:2.5,flexSizing:"none",color:"cloud",fontColor:"4.thin",padding:"1/3",ssEffectsOnActive:"expand",onClick:()=>{b(!0)},children:n(L.Pen,{})})]})})}),!V&&n(y,{fontSize:"1.mini",fontColor:"4.thin",flexSizing:0,children:o+"\u30D5\u30A1\u30A4\u30EB / "+_+"B"})]}),n(W.Button.Sub.R,{color:"cloud",fontColor:"4.thin",ssSphere:3,onClick:()=>{let f=[...l.dataValue];f[t]&&(f.splice(t,1),p(x(g({},l),{dataValue:f,eventType:"update",eventID:h.uuid.gen()})))},children:n(L.Times,{})})]})}},ce=e=>{let J=e,{tone:t,required:a,form:s,fileNameEdit:l=!0,systemOnly:p=!1,accept:c="*",limit:u=1,checkValidationAtFirst:S,onChange:i,onValidate:V,onUpdateValue:b,onUpdateValidValue:N,value:_=[],className:G,cellStyles:M,cellClassName:o,componentID:f,status_id:k,enableFormSubmit:w}=J,T=Z(J,["tone","required","form","fileNameEdit","systemOnly","accept","limit","checkValidationAtFirst","onChange","onValidate","onUpdateValue","onUpdateValidValue","value","className","cellStyles","cellClassName","componentID","status_id","enableFormSubmit"]),U={componentID:e.componentID||"",dataValue:_,eventType:"init",eventID:h.uuid.gen()},[r,B]=q(U),[D,z]=q({ok:!1,notice:[]});oe({type:"file",params:e,val_status:r,set_status:B,val_validate:D,set_validate:z,DefaultValidation:ue,onUpdateValue:b,onUpdateValidValue:N,ExtraOverrideParams:{dataValue:_,formatValue:_},ExtraStoreParams:{AddFiles:A=>$(void 0,null,function*(){let R=Q.get(r.componentID).Files,v=[];for(var F=0;F<(A==null?void 0:A.length);F++){let I=A[F],{type:E,name:C}=I;if(F+1+R.length>u){H.add({componentID:C,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u9078\u629E\u4E0A\u9650\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${C}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}if(c&&c=="image"&&!E.match(/image/)){H.add({componentID:C,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u7570\u306A\u308B\u305F\u3081\u3001${C} \u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}v.push(I)}B(x(g({},r),{dataValue:[...R,...v],eventType:"update",eventID:h.uuid.gen()}))})}});let j="";return c&&(c=="image"?j="image/png,image/jpeg":j=c),d(ie,{val_status:r,set_status:B,val_validate:D,params:e,children:[n("input",x(g({type:"file",className:m("Input"),"data-form":s,"data-input-type":"file","data-component-id":r.componentID,"data-validation":D.ok,accept:j,multiple:u!=1,onChange:A=>$(void 0,null,function*(){let R=A.target,v=R.files,F=[];for(var I=0;I<(v==null?void 0:v.length);I++){let E=v[I],C=E.name;if(E.id=h.uuid.gen(),I+1+r.dataValue.length>u){H.add({componentID:C,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u767B\u9332\u6570\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${C}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,backgroundColor:"nega"});continue}F.push(E)}B(x(g({},r),{dataValue:[...r.dataValue,...F],eventType:"update",eventID:h.uuid.gen()})),R.value=""})},T),{tabIndex:-1,value:""})),!p&&n(Y.List,{files:r.dataValue,params:e,val_status:r,set_status:B})]})};h(document).addEvent({eventType:"dragover",callback:e=>{e.preventDefault(),P("."+m("AddButton")).addClass(m("Draggable"))},options:{passive:!1}}).addEvent({eventType:"drop",callback:e=>{e.preventDefault(),P("."+m("AddButton")).removeClass(m("Draggable"));let t=e.dataTransfer.files;if(t.length){let a=e.target;if(P(a).hasClass(m("AddButton"))){let{componentId:s}=a.dataset,l=Q.get(s);l&&l.AddFiles&&l.AddFiles(t)}}},options:{passive:!1}});const K=e=>{e=g({},e),e.override="force";let t=ae(e);return t.cellClassName=[t.cellClassName,se.Boxish(x(g({},t.cellStyles),{tone:t.tone})).className].join(" "),n(ne,{componentID:e.componentID,children:ce,params:t})};K.fn={openDialog:e=>{let{multiple:t,accept:a}=e;return new Promise(s=>{const l=document.createElement("input");l.type="file",l.multiple=t!=null?t:!0,a&&(a=="image"?l.accept="image/png,image/jpeg":l.accept=a),l.onchange=p=>{s(p.target.files)},l.click()})}};export{K as Filer,K as default};
@@ -1,48 +1 @@
1
- import {
2
- __objRest,
3
- __spreadProps,
4
- __spreadValues
5
- } from "../../chunk-JJ3PEWPN.js";
6
- import { jsx } from "react/jsx-runtime";
7
- import {
8
- Wrapper
9
- } from "./core";
10
- const HiddenInput = (params) => {
11
- let _a = params, {
12
- componentID = "",
13
- enableFormSubmit,
14
- form,
15
- value = ""
16
- } = _a, others = __objRest(_a, [
17
- "componentID",
18
- "enableFormSubmit",
19
- "form",
20
- "value"
21
- ]);
22
- return /* @__PURE__ */ jsx(
23
- "input",
24
- __spreadProps(__spreadValues({
25
- value: JSON.stringify(value),
26
- "data-input-type": "hidden",
27
- "data-form": form,
28
- "data-component-id": componentID,
29
- "data-value": JSON.stringify(value)
30
- }, others), {
31
- type: "hidden"
32
- })
33
- );
34
- };
35
- const Hidden = (params) => {
36
- return /* @__PURE__ */ jsx(
37
- Wrapper,
38
- {
39
- componentID: params.componentID,
40
- children: HiddenInput,
41
- params
42
- }
43
- );
44
- };
45
- export {
46
- Hidden,
47
- Hidden as default
48
- };
1
+ import{b as i,c as o,d as r}from"../../chunk-VY3566IV.js";import{jsx as d}from"react/jsx-runtime";import{Wrapper as l}from"./core";const s=n=>{let e=n,{componentID:p="",enableFormSubmit:c,form:m,value:t=""}=e,u=r(e,["componentID","enableFormSubmit","form","value"]);return d("input",o(i({value:JSON.stringify(t),"data-input-type":"hidden","data-form":m,"data-component-id":p,"data-value":JSON.stringify(t)},u),{type:"hidden"}))},a=n=>d(l,{componentID:n.componentID,children:s,params:n});export{a as Hidden,a as default};