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,1457 +1 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "../../../chunk-JJ3PEWPN.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { createElement } from "react";
7
- import {
8
- useState,
9
- useEffect,
10
- useRef
11
- } from "react";
12
- import {
13
- $$
14
- } from "../../../@utils/_";
15
- import Box from "../../../atoms/Box";
16
- import FAI from "../../../atoms/FAI";
17
- import Flex from "../../../atoms/Flex";
18
- import Grid from "../../../atoms/Grid";
19
- import Row from "../../../mols/Row";
20
- import Column from "../../../mols/Column";
21
- import Text from "../../../mols/Text";
22
- import Button from "../../Button";
23
- import Tooltips from "../../Tooltips";
24
- import Select from "../Select";
25
- import { List } from "../List";
26
- import { InputTimeClasses } from "../../../@styles/componentClasses/_";
27
- let YearOptions = (params) => {
28
- var _a, _b;
29
- let Years = [];
30
- let minYear = Number((_a = params == null ? void 0 : params.min) != null ? _a : 1900);
31
- let maxYear = Number((_b = params == null ? void 0 : params.max) != null ? _b : $$.Time().addYear(10).year);
32
- for (let year = minYear; year <= maxYear; year++) {
33
- Years.unshift({
34
- value: year,
35
- label: [year, ...$$.transformer.wareki(year).value].join(" - ")
36
- // displayLabel: year + '年'
37
- });
38
- }
39
- return Years;
40
- };
41
- const Picker = (params) => {
42
- let {
43
- restrict,
44
- era = "year",
45
- defaultValue = ""
46
- } = params;
47
- params = __spreadValues({}, params);
48
- params.tipsID = params.tipsID || $$.uuid.gen();
49
- const mounted = useRef(false);
50
- let [val_value, set_value] = useState((() => {
51
- var _a, _b;
52
- if (restrict == "clock") {
53
- let partValues = String(defaultValue).split(/[^\d]/);
54
- if (!partValues[0])
55
- partValues = [0, 0];
56
- let hour = Number(partValues[0]);
57
- let minutes = Number(partValues[1]);
58
- return {
59
- modifiedType: "init",
60
- hour,
61
- minutes
62
- };
63
- } else if (restrict == "date") {
64
- let [year, month, date] = (_a = String(defaultValue)) == null ? void 0 : _a.split(/\D/);
65
- if ($$.is.nullish(year) || $$.is.nullish(month) || $$.is.nullish(date)) {
66
- [year, month, date] = $$.Time().toFormat("%Y-%M-%D").split("-");
67
- }
68
- return {
69
- modifiedType: "init",
70
- year: Number(year),
71
- month: Number(month),
72
- date: Number(date)
73
- };
74
- } else if (restrict == "week") {
75
- } else if (restrict == "month") {
76
- let [year, month] = String(defaultValue).split(/\D/);
77
- if ($$.is.nullish(year) || $$.is.nullish(month)) {
78
- [year, month] = $$.Time().toFormat("%Y-%M").split("-");
79
- }
80
- return {
81
- modifiedType: "init",
82
- year: Number(year),
83
- month: Number(month)
84
- };
85
- } else if (restrict == "year") {
86
- let [year] = String(defaultValue).split(/\D/);
87
- if ($$.is.nullish(year)) {
88
- [year] = $$.Time().toFormat("%Y").split("-");
89
- }
90
- return {
91
- modifiedType: "init",
92
- year: Number(year)
93
- };
94
- } else if (restrict == "dateWareki") {
95
- let [year, month, date] = (_b = String(defaultValue)) == null ? void 0 : _b.split(/\D/);
96
- if ($$.is.nullish(year) || $$.is.nullish(month) || $$.is.nullish(date)) {
97
- [year, month, date] = $$.Time().toFormat("%Y-%M-%D").split("-");
98
- }
99
- return {
100
- modifiedType: "init",
101
- era: era || "year",
102
- year: Number(year),
103
- month: Number(month),
104
- date: Number(date)
105
- };
106
- }
107
- return {};
108
- })());
109
- useEffect(() => {
110
- if (mounted.current) {
111
- if (val_value.modifiedType == "update") {
112
- let sendValue = "";
113
- let sendEra = era || "year";
114
- if (restrict == "clock") {
115
- let { hour, minutes } = val_value;
116
- sendValue = [
117
- hour.zeroEmbed(2),
118
- minutes.zeroEmbed(2)
119
- ].join("/");
120
- } else if (restrict == "date") {
121
- let { year, month, date } = val_value;
122
- sendValue = [
123
- year,
124
- month.zeroEmbed(2),
125
- date.zeroEmbed(2)
126
- ].join("/");
127
- } else if (restrict == "week") {
128
- } else if (restrict == "month") {
129
- let { year, month } = val_value;
130
- sendValue = [
131
- year,
132
- month.zeroEmbed(2)
133
- ].join("/");
134
- } else if (restrict == "year") {
135
- let { year } = val_value;
136
- sendValue = String(year);
137
- } else if (restrict == "dateWareki") {
138
- let {
139
- year,
140
- month,
141
- date,
142
- era: era2
143
- } = val_value;
144
- sendEra = era2;
145
- sendValue = [
146
- year,
147
- month.zeroEmbed(2),
148
- date.zeroEmbed(2)
149
- ].join("/");
150
- }
151
- params.onValueUpdate(sendValue, sendEra);
152
- }
153
- } else {
154
- mounted.current = true;
155
- }
156
- }, [val_value]);
157
- let Params = __spreadProps(__spreadValues({}, params), {
158
- val_value,
159
- set_value
160
- });
161
- return /* @__PURE__ */ jsx(
162
- Box,
163
- {
164
- backgroundColor: "1.layer.base",
165
- borderRadius: "2.tone.secondary",
166
- boxShadow: "1.remark",
167
- border: true,
168
- overflow: "hidden",
169
- children: /* @__PURE__ */ jsx(
170
- Box,
171
- {
172
- overflow: "auto",
173
- className: InputTimeClasses(restrict.toCapital() + "Base"),
174
- children: restrict == "clock" ? /* @__PURE__ */ jsx(Comps.Clock._, __spreadValues({}, Params)) : restrict == "date" ? /* @__PURE__ */ jsx(Comps.Date._, __spreadValues({}, Params)) : restrict == "week" ? "" : restrict == "month" ? /* @__PURE__ */ jsx(Comps.Month._, __spreadValues({}, Params)) : restrict == "year" ? /* @__PURE__ */ jsx(Comps.Year._, __spreadValues({}, Params)) : restrict == "dates" ? "" : restrict == "months" ? "" : restrict == "dateWareki" ? /* @__PURE__ */ jsx(Comps.DateWareki._, __spreadValues({}, Params)) : /* @__PURE__ */ jsx(Fragment, {})
175
- }
176
- )
177
- }
178
- );
179
- };
180
- const Comps = {
181
- Clock: {
182
- _: (params) => {
183
- let {
184
- min,
185
- max,
186
- onValueUpdate,
187
- tipsID,
188
- val_value,
189
- set_value
190
- } = params;
191
- let [val_ampm, set_ampm] = useState(val_value.hour > 12 ? 2 : 1);
192
- let [val_unit, set_unit] = useState(Number(localStorage.getItem("timePickerUnit") || 5));
193
- useEffect(() => {
194
- localStorage.setItem("timePickerUnit", String(val_unit));
195
- }, [val_unit]);
196
- let { hour, minutes } = val_value;
197
- return /* @__PURE__ */ jsxs(
198
- Column,
199
- {
200
- padding: 1,
201
- children: [
202
- /* @__PURE__ */ jsxs(
203
- Flex,
204
- {
205
- flexType: "row",
206
- flexWrap: false,
207
- gap: 1,
208
- className: InputTimeClasses("Body"),
209
- children: [
210
- /* @__PURE__ */ jsxs(
211
- Column,
212
- {
213
- className: InputTimeClasses("DesignSide"),
214
- flexSizing: 0,
215
- children: [
216
- /* @__PURE__ */ jsx(
217
- Box,
218
- {
219
- className: InputTimeClasses("ClockUiBase"),
220
- padding: [1, "2/3"],
221
- flexCenter: true,
222
- children: /* @__PURE__ */ jsxs(
223
- Box,
224
- {
225
- className: InputTimeClasses("ClockUi"),
226
- backgroundColor: "tcOpLow",
227
- isRounded: true,
228
- position: "relative",
229
- children: [
230
- /* @__PURE__ */ jsx(
231
- Box,
232
- {
233
- position: "absolute",
234
- backgroundColor: "theme",
235
- unitWidth: "1/12",
236
- className: [
237
- InputTimeClasses("Needle"),
238
- InputTimeClasses("hour")
239
- ].join(" "),
240
- freeCSS: {
241
- transform: `rotate(${hour * 30 + minutes / 2}deg)`
242
- }
243
- }
244
- ),
245
- /* @__PURE__ */ jsx(
246
- Box,
247
- {
248
- position: "absolute",
249
- backgroundColor: "theme",
250
- unitWidth: "1/12",
251
- className: [
252
- InputTimeClasses("Needle"),
253
- InputTimeClasses("minute")
254
- ].join(" "),
255
- freeCSS: {
256
- transform: `rotate(${minutes * 6}deg)`
257
- }
258
- }
259
- )
260
- ]
261
- }
262
- )
263
- }
264
- ),
265
- /* @__PURE__ */ jsx(
266
- List.Radio,
267
- {
268
- tone: "plain",
269
- icon: true,
270
- value: [val_ampm],
271
- options: [
272
- { value: 1, label: "AM" },
273
- { value: 2, label: "PM" }
274
- ],
275
- flexType: "col",
276
- gap: 0,
277
- cellStyles: {
278
- padding: "1/2",
279
- horizontalAlign: "between",
280
- gap: "1/3"
281
- },
282
- tabIndex: -1,
283
- onUpdateValidValue: ({ value }) => {
284
- let prevHour = val_value.hour % 12;
285
- let Hour = prevHour + (value == 2 ? 12 : 0);
286
- set_ampm(value);
287
- set_value({
288
- modifiedType: "update",
289
- hour: Hour,
290
- minutes: val_value.minutes
291
- });
292
- }
293
- }
294
- ),
295
- /* @__PURE__ */ jsx(Box, { borderTop: true, margin: [0, 1] }),
296
- /* @__PURE__ */ jsx(
297
- List.Radio,
298
- {
299
- tone: "plain",
300
- icon: true,
301
- value: [val_unit],
302
- options: [
303
- { value: 1, label: "/ 1\u5206" },
304
- { value: 2, label: "/ 2\u5206" },
305
- { value: 5, label: "/ 5\u5206" }
306
- ],
307
- flexType: "col",
308
- gap: 0,
309
- cellStyles: {
310
- padding: "1/2",
311
- horizontalAlign: "between",
312
- gap: "1/3"
313
- },
314
- tabIndex: -1,
315
- onUpdateValidValue: ({ value }) => {
316
- set_unit(value);
317
- }
318
- }
319
- )
320
- ]
321
- }
322
- ),
323
- /* @__PURE__ */ jsxs(Column, { children: [
324
- /* @__PURE__ */ jsxs(
325
- Box,
326
- {
327
- flexCenter: true,
328
- fontSize: "3.paragraph",
329
- isSemiBoldFont: true,
330
- children: [
331
- val_value.hour.zeroEmbed(2),
332
- " : ",
333
- val_value.minutes.zeroEmbed(2)
334
- ]
335
- }
336
- ),
337
- /* @__PURE__ */ jsxs(
338
- Flex,
339
- {
340
- flexWrap: false,
341
- borderRadius: "1.tone.primary",
342
- boxShadow: "0.remark.inset",
343
- flexChilds: "even",
344
- freeCSS: {
345
- minWidth: 12 * 12
346
- },
347
- padding: ["1/3", 0],
348
- children: [
349
- /* @__PURE__ */ jsx(
350
- Column,
351
- {
352
- gap: 0,
353
- overflow: "auto",
354
- padding: "2/3",
355
- borderRight: true,
356
- freeCSS: {
357
- maxHeight: 12 * 22
358
- },
359
- children: Comps.Clock.Hours({
360
- onClick: (index) => {
361
- let Hour = index + (val_ampm == 2 ? 12 : 0);
362
- set_value({
363
- modifiedType: "update",
364
- hour: Hour,
365
- minutes: val_value.minutes
366
- });
367
- },
368
- min,
369
- max,
370
- ampm: val_ampm
371
- })
372
- }
373
- ),
374
- /* @__PURE__ */ jsx(
375
- Column,
376
- {
377
- gap: 0,
378
- overflow: "auto",
379
- padding: "2/3",
380
- freeCSS: {
381
- maxHeight: 12 * 22
382
- },
383
- children: Comps.Clock.Minutes({
384
- onClick: (index) => {
385
- set_value({
386
- modifiedType: "update",
387
- hour: val_value.hour,
388
- minutes: index
389
- });
390
- },
391
- min,
392
- max,
393
- unit: val_unit
394
- })
395
- }
396
- )
397
- ]
398
- }
399
- )
400
- ] })
401
- ]
402
- }
403
- ),
404
- /* @__PURE__ */ jsx(
405
- Comps.Variables.Footer,
406
- {
407
- tipsID,
408
- onValueUpdate
409
- }
410
- )
411
- ]
412
- }
413
- );
414
- },
415
- Hours: (params) => {
416
- let list = [];
417
- for (let index = 0; index < 12; index++) {
418
- let labelIndex = params.ampm == 2 ? index + 12 : index;
419
- let Disabled = false;
420
- {
421
- let VAL = Number(String(labelIndex * 100).replace(/\D/ig, ""));
422
- if (params.min) {
423
- let MIN = Number(String(params.min).replace(/\D/ig, ""));
424
- if (MIN > VAL)
425
- Disabled = true;
426
- }
427
- if (params.max) {
428
- let MAX = Number(String(params.max).replace(/\D/ig, ""));
429
- if (VAL > MAX)
430
- Disabled = true;
431
- }
432
- }
433
- list.push(/* @__PURE__ */ jsx(
434
- Button.Button.Normal.R,
435
- {
436
- isLocked: Disabled,
437
- borderBottom: true,
438
- borderRadius: 0,
439
- padding: ["1/2", 1],
440
- freeCSS: { whiteSpace: "nowrap" },
441
- tabIndex: -1,
442
- onClick: () => {
443
- params.onClick(index);
444
- },
445
- children: labelIndex.zeroEmbed(2)
446
- },
447
- index
448
- ));
449
- }
450
- return list;
451
- },
452
- Minutes: (params) => {
453
- let list = [];
454
- for (let index = 0; index < 60 / params.unit; index++) {
455
- let Value = index * params.unit;
456
- list.push(/* @__PURE__ */ jsx(
457
- Button.Button.Normal.R,
458
- {
459
- borderBottom: true,
460
- borderRadius: 0,
461
- padding: ["1/2", 1],
462
- freeCSS: { whiteSpace: "nowrap" },
463
- tabIndex: -1,
464
- onClick: () => {
465
- params.onClick(Value);
466
- },
467
- children: Value.zeroEmbed(2)
468
- },
469
- Value
470
- ));
471
- }
472
- return list;
473
- }
474
- },
475
- Date: {
476
- _: (params) => {
477
- let {
478
- min,
479
- max,
480
- onValueUpdate,
481
- tipsID,
482
- val_value,
483
- set_value
484
- } = params;
485
- let { year, month, date } = val_value;
486
- return /* @__PURE__ */ jsxs(
487
- Column,
488
- {
489
- padding: 1,
490
- children: [
491
- /* @__PURE__ */ jsxs(
492
- Flex,
493
- {
494
- horizontalAlign: "between",
495
- verticalAlign: "center",
496
- flexWrap: false,
497
- children: [
498
- /* @__PURE__ */ jsxs(
499
- Flex,
500
- {
501
- verticalAlign: "bottom",
502
- horizontalAlign: "left",
503
- gap: "2/3",
504
- flexWrap: false,
505
- children: [
506
- /* @__PURE__ */ jsx(
507
- Select,
508
- {
509
- override: "force",
510
- enableUnSelected: false,
511
- value: year,
512
- options: YearOptions(),
513
- border: "1.thin",
514
- padding: ["1/3", "2/3"],
515
- paddingRight: 2,
516
- rightIconStyles: {
517
- right: "1/3"
518
- },
519
- onUpdateValidValue: ({ value }) => {
520
- set_value({
521
- modifiedType: "update",
522
- year: Number(value),
523
- month,
524
- date
525
- });
526
- }
527
- }
528
- ),
529
- /* @__PURE__ */ jsx(
530
- Select,
531
- {
532
- override: "force",
533
- enableUnSelected: false,
534
- value: month,
535
- options: (() => {
536
- let options = [];
537
- for (let i = 1; i <= 12; i++) {
538
- options.push({
539
- value: i,
540
- label: String(i),
541
- displayLabel: String(i) + "\u6708"
542
- });
543
- }
544
- return options;
545
- })(),
546
- placeholder: "",
547
- border: "1.thin",
548
- padding: ["1/3", "2/3"],
549
- paddingRight: 2,
550
- rightIconStyles: {
551
- right: "1/3"
552
- },
553
- onUpdateValidValue: ({ value }) => {
554
- set_value({
555
- modifiedType: "update",
556
- year,
557
- month: Number(value),
558
- date
559
- });
560
- }
561
- }
562
- )
563
- ]
564
- }
565
- ),
566
- /* @__PURE__ */ jsx(
567
- Comps.Variables.ShiftButtons,
568
- {
569
- callback: (dir) => {
570
- let newMonth = month + dir;
571
- let newYear = year;
572
- if (dir == -1) {
573
- if (newMonth <= 0)
574
- newYear--;
575
- newMonth = newMonth || 12;
576
- } else {
577
- if (month == 12)
578
- newYear++;
579
- }
580
- set_value({
581
- modifiedType: "update",
582
- year: newYear,
583
- month: newMonth,
584
- date: val_value.date
585
- });
586
- }
587
- }
588
- )
589
- ]
590
- }
591
- ),
592
- /* @__PURE__ */ jsx(Box, { borderTop: true }),
593
- /* @__PURE__ */ jsx(
594
- Box,
595
- {
596
- children: Comps.Date.MonthCalendar({
597
- min,
598
- max,
599
- year: val_value.year,
600
- month: val_value.month,
601
- current: [val_value.year, val_value.month, val_value.date],
602
- callback: (val) => {
603
- let [year2, month2, date2] = val;
604
- set_value({
605
- modifiedType: "update",
606
- year: year2,
607
- month: month2,
608
- date: date2
609
- });
610
- }
611
- })
612
- }
613
- ),
614
- /* @__PURE__ */ jsx(
615
- Comps.Variables.Footer,
616
- {
617
- tipsID,
618
- onValueUpdate
619
- }
620
- )
621
- ]
622
- }
623
- );
624
- },
625
- MonthCalendar: (params) => {
626
- let {
627
- min,
628
- max,
629
- year,
630
- month,
631
- current,
632
- callback
633
- } = params;
634
- let today = $$.Time();
635
- let firstDate = $$.Time([year, month.zeroEmbed(2), "01"].join("/"));
636
- let lastDate = firstDate.getLastDayOfTheMonth();
637
- let lastMonthLastDay = $$.Time(firstDate).addMonth(-1).getLastDayOfTheMonth().date;
638
- let legends = [], lastMonthLastishDates = [], thisMonthDates = [], nextMonthFirstishDates = [];
639
- let commonStyle = {
640
- padding: 0,
641
- unitWidth: 3,
642
- unitHeight: 3,
643
- flexCenter: true,
644
- borderRadius: "3.tone.tertiary"
645
- };
646
- for (var i = 0; i < 7; i++) {
647
- legends.push(/* @__PURE__ */ createElement(
648
- Box,
649
- __spreadProps(__spreadValues({
650
- className: [
651
- InputTimeClasses("CalendarDay"),
652
- InputTimeClasses("Legend")
653
- ].join(" ")
654
- }, commonStyle), {
655
- key: i
656
- }),
657
- ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"][i]
658
- ));
659
- }
660
- for (var i = 0; i < firstDate.weekday; i++) {
661
- lastMonthLastishDates.unshift(/* @__PURE__ */ createElement(
662
- Box,
663
- __spreadProps(__spreadValues({
664
- className: [
665
- InputTimeClasses("CalendarDay"),
666
- InputTimeClasses("Dummy")
667
- ].join(" "),
668
- fontColor: "4.thin"
669
- }, commonStyle), {
670
- key: i
671
- }),
672
- lastMonthLastDay - i
673
- ));
674
- }
675
- for (var i = 1; i <= lastDate.date; i++) {
676
- let idx = i;
677
- let isToday = year == today.year && month == today.month && i == today.date;
678
- let isLocked = false;
679
- {
680
- let VAL = Number(String([year, month.zeroEmbed(2), i.zeroEmbed(2)].join("/")).replace(/\D/ig, ""));
681
- if (params.min) {
682
- let MIN = Number(String(params.min).replace(/\D/ig, ""));
683
- if (MIN > VAL)
684
- isLocked = true;
685
- }
686
- if (params.max) {
687
- let MAX = Number(String(params.max).replace(/\D/ig, ""));
688
- if (VAL > MAX)
689
- isLocked = true;
690
- }
691
- }
692
- thisMonthDates.push(/* @__PURE__ */ createElement(
693
- Button.Button.Clear.R,
694
- __spreadProps(__spreadValues({
695
- className: [
696
- InputTimeClasses("CalendarDay"),
697
- InputTimeClasses("isToday_" + isToday)
698
- ].join(" ")
699
- }, commonStyle), {
700
- onClick: () => {
701
- callback([year, month, idx]);
702
- },
703
- tabIndex: -1,
704
- key: idx,
705
- isLocked,
706
- fontColor: "1.clear",
707
- ssEffectsOnActive: "shrink",
708
- padding: 0,
709
- flexCenter: true,
710
- borderRadius: "sphere",
711
- children: i
712
- })
713
- ));
714
- }
715
- for (var i = 1; i < 7 - lastDate.weekday; i++) {
716
- nextMonthFirstishDates.push(/* @__PURE__ */ createElement(
717
- Box,
718
- __spreadProps(__spreadValues({
719
- className: [
720
- InputTimeClasses("CalendarDay"),
721
- InputTimeClasses("Dummy")
722
- ].join(" "),
723
- fontColor: "4.thin"
724
- }, commonStyle), {
725
- key: i
726
- }),
727
- i
728
- ));
729
- }
730
- return /* @__PURE__ */ jsxs(
731
- Grid,
732
- {
733
- gridCols: 7,
734
- gap: "1/3",
735
- children: [
736
- legends,
737
- lastMonthLastishDates,
738
- thisMonthDates,
739
- nextMonthFirstishDates
740
- ]
741
- }
742
- );
743
- }
744
- },
745
- Month: {
746
- _: (params) => {
747
- let {
748
- min,
749
- max,
750
- onValueUpdate,
751
- tipsID,
752
- val_value,
753
- set_value
754
- } = params;
755
- let { year, month } = val_value;
756
- return /* @__PURE__ */ jsxs(
757
- Column,
758
- {
759
- padding: 1,
760
- children: [
761
- /* @__PURE__ */ jsxs(Row.Separate, { gap: 0, children: [
762
- /* @__PURE__ */ jsx(
763
- Row.Center,
764
- {
765
- verticalAlign: "bottom",
766
- gap: "2/3",
767
- children: /* @__PURE__ */ jsx(
768
- Select,
769
- {
770
- enableUnSelected: false,
771
- value: year,
772
- options: YearOptions(),
773
- override: "force",
774
- border: "1.thin",
775
- padding: ["1/3", "2/3"],
776
- paddingRight: 2,
777
- rightIconStyles: {
778
- right: "1/3"
779
- },
780
- onUpdateValidValue: ({ value }) => {
781
- set_value({
782
- modifiedType: "update",
783
- year: Number(value),
784
- month
785
- });
786
- }
787
- }
788
- )
789
- }
790
- ),
791
- /* @__PURE__ */ jsx(
792
- Comps.Variables.ShiftButtons,
793
- {
794
- callback: (dir) => {
795
- let newYear = Math.min(Math.max(year + dir, 1900), 2100);
796
- set_value({
797
- modifiedType: "update",
798
- year: newYear,
799
- month
800
- });
801
- }
802
- }
803
- )
804
- ] }),
805
- /* @__PURE__ */ jsx(Box, { borderTop: true }),
806
- Comps.Month.Months({
807
- min,
808
- max,
809
- year: val_value.year,
810
- callback: (val) => {
811
- let [year2, month2] = val;
812
- set_value({
813
- modifiedType: "update",
814
- year: year2,
815
- month: month2
816
- });
817
- }
818
- }),
819
- /* @__PURE__ */ jsx(
820
- Comps.Variables.Footer,
821
- {
822
- tipsID,
823
- onValueUpdate
824
- }
825
- )
826
- ]
827
- }
828
- );
829
- },
830
- Months: (params) => {
831
- let {
832
- year,
833
- callback
834
- } = params;
835
- let Today = $$.Time();
836
- let Months = [];
837
- for (let index = 1; index <= 12; index++) {
838
- let isThisMonth = year == Today.year && index == Today.month;
839
- let isLocked = false;
840
- {
841
- let VAL = Number(String([year, index.zeroEmbed(2)].join("/")).replace(/\D/ig, ""));
842
- if (params.min) {
843
- let MIN = Number(String(params.min).replace(/\D/ig, ""));
844
- if (MIN > VAL)
845
- isLocked = true;
846
- }
847
- if (params.max) {
848
- let MAX = Number(String(params.max).replace(/\D/ig, ""));
849
- if (VAL > MAX)
850
- isLocked = true;
851
- }
852
- }
853
- let ClassName = [
854
- InputTimeClasses("Cell"),
855
- isThisMonth ? InputTimeClasses("isThisMonth") : ""
856
- ].join(" ");
857
- Months.push(/* @__PURE__ */ jsxs(
858
- Button.Button.Clear.R,
859
- {
860
- className: ClassName,
861
- isLocked,
862
- fontColor: "2.normal",
863
- padding: ["2/3", 1],
864
- ssEffectsOnActive: "shrink",
865
- onClick: () => {
866
- callback([year, index]);
867
- },
868
- children: [
869
- index,
870
- " \u6708"
871
- ]
872
- },
873
- year + "-" + index
874
- ));
875
- }
876
- return /* @__PURE__ */ jsx(
877
- Grid,
878
- {
879
- gridCols: 4,
880
- gap: "2/3",
881
- children: Months
882
- }
883
- );
884
- }
885
- },
886
- Year: {
887
- _: (params) => {
888
- let {
889
- min,
890
- max,
891
- onValueUpdate,
892
- tipsID,
893
- val_value,
894
- set_value
895
- } = params;
896
- let { year } = val_value;
897
- return /* @__PURE__ */ jsxs(
898
- Column,
899
- {
900
- padding: 1,
901
- children: [
902
- /* @__PURE__ */ jsx(
903
- Select,
904
- {
905
- enableUnSelected: false,
906
- value: year || $$.Time().year,
907
- override: "force",
908
- options: YearOptions({ min, max }),
909
- onUpdateValidValue: ({ value }) => {
910
- set_value({
911
- modifiedType: "update",
912
- year: Number(value)
913
- });
914
- }
915
- }
916
- ),
917
- /* @__PURE__ */ jsx(
918
- Comps.Variables.Footer,
919
- {
920
- tipsID,
921
- onValueUpdate,
922
- onSubmit: () => {
923
- set_value({
924
- modifiedType: "update",
925
- year: Number(year || $$.Time().year)
926
- });
927
- }
928
- }
929
- )
930
- ]
931
- }
932
- );
933
- }
934
- },
935
- DateWareki: {
936
- _: (params) => {
937
- let {
938
- min,
939
- max,
940
- onValueUpdate,
941
- tipsID,
942
- val_value,
943
- set_value
944
- } = params;
945
- let {
946
- era,
947
- year,
948
- month,
949
- date
950
- } = val_value;
951
- let Params = {
952
- val_value,
953
- set_value
954
- };
955
- return /* @__PURE__ */ jsxs(Box, { children: [
956
- /* @__PURE__ */ jsxs(
957
- Row.Left,
958
- {
959
- verticalAlign: "unset",
960
- borderBottom: true,
961
- gap: 0,
962
- children: [
963
- /* @__PURE__ */ jsx(Comps.DateWareki.EraSelect, __spreadValues({}, Params)),
964
- /* @__PURE__ */ jsx(Box, { borderRight: true }),
965
- /* @__PURE__ */ jsx(Comps.DateWareki.Calendar, __spreadValues({}, Params))
966
- ]
967
- }
968
- ),
969
- /* @__PURE__ */ jsx(
970
- Box,
971
- {
972
- padding: 1,
973
- children: /* @__PURE__ */ jsx(
974
- Comps.Variables.Footer,
975
- {
976
- tipsID,
977
- onValueUpdate
978
- }
979
- )
980
- }
981
- )
982
- ] });
983
- },
984
- EraSelect: (params) => {
985
- let {
986
- val_value,
987
- set_value
988
- } = params;
989
- let styles = {
990
- padding: ["1/2", 1.5],
991
- fontColor: "3.blur"
992
- };
993
- let isActiveStyles = {
994
- backgroundColor: "cloud",
995
- fontColor: "2.normal",
996
- isSemiBoldFont: true
997
- };
998
- return /* @__PURE__ */ jsxs(
999
- Column,
1000
- {
1001
- gap: 0,
1002
- padding: 1,
1003
- children: [
1004
- /* @__PURE__ */ jsx(
1005
- Button.Button.Clear.R,
1006
- __spreadProps(__spreadValues({
1007
- color: "cloud"
1008
- }, styles), {
1009
- isActiveStyles,
1010
- isActive: val_value.era == "year",
1011
- onClick: () => {
1012
- let today = $$.Time();
1013
- set_value({
1014
- modifiedType: "update",
1015
- era: "year",
1016
- year: today.year,
1017
- month: today.month,
1018
- date: today.date
1019
- });
1020
- },
1021
- children: "\u897F\u66A6"
1022
- })
1023
- ),
1024
- /* @__PURE__ */ jsx(
1025
- Button.Button.Clear.R,
1026
- __spreadProps(__spreadValues({
1027
- color: "cloud"
1028
- }, styles), {
1029
- isActiveStyles,
1030
- isActive: val_value.era == "reiwa",
1031
- onClick: () => {
1032
- let today = $$.Time();
1033
- set_value({
1034
- modifiedType: "update",
1035
- era: "reiwa",
1036
- year: today.year,
1037
- month: today.month,
1038
- date: today.date
1039
- });
1040
- },
1041
- children: "\u4EE4\u548C"
1042
- })
1043
- ),
1044
- /* @__PURE__ */ jsx(
1045
- Button.Button.Clear.R,
1046
- __spreadProps(__spreadValues({
1047
- color: "cloud"
1048
- }, styles), {
1049
- isActiveStyles,
1050
- isActive: val_value.era == "heisei",
1051
- onClick: () => {
1052
- set_value({
1053
- modifiedType: "update",
1054
- era: "heisei",
1055
- year: 2019,
1056
- month: 1,
1057
- date: 1
1058
- });
1059
- },
1060
- children: "\u5E73\u6210"
1061
- })
1062
- ),
1063
- /* @__PURE__ */ jsx(
1064
- Button.Button.Clear.R,
1065
- __spreadProps(__spreadValues({
1066
- color: "cloud"
1067
- }, styles), {
1068
- isActiveStyles,
1069
- isActive: val_value.era == "shouwa",
1070
- onClick: () => {
1071
- set_value({
1072
- modifiedType: "update",
1073
- era: "shouwa",
1074
- year: 1989,
1075
- month: 1,
1076
- date: 1
1077
- });
1078
- },
1079
- children: "\u662D\u548C"
1080
- })
1081
- ),
1082
- /* @__PURE__ */ jsx(
1083
- Button.Button.Clear.R,
1084
- __spreadProps(__spreadValues({
1085
- color: "cloud"
1086
- }, styles), {
1087
- isActiveStyles,
1088
- isActive: val_value.era == "taisho",
1089
- onClick: () => {
1090
- set_value({
1091
- modifiedType: "update",
1092
- era: "taisho",
1093
- year: 1926,
1094
- month: 1,
1095
- date: 1
1096
- });
1097
- },
1098
- children: "\u5927\u6B63"
1099
- })
1100
- ),
1101
- /* @__PURE__ */ jsx(
1102
- Button.Button.Clear.R,
1103
- __spreadProps(__spreadValues({
1104
- color: "cloud"
1105
- }, styles), {
1106
- isActiveStyles,
1107
- isActive: val_value.era == "meiji",
1108
- onClick: () => {
1109
- set_value({
1110
- modifiedType: "update",
1111
- era: "meiji",
1112
- year: 1912,
1113
- month: 1,
1114
- date: 1
1115
- });
1116
- },
1117
- children: "\u660E\u6CBB"
1118
- })
1119
- )
1120
- ]
1121
- }
1122
- );
1123
- },
1124
- Calendar: (params) => {
1125
- let {
1126
- val_value,
1127
- set_value
1128
- } = params;
1129
- let yearOptions = [];
1130
- if (val_value.era == "year") {
1131
- for (let i = 1900; i < 2100; i++)
1132
- yearOptions.unshift({ value: i, label: i + "\u5E74" });
1133
- } else if (val_value.era == "reiwa") {
1134
- let thisReiwaYear = $$.Time().year - 2018;
1135
- for (let i = 1; i <= thisReiwaYear + 10; i++)
1136
- yearOptions.unshift({ value: 2019 + i - 1, label: "\u4EE4\u548C" + (i == 1 ? "\u5143" : i) + "\u5E74" });
1137
- } else if (val_value.era == "heisei") {
1138
- for (let i = 1; i <= 31; i++)
1139
- yearOptions.unshift({ value: 1989 + i - 1, label: "\u5E73\u6210" + (i == 1 ? "\u5143" : i) + "\u5E74" });
1140
- } else if (val_value.era == "shouwa") {
1141
- for (let i = 1; i <= 64; i++)
1142
- yearOptions.unshift({ value: 1926 + i - 1, label: "\u662D\u548C" + (i == 1 ? "\u5143" : i) + "\u5E74" });
1143
- } else if (val_value.era == "taisho") {
1144
- for (let i = 1; i <= 15; i++)
1145
- yearOptions.unshift({ value: 1912 + i - 1, label: "\u5927\u6B63" + (i == 1 ? "\u5143" : i) + "\u5E74" });
1146
- } else if (val_value.era == "meiji") {
1147
- for (let i = 1; i <= 45; i++)
1148
- yearOptions.unshift({ value: 1868 + i - 1, label: "\u660E\u6CBB" + (i == 1 ? "\u5143" : i) + "\u5E74" });
1149
- }
1150
- return /* @__PURE__ */ jsxs(
1151
- Column,
1152
- {
1153
- padding: 1,
1154
- children: [
1155
- /* @__PURE__ */ jsxs(Row.Separate, { children: [
1156
- /* @__PURE__ */ jsx(
1157
- Select,
1158
- {
1159
- tone: "cloud",
1160
- enableUnSelected: false,
1161
- override: "force",
1162
- border: "1.thin",
1163
- padding: ["1/3", "2/3"],
1164
- paddingRight: 2,
1165
- rightIconStyles: { right: "1/3" },
1166
- options: yearOptions,
1167
- value: val_value.year,
1168
- onUpdateValidValue: ({ value }) => {
1169
- set_value(__spreadProps(__spreadValues({}, val_value), {
1170
- modifiedType: "update",
1171
- year: Number(value)
1172
- }));
1173
- }
1174
- }
1175
- ),
1176
- /* @__PURE__ */ jsxs(
1177
- Row.Center,
1178
- {
1179
- gap: "1/3",
1180
- children: [
1181
- /* @__PURE__ */ jsx(
1182
- Button.Button.Clear.S,
1183
- {
1184
- ssSphere: 2,
1185
- onClick: () => {
1186
- let nextMonth = val_value.month - 1;
1187
- set_value({
1188
- modifiedType: "update",
1189
- era: val_value.era,
1190
- year: nextMonth == 0 ? val_value.year - 1 : val_value.year,
1191
- month: nextMonth == 0 ? 12 : nextMonth,
1192
- date: 1
1193
- });
1194
- },
1195
- children: /* @__PURE__ */ jsx(FAI.ChevronLeft, {})
1196
- }
1197
- ),
1198
- /* @__PURE__ */ jsx(
1199
- Select,
1200
- {
1201
- tone: "cloud",
1202
- enableUnSelected: false,
1203
- override: "force",
1204
- border: "1.thin",
1205
- padding: ["1/3", "2/3"],
1206
- paddingRight: 2,
1207
- rightIconStyles: { right: "1/3" },
1208
- options: [
1209
- { value: 1, label: "1\u6708" },
1210
- { value: 2, label: "2\u6708" },
1211
- { value: 3, label: "3\u6708" },
1212
- { value: 4, label: "4\u6708" },
1213
- { value: 5, label: "5\u6708" },
1214
- { value: 6, label: "6\u6708" },
1215
- { value: 7, label: "7\u6708" },
1216
- { value: 8, label: "8\u6708" },
1217
- { value: 9, label: "9\u6708" },
1218
- { value: 10, label: "10\u6708" },
1219
- { value: 11, label: "11\u6708" },
1220
- { value: 12, label: "12\u6708" }
1221
- ],
1222
- value: val_value.month,
1223
- onUpdateValidValue: ({ value }) => {
1224
- set_value({
1225
- modifiedType: "update",
1226
- era: val_value.era,
1227
- year: val_value.year,
1228
- month: Number(value),
1229
- date: 1
1230
- });
1231
- }
1232
- }
1233
- ),
1234
- /* @__PURE__ */ jsx(
1235
- Button.Button.Clear.S,
1236
- {
1237
- ssSphere: 2,
1238
- onClick: () => {
1239
- let nextMonth = val_value.month + 1;
1240
- set_value({
1241
- modifiedType: "update",
1242
- era: val_value.era,
1243
- year: nextMonth == 13 ? val_value.year + 1 : val_value.year,
1244
- month: nextMonth == 13 ? 1 : nextMonth,
1245
- date: 1
1246
- });
1247
- },
1248
- children: /* @__PURE__ */ jsx(FAI.ChevronRight, {})
1249
- }
1250
- )
1251
- ]
1252
- }
1253
- )
1254
- ] }),
1255
- /* @__PURE__ */ jsx(Comps.DateWareki.MonthCell, __spreadValues({}, params))
1256
- ]
1257
- },
1258
- val_value.era
1259
- );
1260
- },
1261
- MonthCell: (params) => {
1262
- let {
1263
- val_value,
1264
- set_value
1265
- } = params;
1266
- let targetDate = $$.Time([
1267
- val_value.year.zeroEmbed(4),
1268
- val_value.month.zeroEmbed(2),
1269
- val_value.date.zeroEmbed(2)
1270
- ].join("/"));
1271
- if (!targetDate.validate)
1272
- return;
1273
- let weekdayOfFirstDay = targetDate.getFirstDayOfTheMonth().weekday;
1274
- let lastDayOfTheMonth = targetDate.getLastDayOfTheMonth();
1275
- let Cells = [];
1276
- for (let i = 0; i < 7; i++) {
1277
- Cells.push(/* @__PURE__ */ jsx(
1278
- Text.Supplement,
1279
- {
1280
- flexCenter: true,
1281
- fontColor: i == 0 ? "googleRed" : i == 6 ? "googleBlue" : "3.blur",
1282
- children: $$.transformer.weekday.shortJP(i)
1283
- }
1284
- ));
1285
- }
1286
- for (let i = 0; i < weekdayOfFirstDay; i++) {
1287
- let date = $$.Time(targetDate).getFirstDayOfTheMonth().addDate(i - weekdayOfFirstDay);
1288
- Cells.push(/* @__PURE__ */ jsx(
1289
- Button.Button.Sub.R,
1290
- {
1291
- color: "cloud",
1292
- border: "1.thin",
1293
- ssSquare: 3,
1294
- opacity: "middle",
1295
- onClick: (e) => {
1296
- e.preventDefault();
1297
- e.stopPropagation();
1298
- set_value({
1299
- modifiedType: "update",
1300
- era: val_value.era,
1301
- year: date.year,
1302
- month: date.month,
1303
- date: date.date
1304
- });
1305
- },
1306
- children: date.date
1307
- }
1308
- ));
1309
- }
1310
- for (let i = 1; i <= lastDayOfTheMonth.date; i++) {
1311
- let date = $$.Time(targetDate).setDate(i);
1312
- Cells.push(/* @__PURE__ */ jsx(
1313
- Button.Button.Border.R,
1314
- {
1315
- ssSquare: 3,
1316
- onClick: () => {
1317
- set_value({
1318
- modifiedType: "update",
1319
- era: val_value.era,
1320
- year: date.year,
1321
- month: date.month,
1322
- date: date.date
1323
- });
1324
- },
1325
- children: date.date
1326
- }
1327
- ));
1328
- }
1329
- for (let i = 0; i < 7 - lastDayOfTheMonth.weekday - 1; i++) {
1330
- let date = $$.Time(targetDate).addMonth(1).setDate(1).addDate(i);
1331
- Cells.push(/* @__PURE__ */ jsx(
1332
- Button.Button.Sub.R,
1333
- {
1334
- color: "cloud",
1335
- border: "1.thin",
1336
- ssSquare: 3,
1337
- opacity: "middle",
1338
- onClick: (e) => {
1339
- e.preventDefault();
1340
- e.stopPropagation();
1341
- set_value({
1342
- modifiedType: "update",
1343
- era: val_value.era,
1344
- year: date.year,
1345
- month: date.month,
1346
- date: date.date
1347
- });
1348
- },
1349
- children: date.date
1350
- }
1351
- ));
1352
- }
1353
- return /* @__PURE__ */ jsx(
1354
- Grid,
1355
- {
1356
- gridCols: 7,
1357
- gap: "1/4",
1358
- children: Cells
1359
- }
1360
- );
1361
- }
1362
- },
1363
- Variables: {
1364
- Footer: (params) => {
1365
- return /* @__PURE__ */ jsxs(
1366
- Flex,
1367
- {
1368
- flexWrap: false,
1369
- gap: 1,
1370
- flexChilds: "even",
1371
- freeCSS: {
1372
- whiteSpace: "nowrap"
1373
- },
1374
- children: [
1375
- /* @__PURE__ */ jsxs(
1376
- Button.Button.Border.R,
1377
- {
1378
- onClick: () => {
1379
- params.onValueUpdate("");
1380
- },
1381
- tabIndex: -1,
1382
- flexSizing: "none",
1383
- padding: ["2/3", 1],
1384
- children: [
1385
- /* @__PURE__ */ jsx(FAI.Times, {}),
1386
- " \u524A\u9664"
1387
- ]
1388
- }
1389
- ),
1390
- /* @__PURE__ */ jsx(
1391
- Button.Button.Prime.R,
1392
- {
1393
- flexSizing: "auto",
1394
- onClick: () => {
1395
- params.onSubmit && params.onSubmit();
1396
- Tooltips.close(params.tipsID);
1397
- },
1398
- tabIndex: -1,
1399
- children: "\u6C7A\u5B9A",
1400
- padding: ["2/3", 1]
1401
- }
1402
- )
1403
- ]
1404
- }
1405
- );
1406
- },
1407
- ShiftButtons: (params) => {
1408
- return /* @__PURE__ */ jsxs(
1409
- Flex,
1410
- {
1411
- flexWrap: false,
1412
- gap: "1/3",
1413
- children: [
1414
- /* @__PURE__ */ jsx(
1415
- Button.Button.Clear.R,
1416
- __spreadProps(__spreadValues({
1417
- className: InputTimeClasses("LeftButton"),
1418
- tabIndex: -1,
1419
- right: 0
1420
- }, Comps.Variables.ShiftButtonStyles), {
1421
- onClick: () => {
1422
- params.callback(-1);
1423
- },
1424
- children: /* @__PURE__ */ jsx(FAI.ChevronLeft, {})
1425
- })
1426
- ),
1427
- /* @__PURE__ */ jsx(
1428
- Button.Button.Clear.R,
1429
- __spreadProps(__spreadValues({
1430
- className: InputTimeClasses("RightButton"),
1431
- tabIndex: -1,
1432
- left: 0
1433
- }, Comps.Variables.ShiftButtonStyles), {
1434
- onClick: () => {
1435
- params.callback(1);
1436
- },
1437
- children: /* @__PURE__ */ jsx(FAI.ChevronRight, {})
1438
- })
1439
- )
1440
- ]
1441
- }
1442
- );
1443
- },
1444
- ShiftButtonStyles: {
1445
- flexCenter: true,
1446
- padding: 0,
1447
- unitWidth: 3,
1448
- unitHeight: 3,
1449
- borderRadius: "sphere",
1450
- position: "relative"
1451
- }
1452
- }
1453
- };
1454
- export {
1455
- Picker,
1456
- Picker as default
1457
- };
1
+ import{b as f,c as T}from"../../../chunk-VY3566IV.js";import{Fragment as $,jsx as i,jsxs as y}from"react/jsx-runtime";import{createElement as P}from"react";import{useState as w,useEffect as z,useRef as Y}from"react";import{$$ as c}from"../../../@utils/_";import C from"../../../atoms/Box";import N from"../../../atoms/FAI";import B from"../../../atoms/Flex";import _ from"../../../atoms/Grid";import M from"../../../mols/Row";import x from"../../../mols/Column";import O from"../../../mols/Text";import v from"../../Button";import H from"../../Tooltips";import R from"../Select";import{List as F}from"../List";import{InputTimeClasses as g}from"../../../@styles/componentClasses/_";let A=r=>{var t,a;let e=[],d=Number((t=r==null?void 0:r.min)!=null?t:1900),o=Number((a=r==null?void 0:r.max)!=null?a:c.Time().addYear(10).year);for(let m=d;m<=o;m++)e.unshift({value:m,label:[m,...c.transformer.wareki(m).value].join(" - ")});return e};const L=r=>{let{restrict:e,era:d="year",defaultValue:o=""}=r;r=f({},r),r.tipsID=r.tipsID||c.uuid.gen();const t=Y(!1);let[a,m]=w((()=>{var s,p;if(e=="clock"){let l=String(o).split(/[^\d]/);l[0]||(l=[0,0]);let u=Number(l[0]),h=Number(l[1]);return{modifiedType:"init",hour:u,minutes:h}}else if(e=="date"){let[l,u,h]=(s=String(o))==null?void 0:s.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",year:Number(l),month:Number(u),date:Number(h)}}else if(e!="week"){if(e=="month"){let[l,u]=String(o).split(/\D/);return(c.is.nullish(l)||c.is.nullish(u))&&([l,u]=c.Time().toFormat("%Y-%M").split("-")),{modifiedType:"init",year:Number(l),month:Number(u)}}else if(e=="year"){let[l]=String(o).split(/\D/);return c.is.nullish(l)&&([l]=c.Time().toFormat("%Y").split("-")),{modifiedType:"init",year:Number(l)}}else if(e=="dateWareki"){let[l,u,h]=(p=String(o))==null?void 0:p.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",era:d||"year",year:Number(l),month:Number(u),date:Number(h)}}}return{}})());z(()=>{if(t.current){if(a.modifiedType=="update"){let s="",p=d||"year";if(e=="clock"){let{hour:l,minutes:u}=a;s=[l.zeroEmbed(2),u.zeroEmbed(2)].join("/")}else if(e=="date"){let{year:l,month:u,date:h}=a;s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}else if(e!="week"){if(e=="month"){let{year:l,month:u}=a;s=[l,u.zeroEmbed(2)].join("/")}else if(e=="year"){let{year:l}=a;s=String(l)}else if(e=="dateWareki"){let{year:l,month:u,date:h,era:S}=a;p=S,s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}}r.onValueUpdate(s,p)}}else t.current=!0},[a]);let n=T(f({},r),{val_value:a,set_value:m});return i(C,{backgroundColor:"1.layer.base",borderRadius:"2.tone.secondary",boxShadow:"1.remark",border:!0,overflow:"hidden",children:i(C,{overflow:"auto",className:g(e.toCapital()+"Base"),children:e=="clock"?i(k.Clock._,f({},n)):e=="date"?i(k.Date._,f({},n)):e=="week"?"":e=="month"?i(k.Month._,f({},n)):e=="year"?i(k.Year._,f({},n)):e=="dates"||e=="months"?"":e=="dateWareki"?i(k.DateWareki._,f({},n)):i($,{})})})},k={Clock:{_:r=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=r,[n,s]=w(a.hour>12?2:1),[p,l]=w(Number(localStorage.getItem("timePickerUnit")||5));z(()=>{localStorage.setItem("timePickerUnit",String(p))},[p]);let{hour:u,minutes:h}=a;return y(x,{padding:1,children:[y(B,{flexType:"row",flexWrap:!1,gap:1,className:g("Body"),children:[y(x,{className:g("DesignSide"),flexSizing:0,children:[i(C,{className:g("ClockUiBase"),padding:[1,"2/3"],flexCenter:!0,children:y(C,{className:g("ClockUi"),backgroundColor:"tcOpLow",isRounded:!0,position:"relative",children:[i(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("hour")].join(" "),freeCSS:{transform:`rotate(${u*30+h/2}deg)`}}),i(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("minute")].join(" "),freeCSS:{transform:`rotate(${h*6}deg)`}})]})}),i(F.Radio,{tone:"plain",icon:!0,value:[n],options:[{value:1,label:"AM"},{value:2,label:"PM"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{let D=a.hour%12+(S==2?12:0);s(S),m({modifiedType:"update",hour:D,minutes:a.minutes})}}),i(C,{borderTop:!0,margin:[0,1]}),i(F.Radio,{tone:"plain",icon:!0,value:[p],options:[{value:1,label:"/ 1\u5206"},{value:2,label:"/ 2\u5206"},{value:5,label:"/ 5\u5206"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{l(S)}})]}),y(x,{children:[y(C,{flexCenter:!0,fontSize:"3.paragraph",isSemiBoldFont:!0,children:[a.hour.zeroEmbed(2)," : ",a.minutes.zeroEmbed(2)]}),y(B,{flexWrap:!1,borderRadius:"1.tone.primary",boxShadow:"0.remark.inset",flexChilds:"even",freeCSS:{minWidth:12*12},padding:["1/3",0],children:[i(x,{gap:0,overflow:"auto",padding:"2/3",borderRight:!0,freeCSS:{maxHeight:12*22},children:k.Clock.Hours({onClick:S=>{let V=S+(n==2?12:0);m({modifiedType:"update",hour:V,minutes:a.minutes})},min:e,max:d,ampm:n})}),i(x,{gap:0,overflow:"auto",padding:"2/3",freeCSS:{maxHeight:12*22},children:k.Clock.Minutes({onClick:S=>{m({modifiedType:"update",hour:a.hour,minutes:S})},min:e,max:d,unit:p})})]})]})]}),i(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Hours:r=>{let e=[];for(let d=0;d<12;d++){let o=r.ampm==2?d+12:d,t=!1;{let a=Number(String(o*100).replace(/\D/ig,""));if(r.min&&Number(String(r.min).replace(/\D/ig,""))>a&&(t=!0),r.max){let m=Number(String(r.max).replace(/\D/ig,""));a>m&&(t=!0)}}e.push(i(v.Button.Normal.R,{isLocked:t,borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{r.onClick(d)},children:o.zeroEmbed(2)},d))}return e},Minutes:r=>{let e=[];for(let d=0;d<60/r.unit;d++){let o=d*r.unit;e.push(i(v.Button.Normal.R,{borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{r.onClick(o)},children:o.zeroEmbed(2)},o))}return e}},Date:{_:r=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=r,{year:n,month:s,date:p}=a;return y(x,{padding:1,children:[y(B,{horizontalAlign:"between",verticalAlign:"center",flexWrap:!1,children:[y(B,{verticalAlign:"bottom",horizontalAlign:"left",gap:"2/3",flexWrap:!1,children:[i(R,{override:"force",enableUnSelected:!1,value:n,options:A(),border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:Number(l),month:s,date:p})}}),i(R,{override:"force",enableUnSelected:!1,value:s,options:(()=>{let l=[];for(let u=1;u<=12;u++)l.push({value:u,label:String(u),displayLabel:String(u)+"\u6708"});return l})(),placeholder:"",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:n,month:Number(l),date:p})}})]}),i(k.Variables.ShiftButtons,{callback:l=>{let u=s+l,h=n;l==-1?(u<=0&&h--,u=u||12):s==12&&h++,m({modifiedType:"update",year:h,month:u,date:a.date})}})]}),i(C,{borderTop:!0}),i(C,{children:k.Date.MonthCalendar({min:e,max:d,year:a.year,month:a.month,current:[a.year,a.month,a.date],callback:l=>{let[u,h,S]=l;m({modifiedType:"update",year:u,month:h,date:S})}})}),i(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},MonthCalendar:r=>{let{min:e,max:d,year:o,month:t,current:a,callback:m}=r,n=c.Time(),s=c.Time([o,t.zeroEmbed(2),"01"].join("/")),p=s.getLastDayOfTheMonth(),l=c.Time(s).addMonth(-1).getLastDayOfTheMonth().date,u=[],h=[],S=[],V=[],D={padding:0,unitWidth:3,unitHeight:3,flexCenter:!0,borderRadius:"3.tone.tertiary"};for(var b=0;b<7;b++)u.push(P(C,T(f({className:[g("CalendarDay"),g("Legend")].join(" ")},D),{key:b}),["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][b]));for(var b=0;b<s.weekday;b++)h.unshift(P(C,T(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},D),{key:b}),l-b));for(var b=1;b<=p.date;b++){let U=b,j=o==n.year&&t==n.month&&b==n.date,I=!1;{let E=Number(String([o,t.zeroEmbed(2),b.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(r.min&&Number(String(r.min).replace(/\D/ig,""))>E&&(I=!0),r.max){let W=Number(String(r.max).replace(/\D/ig,""));E>W&&(I=!0)}}S.push(P(v.Button.Clear.R,T(f({className:[g("CalendarDay"),g("isToday_"+j)].join(" ")},D),{onClick:()=>{m([o,t,U])},tabIndex:-1,key:U,isLocked:I,fontColor:"1.clear",ssEffectsOnActive:"shrink",padding:0,flexCenter:!0,borderRadius:"sphere",children:b})))}for(var b=1;b<7-p.weekday;b++)V.push(P(C,T(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},D),{key:b}),b));return y(_,{gridCols:7,gap:"1/3",children:[u,h,S,V]})}},Month:{_:r=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=r,{year:n,month:s}=a;return y(x,{padding:1,children:[y(M.Separate,{gap:0,children:[i(M.Center,{verticalAlign:"bottom",gap:"2/3",children:i(R,{enableUnSelected:!1,value:n,options:A(),override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:p})=>{m({modifiedType:"update",year:Number(p),month:s})}})}),i(k.Variables.ShiftButtons,{callback:p=>{let l=Math.min(Math.max(n+p,1900),2100);m({modifiedType:"update",year:l,month:s})}})]}),i(C,{borderTop:!0}),k.Month.Months({min:e,max:d,year:a.year,callback:p=>{let[l,u]=p;m({modifiedType:"update",year:l,month:u})}}),i(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Months:r=>{let{year:e,callback:d}=r,o=c.Time(),t=[];for(let a=1;a<=12;a++){let m=e==o.year&&a==o.month,n=!1;{let p=Number(String([e,a.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(r.min&&Number(String(r.min).replace(/\D/ig,""))>p&&(n=!0),r.max){let l=Number(String(r.max).replace(/\D/ig,""));p>l&&(n=!0)}}let s=[g("Cell"),m?g("isThisMonth"):""].join(" ");t.push(y(v.Button.Clear.R,{className:s,isLocked:n,fontColor:"2.normal",padding:["2/3",1],ssEffectsOnActive:"shrink",onClick:()=>{d([e,a])},children:[a," \u6708"]},e+"-"+a))}return i(_,{gridCols:4,gap:"2/3",children:t})}},Year:{_:r=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=r,{year:n}=a;return y(x,{padding:1,children:[i(R,{enableUnSelected:!1,value:n||c.Time().year,override:"force",options:A({min:e,max:d}),onUpdateValidValue:({value:s})=>{m({modifiedType:"update",year:Number(s)})}}),i(k.Variables.Footer,{tipsID:t,onValueUpdate:o,onSubmit:()=>{m({modifiedType:"update",year:Number(n||c.Time().year)})}})]})}},DateWareki:{_:r=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=r,{era:n,year:s,month:p,date:l}=a,u={val_value:a,set_value:m};return y(C,{children:[y(M.Left,{verticalAlign:"unset",borderBottom:!0,gap:0,children:[i(k.DateWareki.EraSelect,f({},u)),i(C,{borderRight:!0}),i(k.DateWareki.Calendar,f({},u))]}),i(C,{padding:1,children:i(k.Variables.Footer,{tipsID:t,onValueUpdate:o})})]})},EraSelect:r=>{let{val_value:e,set_value:d}=r,o={padding:["1/2",1.5],fontColor:"3.blur"},t={backgroundColor:"cloud",fontColor:"2.normal",isSemiBoldFont:!0};return y(x,{gap:0,padding:1,children:[i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="year",onClick:()=>{let a=c.Time();d({modifiedType:"update",era:"year",year:a.year,month:a.month,date:a.date})},children:"\u897F\u66A6"})),i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="reiwa",onClick:()=>{let a=c.Time();d({modifiedType:"update",era:"reiwa",year:a.year,month:a.month,date:a.date})},children:"\u4EE4\u548C"})),i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="heisei",onClick:()=>{d({modifiedType:"update",era:"heisei",year:2019,month:1,date:1})},children:"\u5E73\u6210"})),i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="shouwa",onClick:()=>{d({modifiedType:"update",era:"shouwa",year:1989,month:1,date:1})},children:"\u662D\u548C"})),i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="taisho",onClick:()=>{d({modifiedType:"update",era:"taisho",year:1926,month:1,date:1})},children:"\u5927\u6B63"})),i(v.Button.Clear.R,T(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="meiji",onClick:()=>{d({modifiedType:"update",era:"meiji",year:1912,month:1,date:1})},children:"\u660E\u6CBB"}))]})},Calendar:r=>{let{val_value:e,set_value:d}=r,o=[];if(e.era=="year")for(let t=1900;t<2100;t++)o.unshift({value:t,label:t+"\u5E74"});else if(e.era=="reiwa"){let t=c.Time().year-2018;for(let a=1;a<=t+10;a++)o.unshift({value:2019+a-1,label:"\u4EE4\u548C"+(a==1?"\u5143":a)+"\u5E74"})}else if(e.era=="heisei")for(let t=1;t<=31;t++)o.unshift({value:1989+t-1,label:"\u5E73\u6210"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="shouwa")for(let t=1;t<=64;t++)o.unshift({value:1926+t-1,label:"\u662D\u548C"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="taisho")for(let t=1;t<=15;t++)o.unshift({value:1912+t-1,label:"\u5927\u6B63"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="meiji")for(let t=1;t<=45;t++)o.unshift({value:1868+t-1,label:"\u660E\u6CBB"+(t==1?"\u5143":t)+"\u5E74"});return y(x,{padding:1,children:[y(M.Separate,{children:[i(R,{tone:"cloud",enableUnSelected:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},options:o,value:e.year,onUpdateValidValue:({value:t})=>{d(T(f({},e),{modifiedType:"update",year:Number(t)}))}}),y(M.Center,{gap:"1/3",children:[i(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month-1;d({modifiedType:"update",era:e.era,year:t==0?e.year-1:e.year,month:t==0?12:t,date:1})},children:i(N.ChevronLeft,{})}),i(R,{tone:"cloud",enableUnSelected:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:e.month,onUpdateValidValue:({value:t})=>{d({modifiedType:"update",era:e.era,year:e.year,month:Number(t),date:1})}}),i(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month+1;d({modifiedType:"update",era:e.era,year:t==13?e.year+1:e.year,month:t==13?1:t,date:1})},children:i(N.ChevronRight,{})})]})]}),i(k.DateWareki.MonthCell,f({},r))]},e.era)},MonthCell:r=>{let{val_value:e,set_value:d}=r,o=c.Time([e.year.zeroEmbed(4),e.month.zeroEmbed(2),e.date.zeroEmbed(2)].join("/"));if(!o.validate)return;let t=o.getFirstDayOfTheMonth().weekday,a=o.getLastDayOfTheMonth(),m=[];for(let n=0;n<7;n++)m.push(i(O.Supplement,{flexCenter:!0,fontColor:n==0?"googleRed":n==6?"googleBlue":"3.blur",children:c.transformer.weekday.shortJP(n)}));for(let n=0;n<t;n++){let s=c.Time(o).getFirstDayOfTheMonth().addDate(n-t);m.push(i(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSquare:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date}))}for(let n=1;n<=a.date;n++){let s=c.Time(o).setDate(n);m.push(i(v.Button.Border.R,{ssSquare:3,onClick:()=>{d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date}))}for(let n=0;n<7-a.weekday-1;n++){let s=c.Time(o).addMonth(1).setDate(1).addDate(n);m.push(i(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSquare:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date}))}return i(_,{gridCols:7,gap:"1/4",children:m})}},Variables:{Footer:r=>y(B,{flexWrap:!1,gap:1,flexChilds:"even",freeCSS:{whiteSpace:"nowrap"},children:[y(v.Button.Border.R,{onClick:()=>{r.onValueUpdate("")},tabIndex:-1,flexSizing:"none",padding:["2/3",1],children:[i(N.Times,{})," \u524A\u9664"]}),i(v.Button.Prime.R,{flexSizing:"auto",onClick:()=>{r.onSubmit&&r.onSubmit(),H.close(r.tipsID)},tabIndex:-1,children:"\u6C7A\u5B9A",padding:["2/3",1]})]}),ShiftButtons:r=>y(B,{flexWrap:!1,gap:"1/3",children:[i(v.Button.Clear.R,T(f({className:g("LeftButton"),tabIndex:-1,right:0},k.Variables.ShiftButtonStyles),{onClick:()=>{r.callback(-1)},children:i(N.ChevronLeft,{})})),i(v.Button.Clear.R,T(f({className:g("RightButton"),tabIndex:-1,left:0},k.Variables.ShiftButtonStyles),{onClick:()=>{r.callback(1)},children:i(N.ChevronRight,{})}))]}),ShiftButtonStyles:{flexCenter:!0,padding:0,unitWidth:3,unitHeight:3,borderRadius:"sphere",position:"relative"}}};export{L as Picker,L as default};