amotify 0.1.31 → 0.1.32

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 (95) hide show
  1. package/dist/@declaration/_.js +1 -1
  2. package/dist/@styles/componentClasses/_.css +68 -65
  3. package/dist/@styles/componentClasses/_.js +39 -39
  4. package/dist/@styles/index.css +68 -65
  5. package/dist/@styles/index.js +39 -39
  6. package/dist/@styles/init.css +1 -1
  7. package/dist/@styles/style.css +68 -65
  8. package/dist/@styles/style.js +39 -39
  9. package/dist/@styles/var.css +1 -1
  10. package/dist/@utils/GenerateClassName.js +470 -1
  11. package/dist/@utils/LaunchReactApp.js +78 -1
  12. package/dist/@utils/_.js +12 -1
  13. package/dist/@utils/collectForm.js +96 -1
  14. package/dist/@utils/color.js +103 -1
  15. package/dist/@utils/config.js +101 -1
  16. package/dist/@utils/fin.js +39 -1
  17. package/dist/@utils/getElement.js +13 -1
  18. package/dist/@utils/jsminEx.js +172 -1
  19. package/dist/@utils/pageTransit.js +33 -1
  20. package/dist/@utils/useRecycle.js +44 -1
  21. package/dist/@utils/useStore.js +54 -1
  22. package/dist/atoms/Box.js +20 -1
  23. package/dist/atoms/FAI.js +148 -1
  24. package/dist/atoms/Flex.js +34 -1
  25. package/dist/atoms/Grid.js +17 -1
  26. package/dist/atoms/Img.js +65 -1
  27. package/dist/atoms/Logo.js +359 -51
  28. package/dist/atoms/P.js +20 -1
  29. package/dist/atoms/Placeholder.js +44 -1
  30. package/dist/atoms/Span.js +20 -1
  31. package/dist/atoms/_.js +9 -1
  32. package/dist/chunk-JJ3PEWPN.js +60 -0
  33. package/dist/fn/Button.js +316 -1
  34. package/dist/fn/Cropper.js +1009 -1
  35. package/dist/fn/Effect/Fade.js +88 -1
  36. package/dist/fn/Effect/Pudding.js +22 -1
  37. package/dist/fn/Effect/Ripple.js +117 -3
  38. package/dist/fn/Effect/_.js +14 -1
  39. package/dist/fn/Input/AutoHeightText.js +112 -1
  40. package/dist/fn/Input/Checker.js +36 -1
  41. package/dist/fn/Input/Chips/Selector.js +472 -1
  42. package/dist/fn/Input/Chips/_.js +349 -1
  43. package/dist/fn/Input/Contenteditable.js +160 -1
  44. package/dist/fn/Input/DigitCharacters.js +275 -1
  45. package/dist/fn/Input/Filer.js +619 -1
  46. package/dist/fn/Input/Hidden.js +48 -1
  47. package/dist/fn/Input/List.js +450 -1
  48. package/dist/fn/Input/Parts.js +121 -1
  49. package/dist/fn/Input/Plain.js +12 -1
  50. package/dist/fn/Input/RichSelect.js +279 -1
  51. package/dist/fn/Input/Search.js +53 -1
  52. package/dist/fn/Input/Segmented.js +245 -1
  53. package/dist/fn/Input/Select.js +278 -1
  54. package/dist/fn/Input/Slider.js +538 -1
  55. package/dist/fn/Input/Switch.js +221 -1
  56. package/dist/fn/Input/Text.js +626 -1
  57. package/dist/fn/Input/TextArea.js +151 -1
  58. package/dist/fn/Input/Time/Picker.js +1457 -1
  59. package/dist/fn/Input/Time/_.js +867 -1
  60. package/dist/fn/Input/_.js +48 -1
  61. package/dist/fn/Input/core.js +626 -1
  62. package/dist/fn/Layout/PageNotFound.js +90 -1
  63. package/dist/fn/Layout/PageRouter.js +87 -1
  64. package/dist/fn/Layout/PageViewController.js +29 -1
  65. package/dist/fn/Layout/Plate.js +37 -1
  66. package/dist/fn/Layout/RootViewController.js +315 -1
  67. package/dist/fn/Layout/SwipeView.js +348 -1
  68. package/dist/fn/Layout/TabBar.js +72 -1
  69. package/dist/fn/Layout/_.js +22 -1
  70. package/dist/fn/Loader/_.js +104 -1
  71. package/dist/fn/Loader/corner.js +85 -1
  72. package/dist/fn/Loader/mini.js +125 -1
  73. package/dist/fn/Loader/top.js +73 -1
  74. package/dist/fn/Sheet.js +1101 -1
  75. package/dist/fn/Snackbar.js +216 -1
  76. package/dist/fn/Table/Data.js +974 -1
  77. package/dist/fn/Table/Drag.js +435 -1
  78. package/dist/fn/Table/Normal.js +136 -1
  79. package/dist/fn/Table/Parts.js +41 -1
  80. package/dist/fn/Table/Wrapper.js +60 -1
  81. package/dist/fn/Table/_.js +16 -1
  82. package/dist/fn/Table/cellStyling.js +51 -1
  83. package/dist/fn/Tooltips.js +58 -1
  84. package/dist/fn/_.js +10 -1
  85. package/dist/index.js +20 -1
  86. package/dist/mols/Accordion.js +152 -1
  87. package/dist/mols/Column.js +16 -1
  88. package/dist/mols/LinkifyText.js +42 -1
  89. package/dist/mols/List.js +42 -1
  90. package/dist/mols/Row.js +47 -1
  91. package/dist/mols/Text.js +67 -1
  92. package/dist/mols/_.js +6 -1
  93. package/dist/temps/_.js +1 -1
  94. package/dist/temps/designBook.js +3639 -20
  95. package/package.json +1 -1
