amotify 0.0.0
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/@comps/@core/bios.d.ts +14 -0
- package/dist/@comps/@core/bios.js +228 -0
- package/dist/@comps/@core/exe.d.ts +9 -0
- package/dist/@comps/@core/exe.js +12 -0
- package/dist/@comps/@core/jsminAmotifyExtension/_.d.ts +4 -0
- package/dist/@comps/@core/jsminAmotifyExtension/_.js +6 -0
- package/dist/@comps/@core/jsminAmotifyExtension/fetch.d.ts +9 -0
- package/dist/@comps/@core/jsminAmotifyExtension/fetch.js +199 -0
- package/dist/@comps/@core/jsminAmotifyExtension/formCollect.d.ts +1 -0
- package/dist/@comps/@core/jsminAmotifyExtension/formCollect.js +137 -0
- package/dist/@comps/@core/jsminAmotifyExtension/spreadSheet.d.ts +4 -0
- package/dist/@comps/@core/jsminAmotifyExtension/spreadSheet.js +314 -0
- package/dist/@comps/@core/jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/@comps/@core/jsminAmotifyExtension/variables.js +186 -0
- package/dist/@comps/@core/styleConverter.d.ts +2 -0
- package/dist/@comps/@core/styleConverter.js +349 -0
- package/dist/@comps/Atoms/@export.d.ts +4 -0
- package/dist/@comps/Atoms/@export.js +29 -0
- package/dist/@comps/Atoms/FAIcon/parts.d.ts +2 -0
- package/dist/@comps/Atoms/FAIcon/parts.js +153 -0
- package/dist/@comps/Atoms/Logo/parts.d.ts +1 -0
- package/dist/@comps/Atoms/Logo/parts.js +154 -0
- package/dist/@comps/Atoms/Various/parts.d.ts +9 -0
- package/dist/@comps/Atoms/Various/parts.js +113 -0
- package/dist/@comps/Functions/@export.d.ts +12 -0
- package/dist/@comps/Functions/@export.js +38 -0
- package/dist/@comps/Functions/Button/_.d.ts +1 -0
- package/dist/@comps/Functions/Button/_.js +270 -0
- package/dist/@comps/Functions/Cropper/parts.d.ts +1 -0
- package/dist/@comps/Functions/Cropper/parts.js +783 -0
- package/dist/@comps/Functions/Effects/Fade.d.ts +1 -0
- package/dist/@comps/Functions/Effects/Fade.js +80 -0
- package/dist/@comps/Functions/Effects/Ripple.d.ts +1 -0
- package/dist/@comps/Functions/Effects/Ripple.js +107 -0
- package/dist/@comps/Functions/Effects/_.d.ts +3 -0
- package/dist/@comps/Functions/Effects/_.js +43 -0
- package/dist/@comps/Functions/Input/Chips/Selector.d.ts +1 -0
- package/dist/@comps/Functions/Input/Chips/Selector.js +356 -0
- package/dist/@comps/Functions/Input/Chips/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/Chips/_.js +218 -0
- package/dist/@comps/Functions/Input/DigitCharacters.d.ts +1 -0
- package/dist/@comps/Functions/Input/DigitCharacters.js +178 -0
- package/dist/@comps/Functions/Input/File/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/File/_.js +458 -0
- package/dist/@comps/Functions/Input/Hidden.d.ts +1 -0
- package/dist/@comps/Functions/Input/Hidden.js +30 -0
- package/dist/@comps/Functions/Input/List/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/List/_.js +232 -0
- package/dist/@comps/Functions/Input/Segmented/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Segmented/_.js +111 -0
- package/dist/@comps/Functions/Input/Select/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Select/_.js +154 -0
- package/dist/@comps/Functions/Input/Slider/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Slider/_.js +308 -0
- package/dist/@comps/Functions/Input/Switch/_.d.ts +1 -0
- package/dist/@comps/Functions/Input/Switch/_.js +120 -0
- package/dist/@comps/Functions/Input/Text.d.ts +5 -0
- package/dist/@comps/Functions/Input/Text.js +340 -0
- package/dist/@comps/Functions/Input/TextArea.d.ts +1 -0
- package/dist/@comps/Functions/Input/TextArea.js +98 -0
- package/dist/@comps/Functions/Input/Time/Picker.d.ts +1 -0
- package/dist/@comps/Functions/Input/Time/Picker.js +581 -0
- package/dist/@comps/Functions/Input/Time/_.d.ts +2 -0
- package/dist/@comps/Functions/Input/Time/_.js +567 -0
- package/dist/@comps/Functions/Input/_.d.ts +5 -0
- package/dist/@comps/Functions/Input/_.js +446 -0
- package/dist/@comps/Functions/Input/core.d.ts +34 -0
- package/dist/@comps/Functions/Input/core.js +324 -0
- package/dist/@comps/Functions/Inputs/_.d.ts +3 -0
- package/dist/@comps/Functions/Inputs/_.js +7 -0
- package/dist/@comps/Functions/Inputs/text.d.ts +12 -0
- package/dist/@comps/Functions/Inputs/text.js +46 -0
- package/dist/@comps/Functions/Layout/PageNotFound.d.ts +1 -0
- package/dist/@comps/Functions/Layout/PageNotFound.js +30 -0
- package/dist/@comps/Functions/Layout/PageRouter.d.ts +2 -0
- package/dist/@comps/Functions/Layout/PageRouter.js +65 -0
- package/dist/@comps/Functions/Layout/PageViewController/parts.d.ts +1 -0
- package/dist/@comps/Functions/Layout/PageViewController/parts.js +30 -0
- package/dist/@comps/Functions/Layout/Plate.d.ts +1 -0
- package/dist/@comps/Functions/Layout/Plate.js +39 -0
- package/dist/@comps/Functions/Layout/RootViewController/parts.d.ts +1 -0
- package/dist/@comps/Functions/Layout/RootViewController/parts.js +202 -0
- package/dist/@comps/Functions/Layout/SwipeView/parts.d.ts +2 -0
- package/dist/@comps/Functions/Layout/SwipeView/parts.js +319 -0
- package/dist/@comps/Functions/Layout/TabBar.d.ts +1 -0
- package/dist/@comps/Functions/Layout/TabBar.js +49 -0
- package/dist/@comps/Functions/Layout/_.d.ts +2 -0
- package/dist/@comps/Functions/Layout/_.js +20 -0
- package/dist/@comps/Functions/Loader/corner.d.ts +1 -0
- package/dist/@comps/Functions/Loader/corner.js +59 -0
- package/dist/@comps/Functions/Loader/mini.d.ts +33 -0
- package/dist/@comps/Functions/Loader/mini.js +126 -0
- package/dist/@comps/Functions/Loader/parts.d.ts +3 -0
- package/dist/@comps/Functions/Loader/parts.js +108 -0
- package/dist/@comps/Functions/Loader/top.d.ts +1 -0
- package/dist/@comps/Functions/Loader/top.js +69 -0
- package/dist/@comps/Functions/Sheet/parts.d.ts +2 -0
- package/dist/@comps/Functions/Sheet/parts.js +724 -0
- package/dist/@comps/Functions/SnackBar/parts.d.ts +2 -0
- package/dist/@comps/Functions/SnackBar/parts.js +171 -0
- package/dist/@comps/Functions/Table/Data/parts.d.ts +3 -0
- package/dist/@comps/Functions/Table/Data/parts.js +629 -0
- package/dist/@comps/Functions/Table/Drag/parts.d.ts +1 -0
- package/dist/@comps/Functions/Table/Drag/parts.js +359 -0
- package/dist/@comps/Functions/Table/Normal/parts.d.ts +1 -0
- package/dist/@comps/Functions/Table/Normal/parts.js +92 -0
- package/dist/@comps/Functions/Table/_.d.ts +9 -0
- package/dist/@comps/Functions/Table/_.js +153 -0
- package/dist/@comps/Functions/Tooltips/parts.d.ts +2 -0
- package/dist/@comps/Functions/Tooltips/parts.js +71 -0
- package/dist/@comps/Molecules/@export.d.ts +21 -0
- package/dist/@comps/Molecules/@export.js +50 -0
- package/dist/@comps/Molecules/Accordion/parts.d.ts +2 -0
- package/dist/@comps/Molecules/Accordion/parts.js +165 -0
- package/dist/@comps/Molecules/LinkifyText/parts.d.ts +1 -0
- package/dist/@comps/Molecules/LinkifyText/parts.js +39 -0
- package/dist/@comps/Molecules/List.d.ts +1 -0
- package/dist/@comps/Molecules/List.js +35 -0
- package/dist/@comps/Organisms/@export.d.ts +2 -0
- package/dist/@comps/Organisms/@export.js +9 -0
- package/dist/@comps/Organisms/DisplayStyleInput/_.d.ts +1 -0
- package/dist/@comps/Organisms/DisplayStyleInput/_.js +15 -0
- package/dist/@comps/Organisms/DisplayStyleInput/darkmode.d.ts +1 -0
- package/dist/@comps/Organisms/DisplayStyleInput/darkmode.js +77 -0
- package/dist/@comps/Organisms/DisplayStyleInput/themeColor.d.ts +27 -0
- package/dist/@comps/Organisms/DisplayStyleInput/themeColor.js +185 -0
- package/dist/@comps/Templates/@export.d.ts +2 -0
- package/dist/@comps/Templates/@export.js +9 -0
- package/dist/@comps/Templates/PlayGround/parts.d.ts +1 -0
- package/dist/@comps/Templates/PlayGround/parts.js +55 -0
- package/dist/@types/_.d.ts +6 -0
- package/dist/@types/_.js +8 -0
- package/dist/@types/amot.d.ts +260 -0
- package/dist/@types/amot.js +2 -0
- package/dist/@types/fn.d.ts +1040 -0
- package/dist/@types/fn.js +2 -0
- package/dist/@types/index.d.ts +59 -0
- package/dist/@types/index.js +2 -0
- package/dist/@types/jsminAmotifyExtension.d.ts +134 -0
- package/dist/@types/jsminAmotifyExtension.js +2 -0
- package/dist/@types/module.d.ts +2 -0
- package/dist/@types/module.js +1 -0
- package/dist/@types/state.d.ts +145 -0
- package/dist/@types/state.js +2 -0
- package/dist/launch.d.ts +3 -0
- package/dist/launch.js +282 -0
- package/package.json +65 -0
- package/tsconfig.json +48 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.TimeFNs = exports.TimeInput = void 0;
|
|
42
|
+
var _global_1 = require("@global");
|
|
43
|
+
var _atoms_1 = require("@atoms");
|
|
44
|
+
var _functions_1 = require("@functions");
|
|
45
|
+
var core_1 = require("../core");
|
|
46
|
+
var Picker_1 = require("./Picker");
|
|
47
|
+
var useEffect = React.useEffect, useState = React.useState, useRef = React.useRef;
|
|
48
|
+
var PeriodMargin = ' ~ ';
|
|
49
|
+
var TimeFormatDatas = {
|
|
50
|
+
clock: {
|
|
51
|
+
defaultValue: '--:--', format: /^\d{2}\D\d{2}$/, ranges: [
|
|
52
|
+
{ type: 'hour', from: 0, length: 2 },
|
|
53
|
+
{ type: 'minute', from: 3, length: 2 }
|
|
54
|
+
], sets: 1
|
|
55
|
+
},
|
|
56
|
+
date: {
|
|
57
|
+
defaultValue: '----/--/--', format: /^\d{4}\D\d{2}\D\d{2}$/, ranges: [
|
|
58
|
+
{ type: 'year', from: 0, length: 4 },
|
|
59
|
+
{ type: 'month', from: 5, length: 2 },
|
|
60
|
+
{ type: 'date', from: 8, length: 2 }
|
|
61
|
+
], sets: 1
|
|
62
|
+
},
|
|
63
|
+
week: {
|
|
64
|
+
defaultValue: '----年第--週', format: /^\d{4}\D\d{2}$/, ranges: [
|
|
65
|
+
{ type: 'year', from: 0, length: 4, region: 6 },
|
|
66
|
+
{ type: 'week', from: 6, length: 2, region: 3 }
|
|
67
|
+
], sets: 1
|
|
68
|
+
},
|
|
69
|
+
month: {
|
|
70
|
+
defaultValue: '----年--月', format: /^\d{4}\D\d{2}$/, ranges: [
|
|
71
|
+
{ type: 'year', from: 0, length: 4 },
|
|
72
|
+
{ type: 'month', from: 5, length: 2, region: 3 }
|
|
73
|
+
], sets: 1
|
|
74
|
+
},
|
|
75
|
+
year: {
|
|
76
|
+
defaultValue: '----年', format: /^\d{4}$/, ranges: [
|
|
77
|
+
{ type: 'year', from: 0, length: 4, region: 5 }
|
|
78
|
+
], sets: 1
|
|
79
|
+
},
|
|
80
|
+
dates: {
|
|
81
|
+
defaultValue: '----/--/--', format: /^\d{4}\D\d{2}\D\d{2}$/, ranges: [
|
|
82
|
+
{ type: 'year', from: 0, length: 4 },
|
|
83
|
+
{ type: 'month', from: 5, length: 2 },
|
|
84
|
+
{ type: 'date', from: 8, length: 2, region: 5 },
|
|
85
|
+
{ type: 'year', from: 10 + PeriodMargin.length, length: 4 },
|
|
86
|
+
{ type: 'month', from: 15 + PeriodMargin.length, length: 2 },
|
|
87
|
+
{ type: 'date', from: 18 + PeriodMargin.length, length: 2 }
|
|
88
|
+
], sets: 2
|
|
89
|
+
},
|
|
90
|
+
months: {
|
|
91
|
+
defaultValue: '----年--月', format: /^\d{4}\D\d{2}$/, ranges: [
|
|
92
|
+
{ type: 'year', from: 0, length: 4 },
|
|
93
|
+
{ type: 'month', from: 5, length: 2, region: 6 },
|
|
94
|
+
{ type: 'year', from: 8 + PeriodMargin.length, length: 4 },
|
|
95
|
+
{ type: 'month', from: 13 + PeriodMargin.length, length: 2, region: 3 }
|
|
96
|
+
], sets: 2
|
|
97
|
+
},
|
|
98
|
+
dateWareki: {
|
|
99
|
+
defaultValue: '----年--月--日', format: /^\d{4}\D\d{2}\D\d{2}$/, ranges: [
|
|
100
|
+
{ type: 'dateWareki', from: 0, length: 4, region: 5 },
|
|
101
|
+
{ type: 'month', from: 5, length: 2, region: 3 },
|
|
102
|
+
{ type: 'date', from: 8, length: 2, region: 3 }
|
|
103
|
+
], sets: 1
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var DataLeveling = function (params) {
|
|
107
|
+
var restrict = params.restrict, value = params.value, era = params.era;
|
|
108
|
+
var dataValue = $.flatArray(value || '');
|
|
109
|
+
var _a = TimeFormatDatas[restrict], defaultValue = _a.defaultValue, format = _a.format, ranges = _a.ranges, sets = _a.sets;
|
|
110
|
+
var formatValues = [];
|
|
111
|
+
var separateStr = restrict == 'clock' ? ':' : '/';
|
|
112
|
+
for (var index = 0; index < dataValue.length; index++) {
|
|
113
|
+
dataValue[index] = String(dataValue[index]).replace(/\D/ig, separateStr);
|
|
114
|
+
}
|
|
115
|
+
var _loop_1 = function (index) {
|
|
116
|
+
var val = dataValue[index] || '';
|
|
117
|
+
if (!val.match(format)) {
|
|
118
|
+
dataValue[index] = '';
|
|
119
|
+
formatValues.push(defaultValue);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
var _value_1 = defaultValue;
|
|
123
|
+
val.split(/\D/).forEach(function (v, i) {
|
|
124
|
+
if (i == 0 && restrict == 'dateWareki') {
|
|
125
|
+
var Year = Number(v);
|
|
126
|
+
if (era != 'year') {
|
|
127
|
+
if (Year >= 2019)
|
|
128
|
+
Year -= 2019;
|
|
129
|
+
else if (Year >= 1989)
|
|
130
|
+
Year -= 1989;
|
|
131
|
+
else if (Year >= 1926)
|
|
132
|
+
Year -= 1926;
|
|
133
|
+
else if (Year >= 1912)
|
|
134
|
+
Year -= 1912;
|
|
135
|
+
else if (Year >= 1868)
|
|
136
|
+
Year -= 1868;
|
|
137
|
+
Year += 1;
|
|
138
|
+
}
|
|
139
|
+
v = Year.zeroEmbed(4);
|
|
140
|
+
}
|
|
141
|
+
_value_1 = _value_1.replace(new RegExp('------------------'.slice(0, v.length)), v);
|
|
142
|
+
});
|
|
143
|
+
formatValues.push(_value_1);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
for (var index = 0; index < sets; index++) {
|
|
147
|
+
_loop_1(index);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
formatValue: formatValues.join(PeriodMargin),
|
|
151
|
+
dataValue: ['dates', 'months'].includes(restrict) ? dataValue : dataValue[0],
|
|
152
|
+
ranges: ranges
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
function DefaultValidation(props) {
|
|
156
|
+
var params = props.params;
|
|
157
|
+
var _a = params, restrict = _a.restrict, min = _a.min, max = _a.max, required = _a.required;
|
|
158
|
+
var notice = [];
|
|
159
|
+
var values = $.flatArray(props.value);
|
|
160
|
+
var validate = {
|
|
161
|
+
empty: false,
|
|
162
|
+
escalated: 1,
|
|
163
|
+
filled: true,
|
|
164
|
+
correct: true,
|
|
165
|
+
prohibited: false
|
|
166
|
+
};
|
|
167
|
+
(function () {
|
|
168
|
+
var separateStr = restrict == 'clock' ? ':' : '/';
|
|
169
|
+
for (var index = 0; index < values.length; index++) {
|
|
170
|
+
values[index] = String(values[index]).replace(/\D/ig, separateStr);
|
|
171
|
+
}
|
|
172
|
+
for (var index = 0; index < values.length; index++) {
|
|
173
|
+
var value = values[index];
|
|
174
|
+
var prevValue = values[index - 1];
|
|
175
|
+
if (!value.removeLetters())
|
|
176
|
+
validate.empty = true;
|
|
177
|
+
if (index > 0)
|
|
178
|
+
validate.escalated &= Number(value >= prevValue);
|
|
179
|
+
}
|
|
180
|
+
if (!validate.escalated)
|
|
181
|
+
return;
|
|
182
|
+
if (validate.empty)
|
|
183
|
+
return;
|
|
184
|
+
if (restrict.match(/clock/)) {
|
|
185
|
+
values.forEach(function (value) {
|
|
186
|
+
var _a = __read(value.split(/\D+/), 2), hour = _a[0], minute = _a[1];
|
|
187
|
+
if (!hour || !minute) {
|
|
188
|
+
validate.filled = false;
|
|
189
|
+
}
|
|
190
|
+
else if (Number(hour) > 23 || Number(minute) > 59) {
|
|
191
|
+
validate.correct = false;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else if (restrict.match(/date/)) {
|
|
196
|
+
values.forEach(function (value) {
|
|
197
|
+
var _a = __read(value.split(/\D+/), 3), year = _a[0], month = _a[1], day = _a[2];
|
|
198
|
+
if (!year || !month || !day) {
|
|
199
|
+
validate.filled = false;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
var Time = $.Time(value);
|
|
203
|
+
if (!Time.validate || value != Time.toFormatYMD()) {
|
|
204
|
+
validate.correct = false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
else if (restrict.match(/week/)) {
|
|
210
|
+
values.forEach(function (value) {
|
|
211
|
+
var _a = __read(value.split(/\D+/), 2), year = _a[0], week = _a[1];
|
|
212
|
+
if (!year || !week) {
|
|
213
|
+
validate.filled = false;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
var yearFirstDay = $.Time(year + '/01/01').weekday;
|
|
217
|
+
var yearFirstWeek0Day = $.Time(year + '/01/0' + (7 - yearFirstDay + 1));
|
|
218
|
+
var yearValueWeek0Day = yearFirstWeek0Day.addWeek(Number(week) - 1);
|
|
219
|
+
if (year != String(yearValueWeek0Day.year)) {
|
|
220
|
+
validate.correct = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else if (restrict.match(/month/)) {
|
|
226
|
+
values.forEach(function (value) {
|
|
227
|
+
var _a = __read(value.split(/\D+/), 2), year = _a[0], month = _a[1];
|
|
228
|
+
if (!year || !month) {
|
|
229
|
+
validate.filled = false;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
var date = $.Time([year, month, '01'].join('/'));
|
|
233
|
+
if (!date.validate)
|
|
234
|
+
validate.correct = false;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
else if (restrict.match(/year/)) {
|
|
239
|
+
}
|
|
240
|
+
if (validate.filled && validate.correct) {
|
|
241
|
+
values.forEach(function (value) {
|
|
242
|
+
{
|
|
243
|
+
var VAL = Number(String(value).replace(/\D/ig, ''));
|
|
244
|
+
if (min) {
|
|
245
|
+
var MIN = Number(String(min).replace(/\D/ig, ''));
|
|
246
|
+
if (MIN > VAL)
|
|
247
|
+
validate.prohibited = true;
|
|
248
|
+
}
|
|
249
|
+
if (max) {
|
|
250
|
+
var MAX = Number(String(max).replace(/\D/ig, ''));
|
|
251
|
+
if (VAL > MAX)
|
|
252
|
+
validate.prohibited = true;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
})();
|
|
258
|
+
{
|
|
259
|
+
var empty = validate.empty, escalated = validate.escalated, filled = validate.filled, correct = validate.correct, prohibited = validate.prohibited;
|
|
260
|
+
if (empty && required) {
|
|
261
|
+
notice = [
|
|
262
|
+
{ type: 'invalid', label: '必須項目です' }
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
if (!escalated) {
|
|
266
|
+
notice.push({ type: 'invalid', label: '時系列を正しく入力してください' });
|
|
267
|
+
}
|
|
268
|
+
if (!correct) {
|
|
269
|
+
notice.push({ type: 'invalid', label: '無効な値が入力されています' });
|
|
270
|
+
}
|
|
271
|
+
if (!filled) {
|
|
272
|
+
notice.push({ type: 'invalid', label: '最後まで値を埋めてください' });
|
|
273
|
+
}
|
|
274
|
+
if (prohibited) {
|
|
275
|
+
notice.push({
|
|
276
|
+
type: 'invalid', label: React.createElement(React.Fragment, null,
|
|
277
|
+
React.createElement(_atoms_1.Box, null, "\u5165\u529B\u7BC4\u56F2\u304C\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059"),
|
|
278
|
+
"[",
|
|
279
|
+
min || '下限無し',
|
|
280
|
+
"] ~ [",
|
|
281
|
+
max || '上限無し',
|
|
282
|
+
"]")
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
ok: !notice.filter(function (_a) {
|
|
288
|
+
var type = _a.type;
|
|
289
|
+
return type == 'invalid';
|
|
290
|
+
}).length,
|
|
291
|
+
notice: notice
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
var TimeInput = function (params) {
|
|
295
|
+
var tone = params.tone, required = params.required, _a = params.restrict, restrict = _a === void 0 ? 'clock' : _a, componentID = params.componentID, era = params.era, form = params.form, name = params.name, min = params.min, max = params.max, className = params.className, enableFormSubmit = params.enableFormSubmit, checkValidationAtFirst = params.checkValidationAtFirst, onKeyDown = params.onKeyDown, onValidate = params.onValidate, onUpdateValue = params.onUpdateValue, onUpdateValidValue = params.onUpdateValidValue, _b = params.value, value = _b === void 0 ? '' : _b, leftIndicator = params.leftIndicator, rightIndicator = params.rightIndicator, others = __rest(params, ["tone", "required", "restrict", "componentID", "era", "form", "name", "min", "max", "className", "enableFormSubmit", "checkValidationAtFirst", "onKeyDown", "onValidate", "onUpdateValue", "onUpdateValidValue", "value", "leftIndicator", "rightIndicator"]);
|
|
296
|
+
var _c = __read(useState(era), 2), val_era = _c[0], set_era = _c[1];
|
|
297
|
+
var _d = __read(useState(__assign(__assign({ componentID: params.componentID || '' }, DataLeveling({
|
|
298
|
+
restrict: restrict,
|
|
299
|
+
value: value,
|
|
300
|
+
era: val_era
|
|
301
|
+
})), { eventType: 'init', eventID: $.uuidGen() })), 2), val_status = _d[0], set_status = _d[1];
|
|
302
|
+
var _e = __read(useState({
|
|
303
|
+
ok: false,
|
|
304
|
+
notice: []
|
|
305
|
+
}), 2), val_validate = _e[0], set_validate = _e[1];
|
|
306
|
+
var _f = __read(useState({
|
|
307
|
+
active: false,
|
|
308
|
+
index: 0,
|
|
309
|
+
prevIndex: -1
|
|
310
|
+
}), 2), val_focus = _f[0], set_focus = _f[1];
|
|
311
|
+
(0, core_1.CommonEffects)({
|
|
312
|
+
type: 'time',
|
|
313
|
+
params: params,
|
|
314
|
+
val_status: val_status,
|
|
315
|
+
set_status: set_status,
|
|
316
|
+
val_validate: val_validate,
|
|
317
|
+
set_validate: set_validate,
|
|
318
|
+
DefaultValidation: DefaultValidation,
|
|
319
|
+
onUpdateValue: onUpdateValue,
|
|
320
|
+
onUpdateValidValue: onUpdateValidValue,
|
|
321
|
+
ExtraOverrideParams: __assign({}, DataLeveling({
|
|
322
|
+
restrict: restrict,
|
|
323
|
+
value: value,
|
|
324
|
+
era: val_era
|
|
325
|
+
}))
|
|
326
|
+
});
|
|
327
|
+
var mounted = useRef(false);
|
|
328
|
+
useEffect(function () {
|
|
329
|
+
if (mounted.current) {
|
|
330
|
+
set_status(__assign(__assign({}, val_status), DataLeveling({
|
|
331
|
+
restrict: restrict,
|
|
332
|
+
value: val_status.dataValue,
|
|
333
|
+
era: val_era
|
|
334
|
+
})));
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
mounted.current = true;
|
|
338
|
+
}
|
|
339
|
+
}, [val_era]);
|
|
340
|
+
_global_1.useStore.update({
|
|
341
|
+
key: val_status.componentID,
|
|
342
|
+
value: {
|
|
343
|
+
openPicker: function () {
|
|
344
|
+
if (params.disabled)
|
|
345
|
+
return;
|
|
346
|
+
exports.TimeFNs.picker.launch({
|
|
347
|
+
parent: '#Picker-' + val_status.componentID,
|
|
348
|
+
tipsID: 'PickerTips-' + val_status.componentID,
|
|
349
|
+
restrict: restrict,
|
|
350
|
+
min: min,
|
|
351
|
+
max: max,
|
|
352
|
+
defaultValue: val_status.dataValue,
|
|
353
|
+
onValueUpdate: function (value) {
|
|
354
|
+
set_status(__assign(__assign(__assign({}, val_status), DataLeveling({
|
|
355
|
+
restrict: restrict,
|
|
356
|
+
value: value,
|
|
357
|
+
era: val_era
|
|
358
|
+
})), { eventType: 'update', eventID: $.uuidGen() }));
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
resetEra: function (era) {
|
|
363
|
+
set_era(era);
|
|
364
|
+
set_status(__assign(__assign(__assign({}, val_status), DataLeveling({
|
|
365
|
+
restrict: restrict,
|
|
366
|
+
value: '',
|
|
367
|
+
era: val_era
|
|
368
|
+
})), { eventType: 'update', eventID: $.uuidGen() }));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
useEffect(function () {
|
|
373
|
+
var index = val_focus.index, active = val_focus.active;
|
|
374
|
+
if (active) {
|
|
375
|
+
index = Math.max(index, 0);
|
|
376
|
+
index = Math.min(index, val_status.ranges.length - 1);
|
|
377
|
+
var _a = val_status.ranges[index], from = _a.from, length_1 = _a.length;
|
|
378
|
+
var input = $('#' + params.id)[0];
|
|
379
|
+
if (input)
|
|
380
|
+
input.setSelectionRange(from, (from + length_1));
|
|
381
|
+
}
|
|
382
|
+
}, [val_focus]);
|
|
383
|
+
return (React.createElement(core_1.BoxWrapper, { val_status: val_status, set_status: set_status, val_validate: val_validate, params: params },
|
|
384
|
+
React.createElement(_functions_1.Input.Hidden, { name: name, "data-input-type": 'time', "data-form": form, "data-validation": val_validate.ok, componentID: val_status.componentID, "data-value": JSON.stringify(['dates', 'months'].includes(restrict) ?
|
|
385
|
+
!val_status.dataValue[0] || !val_status.dataValue[1] ? null
|
|
386
|
+
: val_status.dataValue
|
|
387
|
+
: (val_status.dataValue || null)) }),
|
|
388
|
+
amotify.config.device.isTouchDevice ?
|
|
389
|
+
React.createElement(_functions_1.Buttons.Button.Plain, { className: className, freeCSS: {
|
|
390
|
+
textAlign: 'left'
|
|
391
|
+
}, children: val_status.formatValue, onClick: function (event) {
|
|
392
|
+
var component = _global_1.useStore.get(val_status.componentID);
|
|
393
|
+
if (component)
|
|
394
|
+
component.openPicker();
|
|
395
|
+
event.stopPropagation();
|
|
396
|
+
} }) : React.createElement("input", __assign({ type: 'text', inputMode: 'numeric', "data-input-type": 'time', "data-form-name": form, value: val_status.formatValue, className: className, tabIndex: amotify.config.device.isTouchDevice ? -1 : 0, onKeyDown: function (event) {
|
|
397
|
+
KeyDownEvent({
|
|
398
|
+
restrict: restrict,
|
|
399
|
+
event: event,
|
|
400
|
+
val_era: val_era,
|
|
401
|
+
val_status: val_status,
|
|
402
|
+
set_status: set_status,
|
|
403
|
+
val_focus: val_focus,
|
|
404
|
+
set_focus: set_focus
|
|
405
|
+
});
|
|
406
|
+
if (onKeyDown)
|
|
407
|
+
onKeyDown(event);
|
|
408
|
+
if (enableFormSubmit)
|
|
409
|
+
(0, core_1.SubmitForm)(event);
|
|
410
|
+
}, onKeyUp: function (event) {
|
|
411
|
+
if (event.key == 'Tab')
|
|
412
|
+
set_focus(__assign(__assign({}, val_focus), { active: true }));
|
|
413
|
+
}, onClick: function (event) {
|
|
414
|
+
var caretTo = event.target.selectionEnd;
|
|
415
|
+
var Index = 0;
|
|
416
|
+
val_status.ranges.forEach(function (range, index) {
|
|
417
|
+
var from = range.from, length = range.length, region = range.region;
|
|
418
|
+
if (from <= caretTo && caretTo <= (from + (region || length))) {
|
|
419
|
+
Index = index;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
set_focus(__assign(__assign({}, val_focus), { active: true, index: Index }));
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
} }, others))));
|
|
425
|
+
};
|
|
426
|
+
exports.TimeInput = TimeInput;
|
|
427
|
+
var KeyDownEvent = function (props) {
|
|
428
|
+
var val_era = props.val_era, restrict = props.restrict, event = props.event, val_status = props.val_status, set_status = props.set_status, val_focus = props.val_focus, set_focus = props.set_focus;
|
|
429
|
+
var key = event.key, shiftKey = event.shiftKey, ctrlKey = event.ctrlKey, metaKey = event.metaKey;
|
|
430
|
+
var auxKey = ctrlKey || metaKey;
|
|
431
|
+
var _a = event.target, caretFrom = _a.selectionStart, caretTo = _a.selectionEnd;
|
|
432
|
+
var currentFocusIndex = val_focus.index, prevFocusIndex = val_focus.prevIndex;
|
|
433
|
+
var ranges = val_status.ranges, formatValue = val_status.formatValue;
|
|
434
|
+
var maxFocusIndex = ranges.length - 1;
|
|
435
|
+
if (['Tab', 'ArrowLeft', 'ArrowRight'].includes(key)) {
|
|
436
|
+
var nextFocusIndex = 0;
|
|
437
|
+
if (key == 'Tab') {
|
|
438
|
+
var direction = Number(!shiftKey) * 2 - 1;
|
|
439
|
+
nextFocusIndex = val_focus.index + direction;
|
|
440
|
+
if (nextFocusIndex < 0 || nextFocusIndex > maxFocusIndex)
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
var direction = key == 'ArrowLeft' ? -1 : key == 'ArrowRight' ? 1 : 0;
|
|
445
|
+
if (auxKey) {
|
|
446
|
+
nextFocusIndex = direction == 1 ? maxFocusIndex : 0;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
if (caretFrom == 0 && caretTo == String(val_status.formatValue).length) {
|
|
450
|
+
nextFocusIndex = direction == 1 ? maxFocusIndex : 0;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
nextFocusIndex = Math.max(0, Math.min(currentFocusIndex + direction, maxFocusIndex));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
set_focus(__assign(__assign({}, val_focus), { index: nextFocusIndex, prevIndex: currentFocusIndex }));
|
|
458
|
+
event.preventDefault();
|
|
459
|
+
}
|
|
460
|
+
if (['Backspace', 'ArrowUp', 'ArrowDown', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(key)) {
|
|
461
|
+
event.preventDefault();
|
|
462
|
+
var nextFocusIndex = currentFocusIndex;
|
|
463
|
+
nextFocusIndex = Math.max(nextFocusIndex, 0);
|
|
464
|
+
nextFocusIndex = Math.min(nextFocusIndex, maxFocusIndex);
|
|
465
|
+
var _b = ranges[nextFocusIndex], type = _b.type, from = _b.from, length_2 = _b.length;
|
|
466
|
+
var prevValue = formatValue.slice(from, (from + length_2));
|
|
467
|
+
var partsValue = void 0;
|
|
468
|
+
if (key == 'Backspace') {
|
|
469
|
+
partsValue = '------'.slice(0, length_2);
|
|
470
|
+
}
|
|
471
|
+
else if (['ArrowUp', 'ArrowDown'].includes(key)) {
|
|
472
|
+
var direction = key == 'ArrowUp' ? 1 : -1;
|
|
473
|
+
prevValue = prevValue | 0;
|
|
474
|
+
partsValue = prevValue + direction;
|
|
475
|
+
var _c = __read(type == 'dateWareki' ?
|
|
476
|
+
val_era == 'year' ? [0, 2999, 4]
|
|
477
|
+
: val_era == 'reiwa' ? [1, 2999, 4]
|
|
478
|
+
: val_era == 'heisei' ? [1, 31, 4]
|
|
479
|
+
: val_era == 'shouwa' ? [1, 64, 4]
|
|
480
|
+
: val_era == 'taisho' ? [1, 15, 4]
|
|
481
|
+
: val_era == 'meiji' ? [1, 45, 4] : [0, 0, 0]
|
|
482
|
+
: type == 'minute' ? [0, 59, 2]
|
|
483
|
+
: type == 'hour' ? [0, 23, 2]
|
|
484
|
+
: type == 'date' ? [1, 31, 2]
|
|
485
|
+
: type == 'week' ? [1, 53, 2]
|
|
486
|
+
: type == 'month' ? [1, 12, 2]
|
|
487
|
+
: type == 'year' ? [0, 2999, 4] : [0, 0, 0], 3), min = _c[0], max = _c[1], range = _c[2];
|
|
488
|
+
if (partsValue > max)
|
|
489
|
+
partsValue = min;
|
|
490
|
+
else if (partsValue < min)
|
|
491
|
+
partsValue = max;
|
|
492
|
+
partsValue = (Number(partsValue)).zeroEmbed(range);
|
|
493
|
+
}
|
|
494
|
+
else if (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(key)) {
|
|
495
|
+
var prev = prevValue | 0;
|
|
496
|
+
var add = key;
|
|
497
|
+
var compound = "".concat(prev).concat(add);
|
|
498
|
+
if (prevFocusIndex != currentFocusIndex && prevFocusIndex >= 0) {
|
|
499
|
+
prev = 0, compound = '0' + add;
|
|
500
|
+
}
|
|
501
|
+
if (type == 'year' || (type == 'dateWareki' && val_era == 'year')) {
|
|
502
|
+
if (Number(compound) > 10000)
|
|
503
|
+
partsValue = add;
|
|
504
|
+
else
|
|
505
|
+
partsValue = compound;
|
|
506
|
+
if ((partsValue | 0) > 1000)
|
|
507
|
+
nextFocusIndex++;
|
|
508
|
+
}
|
|
509
|
+
else if (['hour', 'minute', 'date', 'week', 'month'].includes(type) ||
|
|
510
|
+
(type == 'dateWareki' && val_era != 'year')) {
|
|
511
|
+
var base = type == 'dateWareki' ?
|
|
512
|
+
val_era == 'reiwa' ? 100
|
|
513
|
+
: val_era == 'heisei' ? 31
|
|
514
|
+
: val_era == 'shouwa' ? 64
|
|
515
|
+
: val_era == 'taisho' ? 15
|
|
516
|
+
: val_era == 'meiji' ? 45 : 0
|
|
517
|
+
: type == 'minute' ? 59
|
|
518
|
+
: type == 'hour' ? 23
|
|
519
|
+
: type == 'date' ? 31
|
|
520
|
+
: type == 'week' ? 53
|
|
521
|
+
: type == 'month' ? 12 : 0;
|
|
522
|
+
partsValue = (compound | 0) > base ? add : compound;
|
|
523
|
+
if (Number(add) > Number(String(base)[0]) ||
|
|
524
|
+
(prevValue == '0000'.slice(0, String(base).length) && (compound != '0000'.slice(0, String(base).length) ||
|
|
525
|
+
(['minute', 'hour'].includes(type) && prevFocusIndex == currentFocusIndex))) || (compound | 0) >= (Math.pow(10, (String(base).length - 1))))
|
|
526
|
+
nextFocusIndex++;
|
|
527
|
+
}
|
|
528
|
+
if (type == 'year' || type == 'dateWareki')
|
|
529
|
+
partsValue = (partsValue | 0).zeroEmbed(4);
|
|
530
|
+
else
|
|
531
|
+
partsValue = (partsValue | 0).zeroEmbed(2);
|
|
532
|
+
}
|
|
533
|
+
{
|
|
534
|
+
var nextFormatValue = String(formatValue).partReplace(from, String(partsValue));
|
|
535
|
+
var nextDataValue = nextFormatValue.split(PeriodMargin).map(function (value) {
|
|
536
|
+
return value.replace(/(^\D|\D$)/, '').split(/\D+/).join(restrict == 'clock' ? ':' : '/');
|
|
537
|
+
});
|
|
538
|
+
if (restrict == 'dateWareki') {
|
|
539
|
+
var v = nextDataValue[0].split(/\D/);
|
|
540
|
+
var _d = __read(v, 3), year = _d[0], month = _d[1], day = _d[2];
|
|
541
|
+
if (v.length == 3 && year) {
|
|
542
|
+
var yearYear = Number(year) - 1 + Number({
|
|
543
|
+
year: 1, reiwa: 2019, heisei: 1989, shouwa: 1926, taisho: 1912, meiji: 1868
|
|
544
|
+
}[val_era]);
|
|
545
|
+
nextDataValue = [[yearYear, month, day].join('/')];
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
nextFocusIndex = Math.max(nextFocusIndex, 0);
|
|
549
|
+
nextFocusIndex = Math.min(nextFocusIndex, maxFocusIndex);
|
|
550
|
+
set_status(__assign(__assign({}, val_status), { dataValue: ['dates', 'months'].includes(restrict) ? nextDataValue : nextDataValue[0], formatValue: nextFormatValue, eventType: 'update', eventID: $.uuidGen() }));
|
|
551
|
+
set_focus(__assign(__assign({}, val_focus), { index: nextFocusIndex, prevIndex: val_focus.index }));
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
exports.TimeFNs = {
|
|
556
|
+
picker: {
|
|
557
|
+
launch: function (params) {
|
|
558
|
+
var tipsID = params.tipsID || $.uuidGen();
|
|
559
|
+
_functions_1.Tooltips.open(__assign(__assign({ gravityPoint: params.gravityPoint || 24, padding: [1, 0], tipsID: tipsID }, params), { closeOption: __assign({ aroundClick: true, elementBlur: false }, params.closeOption), content: React.createElement(Picker_1.Picker, { restrict: params.restrict, min: params.min, max: params.max, defaultValue: params.defaultValue, tipsID: tipsID, onValueUpdate: function (value) {
|
|
560
|
+
params.onValueUpdate(value);
|
|
561
|
+
} }) }));
|
|
562
|
+
},
|
|
563
|
+
remove: function (tipsID) {
|
|
564
|
+
_functions_1.Tooltips.close(tipsID);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|