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
package/dist/fn/Input/Chips/_.js
CHANGED
|
@@ -1,349 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-JJ3PEWPN.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
useState,
|
|
9
|
-
useEffect,
|
|
10
|
-
useRef
|
|
11
|
-
} from "react";
|
|
12
|
-
import {
|
|
13
|
-
$$,
|
|
14
|
-
$$fromRoot
|
|
15
|
-
} from "../../../@utils/_";
|
|
16
|
-
import Box from "../../../atoms/Box";
|
|
17
|
-
import FAI from "../../../atoms/FAI";
|
|
18
|
-
import Row from "../../../mols/Row";
|
|
19
|
-
import Button from "../../Button";
|
|
20
|
-
import Sheet from "../../Sheet";
|
|
21
|
-
import {
|
|
22
|
-
Wrapper,
|
|
23
|
-
BoxWrapper,
|
|
24
|
-
CommonEffects,
|
|
25
|
-
DefaultStyles
|
|
26
|
-
} from "../core";
|
|
27
|
-
import Hidden from "../Hidden";
|
|
28
|
-
import Selector from "./Selector";
|
|
29
|
-
function DefaultValidation(props) {
|
|
30
|
-
let {
|
|
31
|
-
value,
|
|
32
|
-
params
|
|
33
|
-
} = props;
|
|
34
|
-
let {
|
|
35
|
-
required
|
|
36
|
-
} = params;
|
|
37
|
-
let notice = [];
|
|
38
|
-
if (required && !value.length) {
|
|
39
|
-
notice.push({ type: "invalid", label: "\u4E00\u3064\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044" });
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
ok: !notice.filter(({ type }) => type == "invalid").length,
|
|
43
|
-
notice
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const Core = (params) => {
|
|
47
|
-
let _a = params, {
|
|
48
|
-
required,
|
|
49
|
-
form,
|
|
50
|
-
name,
|
|
51
|
-
checkValidationAtFirst,
|
|
52
|
-
onValidate,
|
|
53
|
-
onUpdateValue,
|
|
54
|
-
onUpdateValidValue,
|
|
55
|
-
value = [],
|
|
56
|
-
limit,
|
|
57
|
-
leftIndicator,
|
|
58
|
-
rightIndicator,
|
|
59
|
-
leftIcon,
|
|
60
|
-
rightIcon,
|
|
61
|
-
SelectedCellComponent,
|
|
62
|
-
AddButtonComponent,
|
|
63
|
-
componentID,
|
|
64
|
-
defaultOptions,
|
|
65
|
-
enableFormSubmit,
|
|
66
|
-
onDynamicSearch
|
|
67
|
-
} = _a, others = __objRest(_a, [
|
|
68
|
-
"required",
|
|
69
|
-
"form",
|
|
70
|
-
"name",
|
|
71
|
-
"checkValidationAtFirst",
|
|
72
|
-
"onValidate",
|
|
73
|
-
"onUpdateValue",
|
|
74
|
-
"onUpdateValidValue",
|
|
75
|
-
"value",
|
|
76
|
-
"limit",
|
|
77
|
-
"leftIndicator",
|
|
78
|
-
"rightIndicator",
|
|
79
|
-
"leftIcon",
|
|
80
|
-
"rightIcon",
|
|
81
|
-
"SelectedCellComponent",
|
|
82
|
-
"AddButtonComponent",
|
|
83
|
-
"componentID",
|
|
84
|
-
"defaultOptions",
|
|
85
|
-
"enableFormSubmit",
|
|
86
|
-
"onDynamicSearch"
|
|
87
|
-
]);
|
|
88
|
-
AddButtonComponent = AddButtonComponent;
|
|
89
|
-
let [val_selectorID] = useState($$.uuid.gen());
|
|
90
|
-
let [val_status, set_status] = useState({
|
|
91
|
-
componentID: params.componentID || "",
|
|
92
|
-
dataValue: value.map((val) => val),
|
|
93
|
-
eventID: $$.uuid.gen(),
|
|
94
|
-
eventType: "init"
|
|
95
|
-
});
|
|
96
|
-
let [val_validate, set_validate] = useState({
|
|
97
|
-
ok: false,
|
|
98
|
-
notice: []
|
|
99
|
-
});
|
|
100
|
-
let [val_selected, set_selected] = useState([...value]);
|
|
101
|
-
CommonEffects({
|
|
102
|
-
params,
|
|
103
|
-
val_status,
|
|
104
|
-
set_status,
|
|
105
|
-
val_validate,
|
|
106
|
-
set_validate,
|
|
107
|
-
DefaultValidation,
|
|
108
|
-
onUpdateValue,
|
|
109
|
-
onUpdateValidValue,
|
|
110
|
-
ExtraOverrideParams: {
|
|
111
|
-
formatValue: val_selected,
|
|
112
|
-
dataValue: val_selected.map((val) => val)
|
|
113
|
-
},
|
|
114
|
-
ExtraStoreParams: {
|
|
115
|
-
searchTimer: null
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
const UpdateValue = (values) => {
|
|
119
|
-
set_selected(values);
|
|
120
|
-
set_status(__spreadProps(__spreadValues({}, val_status), {
|
|
121
|
-
dataValue: values.map((val) => val),
|
|
122
|
-
eventID: $$.uuid.gen(),
|
|
123
|
-
eventType: "update"
|
|
124
|
-
}));
|
|
125
|
-
};
|
|
126
|
-
let Query = `[data-chips-input-wrapper="${val_selectorID}"]`;
|
|
127
|
-
const OpenSelector = () => {
|
|
128
|
-
Selector.openSelector({
|
|
129
|
-
parent: Query,
|
|
130
|
-
gravityPoint: params.selectorGravityPoint,
|
|
131
|
-
SelectorCellComponent: params.SelectorCellComponent,
|
|
132
|
-
selectorID: val_selectorID,
|
|
133
|
-
options: params.defaultOptions || [],
|
|
134
|
-
selected: val_selected,
|
|
135
|
-
limit: params.limit,
|
|
136
|
-
onDynamicSearch: params.onDynamicSearch,
|
|
137
|
-
onUpdated: (args) => {
|
|
138
|
-
UpdateValue(args.values);
|
|
139
|
-
},
|
|
140
|
-
onClosed: () => {
|
|
141
|
-
$$fromRoot(Query).focus();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
let isFully = limit && limit <= val_selected.length;
|
|
146
|
-
const mounted = useRef(false);
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (mounted.current) {
|
|
149
|
-
if (isFully) {
|
|
150
|
-
Sheet.close(val_selectorID);
|
|
151
|
-
$$fromRoot(`[data-chips-input-wrapper="${val_selectorID}"]`).focus();
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
mounted.current = true;
|
|
155
|
-
}
|
|
156
|
-
}, [val_selected]);
|
|
157
|
-
let Selected = val_selected.map((s) => {
|
|
158
|
-
let { value: value2, label } = s;
|
|
159
|
-
SelectedCellComponent = SelectedCellComponent;
|
|
160
|
-
const removeCallback = () => {
|
|
161
|
-
let findIndex = val_selected.findIndex((v) => v.value == value2);
|
|
162
|
-
if (findIndex == -1)
|
|
163
|
-
return;
|
|
164
|
-
let newSelected = [...val_selected];
|
|
165
|
-
newSelected.splice(findIndex, 1);
|
|
166
|
-
UpdateValue(newSelected);
|
|
167
|
-
if (!newSelected.length) {
|
|
168
|
-
setTimeout(() => {
|
|
169
|
-
$$fromRoot(`[data-chips-input-wrapper="${val_selectorID}"]`).focus();
|
|
170
|
-
}, 200);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
return /* @__PURE__ */ jsx(
|
|
174
|
-
SelectedCellComponent,
|
|
175
|
-
{
|
|
176
|
-
value: value2,
|
|
177
|
-
label,
|
|
178
|
-
removeCallback,
|
|
179
|
-
defaultRemoveButton: /* @__PURE__ */ jsx(
|
|
180
|
-
Button.Button.Sub.S,
|
|
181
|
-
{
|
|
182
|
-
flexSizing: "none",
|
|
183
|
-
color: "cloud",
|
|
184
|
-
backgroundColor: "cloud",
|
|
185
|
-
flexCenter: true,
|
|
186
|
-
isRounded: true,
|
|
187
|
-
freeCSS: {
|
|
188
|
-
aspectRatio: "1/1"
|
|
189
|
-
},
|
|
190
|
-
onClick: () => {
|
|
191
|
-
removeCallback();
|
|
192
|
-
},
|
|
193
|
-
children: /* @__PURE__ */ jsx(FAI.Times, {})
|
|
194
|
-
}
|
|
195
|
-
),
|
|
196
|
-
openCallback: () => {
|
|
197
|
-
OpenSelector();
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
JSON.stringify(value2)
|
|
201
|
-
);
|
|
202
|
-
});
|
|
203
|
-
return /* @__PURE__ */ jsxs(
|
|
204
|
-
BoxWrapper,
|
|
205
|
-
{
|
|
206
|
-
val_status,
|
|
207
|
-
set_status,
|
|
208
|
-
val_validate,
|
|
209
|
-
params,
|
|
210
|
-
children: [
|
|
211
|
-
/* @__PURE__ */ jsx(
|
|
212
|
-
Hidden,
|
|
213
|
-
{
|
|
214
|
-
"data-value": JSON.stringify(val_status.dataValue.map((v) => v.value)),
|
|
215
|
-
name,
|
|
216
|
-
form,
|
|
217
|
-
"data-input-type": "chips-" + ["single", "multi"][Number(params.limit != 1)],
|
|
218
|
-
"data-validation": val_validate.ok,
|
|
219
|
-
componentID: val_status.componentID,
|
|
220
|
-
"data-focusor": val_selectorID
|
|
221
|
-
}
|
|
222
|
-
),
|
|
223
|
-
/* @__PURE__ */ jsxs(
|
|
224
|
-
"button",
|
|
225
|
-
__spreadProps(__spreadValues({
|
|
226
|
-
"data-chips-input-wrapper": val_selectorID,
|
|
227
|
-
onKeyDown: (e) => {
|
|
228
|
-
let { key, ctrlKey, metaKey, keyCode } = e;
|
|
229
|
-
let auxKey = ctrlKey || metaKey;
|
|
230
|
-
let isString = keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode >= 96 && keyCode <= 105;
|
|
231
|
-
if (isString) {
|
|
232
|
-
if (isFully)
|
|
233
|
-
return;
|
|
234
|
-
OpenSelector();
|
|
235
|
-
} else if (key == "Tab") {
|
|
236
|
-
} else if (key == "Backspace") {
|
|
237
|
-
if (!val_selected.length)
|
|
238
|
-
return;
|
|
239
|
-
if (auxKey) {
|
|
240
|
-
UpdateValue([]);
|
|
241
|
-
} else {
|
|
242
|
-
let newSelected = [...val_selected];
|
|
243
|
-
newSelected.pop();
|
|
244
|
-
UpdateValue(newSelected);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
onClick: () => {
|
|
249
|
-
if (isFully)
|
|
250
|
-
return;
|
|
251
|
-
OpenSelector();
|
|
252
|
-
}
|
|
253
|
-
}, others), {
|
|
254
|
-
children: [
|
|
255
|
-
!isFully && /* @__PURE__ */ jsx(
|
|
256
|
-
AddButtonComponent,
|
|
257
|
-
{
|
|
258
|
-
selected: val_selected,
|
|
259
|
-
openCallback: OpenSelector
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
Selected
|
|
263
|
-
]
|
|
264
|
-
})
|
|
265
|
-
)
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
const ChipsInput = (params) => {
|
|
271
|
-
let DefaultValues = [...params.value || []];
|
|
272
|
-
let Values = DefaultValues.splice(0, params.limit || 65535);
|
|
273
|
-
return /* @__PURE__ */ jsx(
|
|
274
|
-
Core,
|
|
275
|
-
__spreadProps(__spreadValues({
|
|
276
|
-
SelectedCellComponent: (params2) => {
|
|
277
|
-
let {
|
|
278
|
-
value,
|
|
279
|
-
label,
|
|
280
|
-
removeCallback
|
|
281
|
-
} = params2;
|
|
282
|
-
return /* @__PURE__ */ jsxs(
|
|
283
|
-
Row.Left,
|
|
284
|
-
{
|
|
285
|
-
ssCardBox: true,
|
|
286
|
-
padding: "1/3",
|
|
287
|
-
gap: 0,
|
|
288
|
-
isRounded: true,
|
|
289
|
-
textAlign: "left",
|
|
290
|
-
children: [
|
|
291
|
-
/* @__PURE__ */ jsx(
|
|
292
|
-
Box,
|
|
293
|
-
{
|
|
294
|
-
padding: [0, "1/2"],
|
|
295
|
-
children: label
|
|
296
|
-
}
|
|
297
|
-
),
|
|
298
|
-
params2.defaultRemoveButton
|
|
299
|
-
]
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
},
|
|
303
|
-
AddButtonComponent: (props) => {
|
|
304
|
-
if (params.limit && params.limit <= props.selected.length)
|
|
305
|
-
return null;
|
|
306
|
-
return /* @__PURE__ */ jsxs(
|
|
307
|
-
Button.Button.Sub.R,
|
|
308
|
-
{
|
|
309
|
-
color: "cloud",
|
|
310
|
-
padding: "1/2",
|
|
311
|
-
onClick: () => {
|
|
312
|
-
props.openCallback();
|
|
313
|
-
},
|
|
314
|
-
children: [
|
|
315
|
-
/* @__PURE__ */ jsx(FAI.Plus, {}),
|
|
316
|
-
"\u8FFD\u52A0\u3059\u308B"
|
|
317
|
-
]
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
}, params), {
|
|
322
|
-
value: Values
|
|
323
|
-
})
|
|
324
|
-
);
|
|
325
|
-
};
|
|
326
|
-
const Chips = (rawParams) => {
|
|
327
|
-
rawParams = __spreadValues({}, rawParams);
|
|
328
|
-
rawParams = __spreadValues({
|
|
329
|
-
gap: 1,
|
|
330
|
-
display: "flex",
|
|
331
|
-
horizontalAlign: "left",
|
|
332
|
-
verticalAlign: "center",
|
|
333
|
-
flexWrap: true
|
|
334
|
-
}, rawParams);
|
|
335
|
-
let params = DefaultStyles.Boxish(rawParams);
|
|
336
|
-
return /* @__PURE__ */ jsx(
|
|
337
|
-
Wrapper,
|
|
338
|
-
{
|
|
339
|
-
componentID: rawParams.componentID,
|
|
340
|
-
children: ChipsInput,
|
|
341
|
-
params
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
};
|
|
345
|
-
Chips.fn = Selector;
|
|
346
|
-
export {
|
|
347
|
-
Chips,
|
|
348
|
-
Chips as default
|
|
349
|
-
};
|
|
1
|
+
import{b as u,c as h,d as N}from"../../../chunk-VY3566IV.js";import{jsx as a,jsxs as b}from"react/jsx-runtime";import{useState as v,useEffect as L,useRef as H}from"react";import{$$ as B,$$fromRoot as T}from"../../../@utils/_";import Q from"../../../atoms/Box";import P from"../../../atoms/FAI";import X from"../../../mols/Row";import U from"../../Button";import Y from"../../Sheet";import{Wrapper as Z,BoxWrapper as j,CommonEffects as ee,DefaultStyles as te}from"../core";import ne from"../Hidden";import W from"./Selector";function oe(e){let{value:r,params:c}=e,{required:o}=c,s=[];return o&&!r.length&&s.push({type:"invalid",label:"\u4E00\u3064\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),{ok:!s.filter(({type:f})=>f=="invalid").length,notice:s}}const le=e=>{let $=e,{required:r,form:c,name:o,checkValidationAtFirst:s,onValidate:f,onUpdateValue:O,onUpdateValidValue:M,value:F=[],limit:A,leftIndicator:ie,rightIndicator:pe,leftIcon:ue,rightIcon:re,SelectedCellComponent:g,AddButtonComponent:x,componentID:ce,defaultOptions:se,enableFormSubmit:de,onDynamicSearch:me}=$,q=N($,["required","form","name","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","limit","leftIndicator","rightIndicator","leftIcon","rightIcon","SelectedCellComponent","AddButtonComponent","componentID","defaultOptions","enableFormSubmit","onDynamicSearch"]);x=x;let[p]=v(B.uuid.gen()),[d,R]=v({componentID:e.componentID||"",dataValue:F.map(t=>t),eventID:B.uuid.gen(),eventType:"init"}),[D,z]=v({ok:!1,notice:[]}),[n,G]=v([...F]);ee({params:e,val_status:d,set_status:R,val_validate:D,set_validate:z,DefaultValidation:oe,onUpdateValue:O,onUpdateValidValue:M,ExtraOverrideParams:{formatValue:n,dataValue:n.map(t=>t)},ExtraStoreParams:{searchTimer:null}});const C=t=>{G(t),R(h(u({},d),{dataValue:t.map(i=>i),eventID:B.uuid.gen(),eventType:"update"}))};let E=`[data-chips-input-wrapper="${p}"]`;const y=()=>{W.openSelector({parent:E,gravityPoint:e.selectorGravityPoint,SelectorCellComponent:e.SelectorCellComponent,selectorID:p,options:e.defaultOptions||[],selected:n,limit:e.limit,onDynamicSearch:e.onDynamicSearch,onUpdated:t=>{C(t.values)},onClosed:()=>{T(E).focus()}})};let S=A&&A<=n.length;const _=H(!1);L(()=>{_.current?S&&(Y.close(p),T(`[data-chips-input-wrapper="${p}"]`).focus()):_.current=!0},[n]);let J=n.map(t=>{let{value:i,label:k}=t;g=g;const I=()=>{let l=n.findIndex(w=>w.value==i);if(l==-1)return;let m=[...n];m.splice(l,1),C(m),m.length||setTimeout(()=>{T(`[data-chips-input-wrapper="${p}"]`).focus()},200)};return a(g,{value:i,label:k,removeCallback:I,defaultRemoveButton:a(U.Button.Sub.S,{flexSizing:"none",color:"cloud",backgroundColor:"cloud",flexCenter:!0,isRounded:!0,freeCSS:{aspectRatio:"1/1"},onClick:()=>{I()},children:a(P.Times,{})}),openCallback:()=>{y()}},JSON.stringify(i))});return b(j,{val_status:d,set_status:R,val_validate:D,params:e,children:[a(ne,{"data-value":JSON.stringify(d.dataValue.map(t=>t.value)),name:o,form:c,"data-input-type":"chips-"+["single","multi"][+(e.limit!=1)],"data-validation":D.ok,componentID:d.componentID,"data-focusor":p}),b("button",h(u({"data-chips-input-wrapper":p,onKeyDown:t=>{let{key:i,ctrlKey:k,metaKey:I,keyCode:l}=t,m=k||I;if(l>=48&&l<=57||l>=65&&l<=90||l>=96&&l<=105){if(S)return;y()}else if(i!="Tab"){if(i=="Backspace"){if(!n.length)return;if(m)C([]);else{let K=[...n];K.pop(),C(K)}}}},onClick:()=>{S||y()}},q),{children:[!S&&a(x,{selected:n,openCallback:y}),J]}))]})},ae=e=>{let c=[...e.value||[]].splice(0,e.limit||65535);return a(le,h(u({SelectedCellComponent:o=>{let{value:s,label:f,removeCallback:O}=o;return b(X.Left,{ssCardBox:!0,padding:"1/3",gap:0,isRounded:!0,textAlign:"left",children:[a(Q,{padding:[0,"1/2"],children:f}),o.defaultRemoveButton]})},AddButtonComponent:o=>e.limit&&e.limit<=o.selected.length?null:b(U.Button.Sub.R,{color:"cloud",padding:"1/2",onClick:()=>{o.openCallback()},children:[a(P.Plus,{}),"\u8FFD\u52A0\u3059\u308B"]})},e),{value:c}))},V=e=>{e=u({},e),e=u({gap:1,display:"flex",horizontalAlign:"left",verticalAlign:"center",flexWrap:!0},e);let r=te.Boxish(e);return a(Z,{componentID:e.componentID,children:ae,params:r})};V.fn=W;export{V as Chips,V as default};
|
|
@@ -1,160 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../chunk-JJ3PEWPN.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
useState
|
|
9
|
-
} from "react";
|
|
10
|
-
import {
|
|
11
|
-
$$
|
|
12
|
-
} from "../../@utils/_";
|
|
13
|
-
import {
|
|
14
|
-
Wrapper,
|
|
15
|
-
BoxWrapper,
|
|
16
|
-
SubmitForm,
|
|
17
|
-
CommonEffects,
|
|
18
|
-
DefaultStyles
|
|
19
|
-
} from "./core";
|
|
20
|
-
function DefaultValidation(props) {
|
|
21
|
-
let { value, params } = props;
|
|
22
|
-
let { required } = params;
|
|
23
|
-
let notice = [];
|
|
24
|
-
if (required && !value) {
|
|
25
|
-
notice.push({ type: "invalid", label: "\u5FC5\u9808\u9805\u76EE\u3067\u3059" });
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
ok: !notice.filter(({ type }) => type == "invalid").length,
|
|
29
|
-
notice
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
const ContenteditableInput = (params) => {
|
|
33
|
-
let _a = params, {
|
|
34
|
-
componentID,
|
|
35
|
-
tone,
|
|
36
|
-
required,
|
|
37
|
-
form,
|
|
38
|
-
value,
|
|
39
|
-
enableFormSubmit,
|
|
40
|
-
checkValidationAtFirst,
|
|
41
|
-
onInput,
|
|
42
|
-
onKeyDown,
|
|
43
|
-
onValidate,
|
|
44
|
-
onUpdateValue,
|
|
45
|
-
onUpdateValidValue,
|
|
46
|
-
children = "",
|
|
47
|
-
leftIndicator,
|
|
48
|
-
rightIndicator,
|
|
49
|
-
leftIcon,
|
|
50
|
-
rightIcon
|
|
51
|
-
} = _a, others = __objRest(_a, [
|
|
52
|
-
"componentID",
|
|
53
|
-
"tone",
|
|
54
|
-
"required",
|
|
55
|
-
"form",
|
|
56
|
-
"value",
|
|
57
|
-
"enableFormSubmit",
|
|
58
|
-
"checkValidationAtFirst",
|
|
59
|
-
"onInput",
|
|
60
|
-
"onKeyDown",
|
|
61
|
-
"onValidate",
|
|
62
|
-
"onUpdateValue",
|
|
63
|
-
"onUpdateValidValue",
|
|
64
|
-
"children",
|
|
65
|
-
"leftIndicator",
|
|
66
|
-
"rightIndicator",
|
|
67
|
-
"leftIcon",
|
|
68
|
-
"rightIcon"
|
|
69
|
-
]);
|
|
70
|
-
let Default_Status = {
|
|
71
|
-
componentID,
|
|
72
|
-
dataValue: value,
|
|
73
|
-
eventType: "init",
|
|
74
|
-
eventID: $$.uuid.gen()
|
|
75
|
-
};
|
|
76
|
-
let [val_status, set_status] = useState(Default_Status);
|
|
77
|
-
let [val_validate, set_validate] = useState({
|
|
78
|
-
ok: false,
|
|
79
|
-
notice: []
|
|
80
|
-
});
|
|
81
|
-
CommonEffects({
|
|
82
|
-
params,
|
|
83
|
-
val_status,
|
|
84
|
-
set_status,
|
|
85
|
-
val_validate,
|
|
86
|
-
set_validate,
|
|
87
|
-
onUpdateValue,
|
|
88
|
-
onUpdateValidValue,
|
|
89
|
-
DefaultValidation
|
|
90
|
-
});
|
|
91
|
-
return /* @__PURE__ */ jsx(
|
|
92
|
-
BoxWrapper,
|
|
93
|
-
{
|
|
94
|
-
val_status,
|
|
95
|
-
set_status,
|
|
96
|
-
val_validate,
|
|
97
|
-
params,
|
|
98
|
-
children: /* @__PURE__ */ jsx(
|
|
99
|
-
"div",
|
|
100
|
-
__spreadProps(__spreadValues({
|
|
101
|
-
contentEditable: true,
|
|
102
|
-
"data-form": form,
|
|
103
|
-
"data-name": params.name,
|
|
104
|
-
"data-input-type": "contenteditable",
|
|
105
|
-
"data-validation": val_validate.ok,
|
|
106
|
-
"data-value": val_status.dataValue,
|
|
107
|
-
"data-component-id": val_status.componentID,
|
|
108
|
-
onKeyDown: (event) => {
|
|
109
|
-
!!onKeyDown && onKeyDown(event);
|
|
110
|
-
!!enableFormSubmit && SubmitForm(event);
|
|
111
|
-
},
|
|
112
|
-
onInput: (event) => {
|
|
113
|
-
let contentEditor = event.currentTarget;
|
|
114
|
-
let {
|
|
115
|
-
innerHTML,
|
|
116
|
-
innerText
|
|
117
|
-
} = contentEditor;
|
|
118
|
-
if (val_validate.ok)
|
|
119
|
-
set_validate({ ok: false, notice: [] });
|
|
120
|
-
set_status(__spreadProps(__spreadValues({}, val_status), {
|
|
121
|
-
dataValue: innerText,
|
|
122
|
-
eventType: "update",
|
|
123
|
-
eventID: $$.uuid.gen()
|
|
124
|
-
}));
|
|
125
|
-
onInput && onInput(event);
|
|
126
|
-
}
|
|
127
|
-
}, others), {
|
|
128
|
-
children
|
|
129
|
-
})
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
|
-
const Contenteditable = (rawParams) => {
|
|
135
|
-
var _a, _b;
|
|
136
|
-
rawParams = __spreadValues({}, rawParams);
|
|
137
|
-
if (rawParams.rightIcon)
|
|
138
|
-
rawParams.paddingRight = (_a = rawParams.paddingRight) != null ? _a : 3;
|
|
139
|
-
if (rawParams.leftIcon)
|
|
140
|
-
rawParams.paddingLeft = (_b = rawParams.paddingLeft) != null ? _b : 3;
|
|
141
|
-
rawParams = __spreadProps(__spreadValues({}, rawParams), {
|
|
142
|
-
freeCSS: __spreadValues({
|
|
143
|
-
whiteSpace: "pre-wrap"
|
|
144
|
-
}, rawParams.freeCSS)
|
|
145
|
-
});
|
|
146
|
-
let params = DefaultStyles.Boxish(rawParams);
|
|
147
|
-
params.rows = params.rows || 5;
|
|
148
|
-
return /* @__PURE__ */ jsx(
|
|
149
|
-
Wrapper,
|
|
150
|
-
{
|
|
151
|
-
componentID: rawParams.componentID,
|
|
152
|
-
children: ContenteditableInput,
|
|
153
|
-
params
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
};
|
|
157
|
-
export {
|
|
158
|
-
Contenteditable,
|
|
159
|
-
Contenteditable as default
|
|
160
|
-
};
|
|
1
|
+
import{b as n,c as u,d as y}from"../../chunk-VY3566IV.js";import{jsx as s}from"react/jsx-runtime";import{useState as T}from"react";import{$$ as g}from"../../@utils/_";import{Wrapper as _,BoxWrapper as k,SubmitForm as L,CommonEffects as F,DefaultStyles as B}from"./core";function H(t){let{value:e,params:o}=t,{required:a}=o,i=[];return a&&!e&&i.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!i.filter(({type:c})=>c=="invalid").length,notice:i}}const M=t=>{let v=t,{componentID:e,tone:o,required:a,form:i,value:c,enableFormSubmit:b,checkValidationAtFirst:W,onInput:f,onKeyDown:I,onValidate:q,onUpdateValue:D,onUpdateValidValue:R,children:C="",leftIndicator:A,rightIndicator:K,leftIcon:U,rightIcon:$}=v,V=y(v,["componentID","tone","required","form","value","enableFormSubmit","checkValidationAtFirst","onInput","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","children","leftIndicator","rightIndicator","leftIcon","rightIcon"]),E={componentID:e,dataValue:c,eventType:"init",eventID:g.uuid.gen()},[l,r]=T(E),[d,m]=T({ok:!1,notice:[]});return F({params:t,val_status:l,set_status:r,val_validate:d,set_validate:m,onUpdateValue:D,onUpdateValidValue:R,DefaultValidation:H}),s(k,{val_status:l,set_status:r,val_validate:d,params:t,children:s("div",u(n({contentEditable:!0,"data-form":i,"data-name":t.name,"data-input-type":"contenteditable","data-validation":d.ok,"data-value":l.dataValue,"data-component-id":l.componentID,onKeyDown:p=>{I&&I(p),b&&L(p)},onInput:p=>{let S=p.currentTarget,{innerHTML:N,innerText:x}=S;d.ok&&m({ok:!1,notice:[]}),r(u(n({},l),{dataValue:x,eventType:"update",eventID:g.uuid.gen()})),f&&f(p)}},V),{children:C}))})},h=t=>{var o,a;t=n({},t),t.rightIcon&&(t.paddingRight=(o=t.paddingRight)!=null?o:3),t.leftIcon&&(t.paddingLeft=(a=t.paddingLeft)!=null?a:3),t=u(n({},t),{freeCSS:n({whiteSpace:"pre-wrap"},t.freeCSS)});let e=B.Boxish(t);return e.rows=e.rows||5,s(_,{componentID:t.componentID,children:M,params:e})};export{h as Contenteditable,h as default};
|