@@ -1 +1,619 @@
1
- import{b as g,c as x,d as Q,e as $}from"../../chunk-VY3566IV.js";import{Fragment as G,jsx as t,jsxs as d}from"react/jsx-runtime";import{useState as q,useEffect as te}from"react";import{$$ as h,$$fromRoot as P,useStore as X,GenerateClassName as ae}from"../../@utils/_";import y from"../../atoms/Box";import L from"../../atoms/FAI";import O from"../../atoms/Flex";import Y 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:a,params:l}=e,{required:s}=l,n=[];return s&&!a.length&&n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!n.filter(({type:p})=>p=="invalid").length,notice:n}}const ee={List:e=>{let{files:a,params:l,val_status:s,set_status:n}=e,p=(l.limit||1)-s.dataValue.length,c=a.map((u,S)=>t(ee.Cell,{index:S,file:u,className:l.cellClassName,val_status:s,set_status:n,fileNameEdit:l.fileNameEdit},u.name));return p>0&&c.push(t("label",{className:[l.cellClassName,m("AddButton")].join(" "),"data-component-id":s.componentID,htmlFor:l.id,tabIndex:l.tabIndex,onKeyDown:u=>{let{key:S}=u;l.tabIndex!=-1&&[" ","Enter"].includes(S)&&P("#"+l.id).click()},children:d(le.Center,{padding:["1/3",0],children:[t(y,{isRounded:!0,className:m("AddIcon"),children:t(L,{icon:pe,className:m("Icon"),fontColor:"theme",fontSize:"4.thirdTitle",backgroundColor:"tcOpLow",ssSphere:3,padding:"1/2"})}),d(y,{children:[t(y,{children:`\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\uFF08${p}\uFF09`,fontColor:"theme",fontSize:"2.normal",isSemiBoldFont:!0}),t(y,{isSemiBoldFont:!0,fontColor:"4.thin",fontSize:"0.xs",children:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7"})]})]})},"AddButton")),t(Y,{flexSizing:"auto",className:l.className,children:c})},Cell:e=>{let{index:a,file:l,className:s,val_status:n,set_status:p,fileNameEdit:c=!0}=e,{name:u,size:S,type:i}=l,[V,b]=q(!1),N=h.uuid.gen(),_=S.rank(),[J,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:[t(L.File,{fontSize:"4.thirdTitle",fontColor:"4.thin"}),d(y,{flexSizing:0,children:[t(y,{children:t(O,{verticalAlign:"center",gap:"2/3",flexWrap:!1,className:m("FileName"),children:V?t(G,{children:d(Y,{gap:"1/2",flexSizing:0,children:[d(O,{gap:"2/3",verticalAlign:"center",children:[t(re.Normal,{tone:"border",wrapStyles:{flexSizing:"auto"},restrict:"fileName",name:"name",required:!0,id:N,form:"form-"+N,enableFormSubmit:!0,value:J,onKeyDown:f=>{let{key:k}=f;k=="Escape"&&b(!1)}}),d(y,{children:[". ",M]})]}),d(O,{gap:"2/3",horizontalAlign:"right",flexWrap:!1,children:[t(W.Button.Sub.R,{padding:["2/3",1],children:"\u9589\u3058\u308B",onClick:()=>{b(!1)}}),t(W.Button.Prime.R,{padding:["2/3",1],submitOption:{formName:"form-"+N,callback:f=>$(void 0,null,function*(){let{name:k}=f,w=[...n.dataValue],T=w[a],U=T.id;if(!T)return;let{target:r}=yield T.read();if(!r)return;let D=yield String(r.result).toBlob(l.type);if(!D)return;let z=new File([D],k+"."+M,{type:T.type});z.id=U,w[a]=z,p(x(g({},n),{dataValue:w,eventType:"update",eventID:h.uuid.gen()})),b(!1)})},children:"\u6C7A\u5B9A"})]})]})}):d(G,{children:[u,c?t(W.Button.Clear.R,{ssSphere:2.5,flexSizing:"none",color:"cloud",fontColor:"4.thin",padding:"1/3",ssEffectsOnActive:"expand",onClick:()=>{b(!0)},children:t(L.Pen,{})}):null]})})}),V?null:t(G,{children:t(y,{fontSize:"1.mini",fontColor:"4.thin",flexSizing:0,children:o+"\u30D5\u30A1\u30A4\u30EB / "+_+"B"})})]}),t(W.Button.Sub.R,{color:"cloud",fontColor:"4.thin",ssSphere:3,onClick:()=>{let f=[...n.dataValue];f[a]&&(f.splice(a,1),p(x(g({},n),{dataValue:f,eventType:"update",eventID:h.uuid.gen()})))},children:t(L.Times,{})})]})}},ce=e=>{let Z=e,{tone:a,required:l,form:s,fileNameEdit:n=!0,systemOnly:p=!1,accept:c="*",limit:u=1,checkValidationAtFirst:S,onChange:i,onValidate:V,onUpdateValue:b,onUpdateValidValue:N,value:_=[],className:J,cellStyles:M,cellClassName:o,componentID:f,status_id:k,enableFormSubmit:w}=Z,T=Q(Z,["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=X.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:[t("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?null:t(ee.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 a=e.dataTransfer.files;if(a.length){let l=e.target;if(P(l).hasClass(m("AddButton"))){let{componentId:s}=l.dataset,n=X.get(s);n&&n.AddFiles&&n.AddFiles(a)}}},options:{passive:!1}});const K=e=>{e=g({},e),e.override="force";let a=ae(e);return a.cellClassName=[a.cellClassName,se.Boxish(x(g({},a.cellStyles),{tone:a.tone})).className].join(" "),t(ne,{componentID:e.componentID,children:ce,params:a})};K.fn={openDialog:e=>{let{multiple:a,accept:l}=e;return new Promise(s=>{const n=document.createElement("input");n.type="file",n.multiple=a!=null?a:!0,l&&(l=="image"?n.accept="image/png,image/jpeg":n.accept=l),n.onchange=p=>{s(p.target.files)},n.click()})}};export{K as Filer,K as default};
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 +1,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};
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
+ };