@esic-lab/data-core-ui 0.0.36 → 0.0.38
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/index.d.mts +529 -0
- package/dist/index.d.ts +1 -45
- package/dist/index.js +590 -867
- package/dist/index.mjs +3688 -0
- package/package.json +2 -11
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3688 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/dayjs/dayjs.min.js
|
|
28
|
+
var require_dayjs_min = __commonJS({
|
|
29
|
+
"node_modules/dayjs/dayjs.min.js"(exports, module) {
|
|
30
|
+
"use strict";
|
|
31
|
+
!(function(t, e) {
|
|
32
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
33
|
+
})(exports, (function() {
|
|
34
|
+
"use strict";
|
|
35
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
|
36
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
37
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
38
|
+
} }, m = function(t2, e2, n2) {
|
|
39
|
+
var r2 = String(t2);
|
|
40
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
41
|
+
}, v = { s: m, z: function(t2) {
|
|
42
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
43
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
44
|
+
}, m: function t2(e2, n2) {
|
|
45
|
+
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
46
|
+
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
47
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
48
|
+
}, a: function(t2) {
|
|
49
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
50
|
+
}, p: function(t2) {
|
|
51
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
52
|
+
}, u: function(t2) {
|
|
53
|
+
return void 0 === t2;
|
|
54
|
+
} }, g = "en", D = {};
|
|
55
|
+
D[g] = M;
|
|
56
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
57
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
58
|
+
}, w = function t2(e2, n2, r2) {
|
|
59
|
+
var i2;
|
|
60
|
+
if (!e2) return g;
|
|
61
|
+
if ("string" == typeof e2) {
|
|
62
|
+
var s2 = e2.toLowerCase();
|
|
63
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
64
|
+
var u2 = e2.split("-");
|
|
65
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
66
|
+
} else {
|
|
67
|
+
var a2 = e2.name;
|
|
68
|
+
D[a2] = e2, i2 = a2;
|
|
69
|
+
}
|
|
70
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
71
|
+
}, O = function(t2, e2) {
|
|
72
|
+
if (S(t2)) return t2.clone();
|
|
73
|
+
var n2 = "object" == typeof e2 ? e2 : {};
|
|
74
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
75
|
+
}, b = v;
|
|
76
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
77
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
78
|
+
};
|
|
79
|
+
var _ = (function() {
|
|
80
|
+
function M2(t2) {
|
|
81
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
82
|
+
}
|
|
83
|
+
var m2 = M2.prototype;
|
|
84
|
+
return m2.parse = function(t2) {
|
|
85
|
+
this.$d = (function(t3) {
|
|
86
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
87
|
+
if (null === e2) return /* @__PURE__ */ new Date(NaN);
|
|
88
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
89
|
+
if (e2 instanceof Date) return new Date(e2);
|
|
90
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
91
|
+
var r2 = e2.match($);
|
|
92
|
+
if (r2) {
|
|
93
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
94
|
+
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return new Date(e2);
|
|
98
|
+
})(t2), this.init();
|
|
99
|
+
}, m2.init = function() {
|
|
100
|
+
var t2 = this.$d;
|
|
101
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
102
|
+
}, m2.$utils = function() {
|
|
103
|
+
return b;
|
|
104
|
+
}, m2.isValid = function() {
|
|
105
|
+
return !(this.$d.toString() === l);
|
|
106
|
+
}, m2.isSame = function(t2, e2) {
|
|
107
|
+
var n2 = O(t2);
|
|
108
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
109
|
+
}, m2.isAfter = function(t2, e2) {
|
|
110
|
+
return O(t2) < this.startOf(e2);
|
|
111
|
+
}, m2.isBefore = function(t2, e2) {
|
|
112
|
+
return this.endOf(e2) < O(t2);
|
|
113
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
114
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
115
|
+
}, m2.unix = function() {
|
|
116
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
117
|
+
}, m2.valueOf = function() {
|
|
118
|
+
return this.$d.getTime();
|
|
119
|
+
}, m2.startOf = function(t2, e2) {
|
|
120
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
121
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
122
|
+
return r2 ? i2 : i2.endOf(a);
|
|
123
|
+
}, $2 = function(t3, e3) {
|
|
124
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
125
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
126
|
+
switch (f2) {
|
|
127
|
+
case h:
|
|
128
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
129
|
+
case c:
|
|
130
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
131
|
+
case o:
|
|
132
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
133
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
134
|
+
case a:
|
|
135
|
+
case d:
|
|
136
|
+
return $2(v2 + "Hours", 0);
|
|
137
|
+
case u:
|
|
138
|
+
return $2(v2 + "Minutes", 1);
|
|
139
|
+
case s:
|
|
140
|
+
return $2(v2 + "Seconds", 2);
|
|
141
|
+
case i:
|
|
142
|
+
return $2(v2 + "Milliseconds", 3);
|
|
143
|
+
default:
|
|
144
|
+
return this.clone();
|
|
145
|
+
}
|
|
146
|
+
}, m2.endOf = function(t2) {
|
|
147
|
+
return this.startOf(t2, false);
|
|
148
|
+
}, m2.$set = function(t2, e2) {
|
|
149
|
+
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
150
|
+
if (o2 === c || o2 === h) {
|
|
151
|
+
var y2 = this.clone().set(d, 1);
|
|
152
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
153
|
+
} else l2 && this.$d[l2]($2);
|
|
154
|
+
return this.init(), this;
|
|
155
|
+
}, m2.set = function(t2, e2) {
|
|
156
|
+
return this.clone().$set(t2, e2);
|
|
157
|
+
}, m2.get = function(t2) {
|
|
158
|
+
return this[b.p(t2)]();
|
|
159
|
+
}, m2.add = function(r2, f2) {
|
|
160
|
+
var d2, l2 = this;
|
|
161
|
+
r2 = Number(r2);
|
|
162
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
163
|
+
var e2 = O(l2);
|
|
164
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
165
|
+
};
|
|
166
|
+
if ($2 === c) return this.set(c, this.$M + r2);
|
|
167
|
+
if ($2 === h) return this.set(h, this.$y + r2);
|
|
168
|
+
if ($2 === a) return y2(1);
|
|
169
|
+
if ($2 === o) return y2(7);
|
|
170
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
171
|
+
return b.w(m3, this);
|
|
172
|
+
}, m2.subtract = function(t2, e2) {
|
|
173
|
+
return this.add(-1 * t2, e2);
|
|
174
|
+
}, m2.format = function(t2) {
|
|
175
|
+
var e2 = this, n2 = this.$locale();
|
|
176
|
+
if (!this.isValid()) return n2.invalidDate || l;
|
|
177
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
178
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
179
|
+
}, d2 = function(t3) {
|
|
180
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
181
|
+
}, $2 = f2 || function(t3, e3, n3) {
|
|
182
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
183
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
184
|
+
};
|
|
185
|
+
return r2.replace(y, (function(t3, r3) {
|
|
186
|
+
return r3 || (function(t4) {
|
|
187
|
+
switch (t4) {
|
|
188
|
+
case "YY":
|
|
189
|
+
return String(e2.$y).slice(-2);
|
|
190
|
+
case "YYYY":
|
|
191
|
+
return b.s(e2.$y, 4, "0");
|
|
192
|
+
case "M":
|
|
193
|
+
return a2 + 1;
|
|
194
|
+
case "MM":
|
|
195
|
+
return b.s(a2 + 1, 2, "0");
|
|
196
|
+
case "MMM":
|
|
197
|
+
return h2(n2.monthsShort, a2, c2, 3);
|
|
198
|
+
case "MMMM":
|
|
199
|
+
return h2(c2, a2);
|
|
200
|
+
case "D":
|
|
201
|
+
return e2.$D;
|
|
202
|
+
case "DD":
|
|
203
|
+
return b.s(e2.$D, 2, "0");
|
|
204
|
+
case "d":
|
|
205
|
+
return String(e2.$W);
|
|
206
|
+
case "dd":
|
|
207
|
+
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
208
|
+
case "ddd":
|
|
209
|
+
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
210
|
+
case "dddd":
|
|
211
|
+
return o2[e2.$W];
|
|
212
|
+
case "H":
|
|
213
|
+
return String(s2);
|
|
214
|
+
case "HH":
|
|
215
|
+
return b.s(s2, 2, "0");
|
|
216
|
+
case "h":
|
|
217
|
+
return d2(1);
|
|
218
|
+
case "hh":
|
|
219
|
+
return d2(2);
|
|
220
|
+
case "a":
|
|
221
|
+
return $2(s2, u2, true);
|
|
222
|
+
case "A":
|
|
223
|
+
return $2(s2, u2, false);
|
|
224
|
+
case "m":
|
|
225
|
+
return String(u2);
|
|
226
|
+
case "mm":
|
|
227
|
+
return b.s(u2, 2, "0");
|
|
228
|
+
case "s":
|
|
229
|
+
return String(e2.$s);
|
|
230
|
+
case "ss":
|
|
231
|
+
return b.s(e2.$s, 2, "0");
|
|
232
|
+
case "SSS":
|
|
233
|
+
return b.s(e2.$ms, 3, "0");
|
|
234
|
+
case "Z":
|
|
235
|
+
return i2;
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
})(t3) || i2.replace(":", "");
|
|
239
|
+
}));
|
|
240
|
+
}, m2.utcOffset = function() {
|
|
241
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
242
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
243
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
244
|
+
return b.m(y2, m3);
|
|
245
|
+
};
|
|
246
|
+
switch (M3) {
|
|
247
|
+
case h:
|
|
248
|
+
$2 = D2() / 12;
|
|
249
|
+
break;
|
|
250
|
+
case c:
|
|
251
|
+
$2 = D2();
|
|
252
|
+
break;
|
|
253
|
+
case f:
|
|
254
|
+
$2 = D2() / 3;
|
|
255
|
+
break;
|
|
256
|
+
case o:
|
|
257
|
+
$2 = (g2 - v2) / 6048e5;
|
|
258
|
+
break;
|
|
259
|
+
case a:
|
|
260
|
+
$2 = (g2 - v2) / 864e5;
|
|
261
|
+
break;
|
|
262
|
+
case u:
|
|
263
|
+
$2 = g2 / n;
|
|
264
|
+
break;
|
|
265
|
+
case s:
|
|
266
|
+
$2 = g2 / e;
|
|
267
|
+
break;
|
|
268
|
+
case i:
|
|
269
|
+
$2 = g2 / t;
|
|
270
|
+
break;
|
|
271
|
+
default:
|
|
272
|
+
$2 = g2;
|
|
273
|
+
}
|
|
274
|
+
return l2 ? $2 : b.a($2);
|
|
275
|
+
}, m2.daysInMonth = function() {
|
|
276
|
+
return this.endOf(c).$D;
|
|
277
|
+
}, m2.$locale = function() {
|
|
278
|
+
return D[this.$L];
|
|
279
|
+
}, m2.locale = function(t2, e2) {
|
|
280
|
+
if (!t2) return this.$L;
|
|
281
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
282
|
+
return r2 && (n2.$L = r2), n2;
|
|
283
|
+
}, m2.clone = function() {
|
|
284
|
+
return b.w(this.$d, this);
|
|
285
|
+
}, m2.toDate = function() {
|
|
286
|
+
return new Date(this.valueOf());
|
|
287
|
+
}, m2.toJSON = function() {
|
|
288
|
+
return this.isValid() ? this.toISOString() : null;
|
|
289
|
+
}, m2.toISOString = function() {
|
|
290
|
+
return this.$d.toISOString();
|
|
291
|
+
}, m2.toString = function() {
|
|
292
|
+
return this.$d.toUTCString();
|
|
293
|
+
}, M2;
|
|
294
|
+
})(), k = _.prototype;
|
|
295
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) {
|
|
296
|
+
k[t2[1]] = function(e2) {
|
|
297
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
298
|
+
};
|
|
299
|
+
})), O.extend = function(t2, e2) {
|
|
300
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
301
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
302
|
+
return O(1e3 * t2);
|
|
303
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// node_modules/dayjs/locale/th.js
|
|
309
|
+
var require_th = __commonJS({
|
|
310
|
+
"node_modules/dayjs/locale/th.js"(exports, module) {
|
|
311
|
+
"use strict";
|
|
312
|
+
!(function(_, e) {
|
|
313
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = e(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], e) : (_ = "undefined" != typeof globalThis ? globalThis : _ || self).dayjs_locale_th = e(_.dayjs);
|
|
314
|
+
})(exports, (function(_) {
|
|
315
|
+
"use strict";
|
|
316
|
+
function e(_2) {
|
|
317
|
+
return _2 && "object" == typeof _2 && "default" in _2 ? _2 : { default: _2 };
|
|
318
|
+
}
|
|
319
|
+
var t = e(_), d = { name: "th", weekdays: "\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C_\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C_\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23_\u0E1E\u0E38\u0E18_\u0E1E\u0E24\u0E2B\u0E31\u0E2A\u0E1A\u0E14\u0E35_\u0E28\u0E38\u0E01\u0E23\u0E4C_\u0E40\u0E2A\u0E32\u0E23\u0E4C".split("_"), weekdaysShort: "\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C_\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C_\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23_\u0E1E\u0E38\u0E18_\u0E1E\u0E24\u0E2B\u0E31\u0E2A_\u0E28\u0E38\u0E01\u0E23\u0E4C_\u0E40\u0E2A\u0E32\u0E23\u0E4C".split("_"), weekdaysMin: "\u0E2D\u0E32._\u0E08._\u0E2D._\u0E1E._\u0E1E\u0E24._\u0E28._\u0E2A.".split("_"), months: "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21_\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C_\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21_\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19_\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21_\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19_\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21_\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21_\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19_\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21_\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19_\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21".split("_"), monthsShort: "\u0E21.\u0E04._\u0E01.\u0E1E._\u0E21\u0E35.\u0E04._\u0E40\u0E21.\u0E22._\u0E1E.\u0E04._\u0E21\u0E34.\u0E22._\u0E01.\u0E04._\u0E2A.\u0E04._\u0E01.\u0E22._\u0E15.\u0E04._\u0E1E.\u0E22._\u0E18.\u0E04.".split("_"), formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY \u0E40\u0E27\u0E25\u0E32 H:mm", LLLL: "\u0E27\u0E31\u0E19dddd\u0E17\u0E35\u0E48 D MMMM YYYY \u0E40\u0E27\u0E25\u0E32 H:mm" }, relativeTime: { future: "\u0E2D\u0E35\u0E01 %s", past: "%s\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27", s: "\u0E44\u0E21\u0E48\u0E01\u0E35\u0E48\u0E27\u0E34\u0E19\u0E32\u0E17\u0E35", m: "1 \u0E19\u0E32\u0E17\u0E35", mm: "%d \u0E19\u0E32\u0E17\u0E35", h: "1 \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07", hh: "%d \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07", d: "1 \u0E27\u0E31\u0E19", dd: "%d \u0E27\u0E31\u0E19", M: "1 \u0E40\u0E14\u0E37\u0E2D\u0E19", MM: "%d \u0E40\u0E14\u0E37\u0E2D\u0E19", y: "1 \u0E1B\u0E35", yy: "%d \u0E1B\u0E35" }, ordinal: function(_2) {
|
|
320
|
+
return _2 + ".";
|
|
321
|
+
} };
|
|
322
|
+
return t.default.locale(d, null, true), d;
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// node_modules/dayjs/plugin/buddhistEra.js
|
|
328
|
+
var require_buddhistEra = __commonJS({
|
|
329
|
+
"node_modules/dayjs/plugin/buddhistEra.js"(exports, module) {
|
|
330
|
+
"use strict";
|
|
331
|
+
!(function(t, e) {
|
|
332
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_buddhistEra = e();
|
|
333
|
+
})(exports, (function() {
|
|
334
|
+
"use strict";
|
|
335
|
+
return function(t, e) {
|
|
336
|
+
var n = e.prototype, i = n.format;
|
|
337
|
+
n.format = function(t2) {
|
|
338
|
+
var e2 = this, n2 = (t2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g, (function(t3, n3) {
|
|
339
|
+
var i2, o = String(e2.$y + 543), f = "BB" === t3 ? [o.slice(-2), 2] : [o, 4];
|
|
340
|
+
return n3 || (i2 = e2.$utils()).s.apply(i2, f.concat(["0"]));
|
|
341
|
+
}));
|
|
342
|
+
return i.bind(this)(n2);
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
}));
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// src/Button/PrimaryButton/PrimaryButton.tsx
|
|
350
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
351
|
+
function PrimaryButton({
|
|
352
|
+
title,
|
|
353
|
+
onClick,
|
|
354
|
+
iconLeft,
|
|
355
|
+
iconRight,
|
|
356
|
+
bgColor = "bg-primary-500",
|
|
357
|
+
textColor = "black",
|
|
358
|
+
disabled
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsx(
|
|
361
|
+
"button",
|
|
362
|
+
{
|
|
363
|
+
onClick,
|
|
364
|
+
disabled,
|
|
365
|
+
className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] body-1 transition
|
|
366
|
+
${disabled ? "text-gray-400 bg-gray-100 cursor-not-allowed" : `${bgColor} text-${textColor} cursor-pointer
|
|
367
|
+
hover:brightness-95 active:brightness-90`}`,
|
|
368
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center items-center gap-[10px]", children: [
|
|
369
|
+
iconLeft && /* @__PURE__ */ jsx("div", { children: iconLeft }),
|
|
370
|
+
title,
|
|
371
|
+
iconRight && /* @__PURE__ */ jsx("div", { children: iconRight })
|
|
372
|
+
] })
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/Button/SecondaryButton/SecondaryButton.tsx
|
|
378
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
379
|
+
function SecondaryButton({ title, onClick, iconLeft, iconRight, disabled }) {
|
|
380
|
+
return /* @__PURE__ */ jsx2(
|
|
381
|
+
"button",
|
|
382
|
+
{
|
|
383
|
+
onClick,
|
|
384
|
+
disabled,
|
|
385
|
+
className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] border-[1px] body-1 transition ${disabled ? "text-gray-400 border-gray-400 bg-gray-100 cursor-not-allowed" : "cursor-pointer bg-white border-black text-black hover:bg-gray-100 active:bg-gray-200"}`,
|
|
386
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "flex justify-center items-center gap-[10px]", children: [
|
|
387
|
+
iconLeft && /* @__PURE__ */ jsx2("div", { children: iconLeft }),
|
|
388
|
+
title,
|
|
389
|
+
iconRight && /* @__PURE__ */ jsx2("div", { children: iconRight })
|
|
390
|
+
] })
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/Button/GhostButton/GhostButton.tsx
|
|
396
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
397
|
+
function GhostButton({ title, onClick, iconLeft, iconRight, disabled }) {
|
|
398
|
+
return /* @__PURE__ */ jsx3(
|
|
399
|
+
"button",
|
|
400
|
+
{
|
|
401
|
+
onClick,
|
|
402
|
+
disabled,
|
|
403
|
+
className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] body-1 transition
|
|
404
|
+
${disabled ? "text-gray-400 bg-gray-100 cursor-not-allowed" : "bg-[#E9E9E9] cursor-pointer hover:bg-[#d6d6d6] active:bg-[#c4c4c4]"}`,
|
|
405
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-center items-center gap-[10px]", children: [
|
|
406
|
+
iconLeft && /* @__PURE__ */ jsx3("div", { children: iconLeft }),
|
|
407
|
+
title,
|
|
408
|
+
iconRight && /* @__PURE__ */ jsx3("div", { children: iconRight })
|
|
409
|
+
] })
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/Button/TabSelectionButton/TabSelectionButton.tsx
|
|
415
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
416
|
+
var TabSelectionButton = ({ title, now, onClickGoto }) => {
|
|
417
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex subtitle-2", children: [
|
|
418
|
+
title.map((text) => /* @__PURE__ */ jsx4(
|
|
419
|
+
"button",
|
|
420
|
+
{
|
|
421
|
+
onClick: () => onClickGoto(text.path),
|
|
422
|
+
className: `text-nowrap px-2 cursor-pointer ${now === text.path ? "border-b-primary-700 text-primary-700 border-b-2" : "border-b-gray-200 border-b-2"}`,
|
|
423
|
+
children: text.name
|
|
424
|
+
}
|
|
425
|
+
)),
|
|
426
|
+
/* @__PURE__ */ jsx4("div", { className: "border-b-gray-200 border-b-2 w-full" })
|
|
427
|
+
] });
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
// src/Loader/Loader/Loader.tsx
|
|
431
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
432
|
+
function Loader({ size = 25, color = "#000000" }) {
|
|
433
|
+
return /* @__PURE__ */ jsx5(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
style: {
|
|
437
|
+
width: size,
|
|
438
|
+
height: size,
|
|
439
|
+
borderWidth: 4,
|
|
440
|
+
borderStyle: "solid",
|
|
441
|
+
borderColor: color,
|
|
442
|
+
borderTopColor: "transparent"
|
|
443
|
+
},
|
|
444
|
+
className: "rounded-full animate-spin"
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/Checkbox/Checkbox/Checkbox.tsx
|
|
450
|
+
import { IconCheck } from "@tabler/icons-react";
|
|
451
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
452
|
+
function Checkbox({ label, checked, onChange, disabled }) {
|
|
453
|
+
const handleClick = () => {
|
|
454
|
+
if (!disabled) {
|
|
455
|
+
onChange(!checked);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
return /* @__PURE__ */ jsxs5(
|
|
459
|
+
"div",
|
|
460
|
+
{
|
|
461
|
+
className: `flex gap-[10px] items-center
|
|
462
|
+
${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`,
|
|
463
|
+
"aria-disabled": disabled,
|
|
464
|
+
onClick: handleClick,
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ jsx6(
|
|
467
|
+
"div",
|
|
468
|
+
{
|
|
469
|
+
className: `flex justify-center items-center border-[1px] border-black w-[24px] h-[24px] rounded-[8px] transition-colors duration-100
|
|
470
|
+
${checked ? "bg-black text-white" : "bg-white text-black"}
|
|
471
|
+
${disabled ? "pointer-events-none" : ""}`,
|
|
472
|
+
children: /* @__PURE__ */ jsx6(
|
|
473
|
+
"span",
|
|
474
|
+
{
|
|
475
|
+
className: `flex justify-center items-center transition-transform duration-150
|
|
476
|
+
${checked ? "scale-100 opacity-100" : "scale-0 opacity-0"}`,
|
|
477
|
+
children: /* @__PURE__ */ jsx6(IconCheck, { size: 20 })
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
label && /* @__PURE__ */ jsx6("p", { className: "body-1 select-none", children: label })
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// src/Checkbox/CheckboxGroup/CheckboxGroup.tsx
|
|
489
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
490
|
+
function CheckboxGroup({ options, onChange, alignment = "vertical" }) {
|
|
491
|
+
return /* @__PURE__ */ jsx7("div", { className: `flex gap-4 ${alignment === "vertical" ? "flex-col" : ""}`, children: options.map((opt) => /* @__PURE__ */ jsx7(
|
|
492
|
+
Checkbox,
|
|
493
|
+
{
|
|
494
|
+
checked: opt.checked,
|
|
495
|
+
label: opt.label,
|
|
496
|
+
onChange: () => onChange(opt.label),
|
|
497
|
+
disabled: opt.disabled
|
|
498
|
+
},
|
|
499
|
+
opt.label
|
|
500
|
+
)) });
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// src/Radio/Radio/Radio.tsx
|
|
504
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
505
|
+
function Radio({ selected, onChange, disabled }) {
|
|
506
|
+
const handleClick = () => {
|
|
507
|
+
if (!disabled) {
|
|
508
|
+
onChange(!selected);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
return /* @__PURE__ */ jsx8(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
className: `
|
|
515
|
+
flex justify-center items-center w-[16px] h-[16px] border-[1px] border-black rounded-full
|
|
516
|
+
${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}
|
|
517
|
+
`,
|
|
518
|
+
onClick: handleClick,
|
|
519
|
+
"aria-disabled": disabled,
|
|
520
|
+
children: selected && /* @__PURE__ */ jsx8("div", { className: `bg-black w-[10px] h-[10px] rounded-full transition-all duration-300` })
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/Radio/RadioGroup/RadioGroup.tsx
|
|
526
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
527
|
+
function RadioGroup({ options, value, onChange, alignment = "horizontal" }) {
|
|
528
|
+
return /* @__PURE__ */ jsx9("div", { className: `flex gap-2 ${alignment === "vertical" ? "flex-col" : ""}`, children: options.map((opt) => /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
529
|
+
/* @__PURE__ */ jsx9(Radio, { selected: value === opt.value, onChange: () => onChange(opt.value), disabled: opt.disabled }),
|
|
530
|
+
/* @__PURE__ */ jsx9("span", { className: `body-1 ${opt.disabled ? "text-gray-400 cursor-not-allowed" : ""}`, children: opt.label })
|
|
531
|
+
] }, opt.value)) });
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// src/Switch/Switch/Switch.tsx
|
|
535
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
536
|
+
function Switch({ label, checked, onChange, disabled }) {
|
|
537
|
+
const handleClick = () => {
|
|
538
|
+
if (!disabled) {
|
|
539
|
+
onChange(!checked);
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-[10px]", children: [
|
|
543
|
+
label && /* @__PURE__ */ jsx10("p", { className: `body-1 ${disabled ? "opacity-50 select-none" : ""}`, children: label }),
|
|
544
|
+
/* @__PURE__ */ jsx10(
|
|
545
|
+
"button",
|
|
546
|
+
{
|
|
547
|
+
type: "button",
|
|
548
|
+
onClick: handleClick,
|
|
549
|
+
disabled,
|
|
550
|
+
"aria-disabled": disabled,
|
|
551
|
+
className: `
|
|
552
|
+
w-13 h-7 flex items-center rounded-full p-1 transition-colors duration-300
|
|
553
|
+
${checked ? "bg-blue-500" : "bg-gray-300"}
|
|
554
|
+
${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}
|
|
555
|
+
`,
|
|
556
|
+
children: /* @__PURE__ */ jsx10(
|
|
557
|
+
"div",
|
|
558
|
+
{
|
|
559
|
+
className: `bg-white w-5 h-5 rounded-full shadow-md transform transition-transform duration-300
|
|
560
|
+
${checked ? "translate-x-6" : "translate-x-0"}`
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
] });
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// src/Switch/SwitchSelect/SwitchSelect.tsx
|
|
569
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
570
|
+
function SwitchSelect({
|
|
571
|
+
option,
|
|
572
|
+
onClick,
|
|
573
|
+
value,
|
|
574
|
+
label,
|
|
575
|
+
required,
|
|
576
|
+
color
|
|
577
|
+
}) {
|
|
578
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col container-input", children: [
|
|
579
|
+
label && /* @__PURE__ */ jsxs8("p", { className: `body-1`, children: [
|
|
580
|
+
label,
|
|
581
|
+
" ",
|
|
582
|
+
required && /* @__PURE__ */ jsx11("span", { className: "text-red-500", children: "*" })
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsx11("div", { className: "flex", children: option.map((item, index) => /* @__PURE__ */ jsx11(
|
|
585
|
+
"button",
|
|
586
|
+
{
|
|
587
|
+
onClick: () => onClick(item.value),
|
|
588
|
+
className: `
|
|
589
|
+
body-1 border-y-1 border-primary-500 cursor-pointer h-[32px] px-2
|
|
590
|
+
${item.value === value ? `${color ? `bg-[${color}]` : `bg-primary-500`} text-white` : "bg-white text-primary-500"}
|
|
591
|
+
${index === 0 ? "border-l-1 rounded-l-lg" : index === option.length - 1 ? "border-r-1 rounded-r-lg" : "border-x-1"}
|
|
592
|
+
`,
|
|
593
|
+
children: item.label
|
|
594
|
+
},
|
|
595
|
+
item.value
|
|
596
|
+
)) })
|
|
597
|
+
] });
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// src/NavBar/MenuNavBar/MenuNavBar.tsx
|
|
601
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
602
|
+
function MenuNavBar({ menus, onClick }) {
|
|
603
|
+
return /* @__PURE__ */ jsx12("div", { className: "w-full h-full p-[10px] bg-white", children: menus?.map((menu, index) => /* @__PURE__ */ jsxs9("div", { className: `p-[10px] ${index !== 0 ? "mt-[10px]" : ""}`, children: [
|
|
604
|
+
/* @__PURE__ */ jsx12("p", { className: "p-[10px] w-[202px] h-[47px] subtitle-1", children: menu.title }),
|
|
605
|
+
menu?.subMenus.map((subMenu) => /* @__PURE__ */ jsxs9(
|
|
606
|
+
"div",
|
|
607
|
+
{
|
|
608
|
+
className: "group flex justify-center items-center gap-[10px] p-[10px] w-[202px] h-[47px] rounded-[6px] subtitle-2 cursor-pointer hover:bg-red-100 active:bg-primary-500 hover:text-white active:text-white",
|
|
609
|
+
onClick: () => onClick(subMenu.path),
|
|
610
|
+
children: [
|
|
611
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex justify-center items-center w-[24px] h-[24px] text-[20px]", children: [
|
|
612
|
+
subMenu.icon && /* @__PURE__ */ jsx12("span", { className: `block ${subMenu.iconActive ? "group-active:hidden" : ""}`, children: subMenu.icon }),
|
|
613
|
+
subMenu.iconActive && /* @__PURE__ */ jsx12("span", { className: "hidden group-active:block", children: subMenu.iconActive })
|
|
614
|
+
] }),
|
|
615
|
+
subMenu.title,
|
|
616
|
+
/* @__PURE__ */ jsx12("span", { className: "flex ml-auto", children: subMenu.customNode && subMenu.customNode })
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
`sub_${subMenu.title}`
|
|
620
|
+
))
|
|
621
|
+
] }, `menu_${menu.title}`)) });
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// src/NavBar/MenuNavBar/Sidebar.tsx
|
|
625
|
+
import { IconChevronLeftPipe, IconChevronRightPipe } from "@tabler/icons-react";
|
|
626
|
+
import { createContext, useContext, useState } from "react";
|
|
627
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
628
|
+
var SidebarContext = createContext({ expanded: false });
|
|
629
|
+
function Sidebar({ children, logo }) {
|
|
630
|
+
const [expanded, setExpanded] = useState(true);
|
|
631
|
+
return /* @__PURE__ */ jsx13("aside", { className: "h-screen", children: /* @__PURE__ */ jsxs10("nav", { className: `h-full flex flex-col bg-white border-r shadow-sm duration-150 ${expanded ? "w-64" : "w-16"}`, children: [
|
|
632
|
+
/* @__PURE__ */ jsxs10("div", { className: "p-4 pb-2 flex justify-center items-center", children: [
|
|
633
|
+
expanded && logo && /* @__PURE__ */ jsx13("img", { src: logo, width: 120, className: "ml-auto" }),
|
|
634
|
+
/* @__PURE__ */ jsx13(
|
|
635
|
+
"button",
|
|
636
|
+
{
|
|
637
|
+
className: "p-1.5 rounded-lg bg-gray-50 hover:bg-gray-100 cursor-pointer ml-auto",
|
|
638
|
+
onClick: () => setExpanded((curr) => !curr),
|
|
639
|
+
children: expanded ? /* @__PURE__ */ jsx13(IconChevronLeftPipe, {}) : /* @__PURE__ */ jsx13(IconChevronRightPipe, {})
|
|
640
|
+
}
|
|
641
|
+
)
|
|
642
|
+
] }),
|
|
643
|
+
/* @__PURE__ */ jsx13(SidebarContext.Provider, { value: { expanded }, children: /* @__PURE__ */ jsx13("ul", { className: "flex-1 px-3", children }) })
|
|
644
|
+
] }) });
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// src/NavBar/TopNavBar/TopNavBar.tsx
|
|
648
|
+
import { IconBellRinging } from "@tabler/icons-react";
|
|
649
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
650
|
+
function TopNavBar({ onClickNoti, logo }) {
|
|
651
|
+
return /* @__PURE__ */ jsxs11("div", { className: "w-full h-full flex", children: [
|
|
652
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-[20px] p-[10px]", children: [
|
|
653
|
+
logo,
|
|
654
|
+
/* @__PURE__ */ jsx14("p", { className: "subtitle-1", children: "Project Management" })
|
|
655
|
+
] }),
|
|
656
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center ml-auto gap-[20px] p-[10px]", children: [
|
|
657
|
+
/* @__PURE__ */ jsx14("div", { children: "Search" }),
|
|
658
|
+
/* @__PURE__ */ jsx14("div", { children: /* @__PURE__ */ jsx14(IconBellRinging, { onClick: onClickNoti, className: "cursor-pointer" }) }),
|
|
659
|
+
/* @__PURE__ */ jsx14("div", { className: "w-[40px] h-[40px] bg-gray-400 rounded-full cursor-pointer" })
|
|
660
|
+
] })
|
|
661
|
+
] });
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/Table/DataTable/DataTable.tsx
|
|
665
|
+
import { IconSelector, IconSortAscending, IconSortDescending } from "@tabler/icons-react";
|
|
666
|
+
import { useState as useState2 } from "react";
|
|
667
|
+
|
|
668
|
+
// src/Table/Pagination/Pagination.tsx
|
|
669
|
+
import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
|
|
670
|
+
import { useMemo } from "react";
|
|
671
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
672
|
+
function Pagination({ totalItems, itemsPerPage, currentPage, onPageChange }) {
|
|
673
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
674
|
+
const getPages = useMemo(() => {
|
|
675
|
+
if (totalPages <= 7) {
|
|
676
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
677
|
+
}
|
|
678
|
+
const pages = [];
|
|
679
|
+
pages.push(1);
|
|
680
|
+
if (currentPage > 3) {
|
|
681
|
+
pages.push("...");
|
|
682
|
+
}
|
|
683
|
+
const start = Math.max(2, currentPage - 1);
|
|
684
|
+
const end = Math.min(totalPages - 1, currentPage + 1);
|
|
685
|
+
for (let i = start; i <= end; i++) {
|
|
686
|
+
pages.push(i);
|
|
687
|
+
}
|
|
688
|
+
if (currentPage < totalPages - 2) {
|
|
689
|
+
pages.push("...");
|
|
690
|
+
}
|
|
691
|
+
pages.push(totalPages);
|
|
692
|
+
return pages;
|
|
693
|
+
}, [totalPages, currentPage]);
|
|
694
|
+
if (totalPages <= 1) return null;
|
|
695
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-center gap-2 mt-4 body-1", children: [
|
|
696
|
+
/* @__PURE__ */ jsxs12(
|
|
697
|
+
"button",
|
|
698
|
+
{
|
|
699
|
+
className: "px-3 py-1 disabled:opacity-50 flex gap-[8px] cursor-pointer",
|
|
700
|
+
disabled: currentPage === 1,
|
|
701
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
702
|
+
children: [
|
|
703
|
+
/* @__PURE__ */ jsx15(IconArrowLeft, {}),
|
|
704
|
+
"\u0E22\u0E49\u0E2D\u0E19\u0E01\u0E25\u0E31\u0E1A"
|
|
705
|
+
]
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
getPages.map(
|
|
709
|
+
(page, i) => typeof page === "string" ? /* @__PURE__ */ jsx15("span", { className: "px-2", children: page }, i) : /* @__PURE__ */ jsx15(
|
|
710
|
+
"button",
|
|
711
|
+
{
|
|
712
|
+
className: `w-[32px] h-[32px] rounded-[8px] px-3 py-1 cursor-pointer
|
|
713
|
+
${currentPage === page ? "bg-black text-white" : "hover:bg-gray-100"}`,
|
|
714
|
+
onClick: () => onPageChange(page),
|
|
715
|
+
children: page
|
|
716
|
+
},
|
|
717
|
+
i
|
|
718
|
+
)
|
|
719
|
+
),
|
|
720
|
+
/* @__PURE__ */ jsxs12(
|
|
721
|
+
"button",
|
|
722
|
+
{
|
|
723
|
+
className: "px-3 py-1 disabled:opacity-50 flex gap-[8px] cursor-pointer",
|
|
724
|
+
disabled: currentPage === totalPages,
|
|
725
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
726
|
+
children: [
|
|
727
|
+
"\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
728
|
+
/* @__PURE__ */ jsx15(IconArrowRight, {})
|
|
729
|
+
]
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] });
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// src/Table/DataTable/DataTable.tsx
|
|
736
|
+
import { Fragment, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
737
|
+
function DataTable({ columns, data, onSort, isLoading }) {
|
|
738
|
+
const cols = Math.max(1, columns.length);
|
|
739
|
+
const gridClass = "grid [grid-template-columns:repeat(var(--cols),minmax(0,1fr))]";
|
|
740
|
+
const [sortConfig, setSortConfig] = useState2(null);
|
|
741
|
+
const [page, setPage] = useState2(1);
|
|
742
|
+
const onSorting = (config) => {
|
|
743
|
+
if (config) {
|
|
744
|
+
setSortConfig({ key: config?.key, direction: config?.direction });
|
|
745
|
+
onSort();
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
return /* @__PURE__ */ jsxs13("div", { className: "border rounded-md w-full h-full", children: [
|
|
749
|
+
/* @__PURE__ */ jsx16("div", { className: `${gridClass} font-semibold border-b border-gray-200`, style: { ["--cols"]: cols }, children: columns.map((col, i) => {
|
|
750
|
+
const isActive = sortConfig?.key === col.accessor;
|
|
751
|
+
const direction = isActive ? sortConfig?.direction : null;
|
|
752
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-[8px] py-[8px] px-[16px] body-4 truncate", children: [
|
|
753
|
+
col.header,
|
|
754
|
+
col.sortable && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
755
|
+
direction === null && /* @__PURE__ */ jsx16(
|
|
756
|
+
IconSelector,
|
|
757
|
+
{
|
|
758
|
+
size: 15,
|
|
759
|
+
className: "hover:text-red-400 cursor-pointer",
|
|
760
|
+
onClick: () => onSorting({ key: col.accessor, direction: "asc" })
|
|
761
|
+
}
|
|
762
|
+
),
|
|
763
|
+
direction === "asc" && /* @__PURE__ */ jsx16(
|
|
764
|
+
IconSortAscending,
|
|
765
|
+
{
|
|
766
|
+
size: 15,
|
|
767
|
+
className: "cursor-pointer text-red-500",
|
|
768
|
+
onClick: () => onSorting({ key: col.accessor, direction: "desc" })
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
direction === "desc" && /* @__PURE__ */ jsx16(
|
|
772
|
+
IconSortDescending,
|
|
773
|
+
{
|
|
774
|
+
size: 15,
|
|
775
|
+
className: "cursor-pointer text-red-500",
|
|
776
|
+
onClick: () => onSorting({ key: col.accessor, direction: null })
|
|
777
|
+
}
|
|
778
|
+
)
|
|
779
|
+
] })
|
|
780
|
+
] }, i);
|
|
781
|
+
}) }),
|
|
782
|
+
isLoading ? /* @__PURE__ */ jsx16("div", { className: "flex justify-center items-center w-full h-full", children: /* @__PURE__ */ jsx16(Loader, {}) }) : /* @__PURE__ */ jsx16(Fragment, { children: data.map((row, i) => /* @__PURE__ */ jsx16(
|
|
783
|
+
"div",
|
|
784
|
+
{
|
|
785
|
+
className: `${gridClass} ${data.length - 1 !== i ? "border-b border-gray-200" : ""} items-center`,
|
|
786
|
+
style: { ["--cols"]: cols },
|
|
787
|
+
children: columns.map((col, c) => /* @__PURE__ */ jsx16("div", { className: "py-[8px] px-[16px] body-3 truncate", children: typeof col.accessor === "function" ? col.accessor(row) : String(row[col.accessor]) }, c))
|
|
788
|
+
},
|
|
789
|
+
i
|
|
790
|
+
)) }),
|
|
791
|
+
/* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16(Pagination, { currentPage: page, itemsPerPage: 5, totalItems: 10, onPageChange: setPage }) })
|
|
792
|
+
] });
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// src/Table/DataTable/AntDataTable.tsx
|
|
796
|
+
import { ConfigProvider, Table } from "antd";
|
|
797
|
+
import { useState as useState3 } from "react";
|
|
798
|
+
import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
|
|
799
|
+
function AntDataTable({
|
|
800
|
+
dataSource,
|
|
801
|
+
columns,
|
|
802
|
+
pageSize = 10,
|
|
803
|
+
rowCheckbox,
|
|
804
|
+
onRowSelect,
|
|
805
|
+
// onFilteredDataChange,
|
|
806
|
+
onFilter,
|
|
807
|
+
onChange,
|
|
808
|
+
width,
|
|
809
|
+
height,
|
|
810
|
+
pagination
|
|
811
|
+
}) {
|
|
812
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState3([]);
|
|
813
|
+
const rowSelection = {
|
|
814
|
+
selectedRowKeys,
|
|
815
|
+
onChange: (newSelectedRowKeys) => {
|
|
816
|
+
setSelectedRowKeys(newSelectedRowKeys);
|
|
817
|
+
onRowSelect && onRowSelect(newSelectedRowKeys);
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
const handleChange = (paginationArgs, filters, sorter, extra) => {
|
|
821
|
+
onChange?.(paginationArgs, filters, sorter, extra);
|
|
822
|
+
onFilter(filters);
|
|
823
|
+
};
|
|
824
|
+
return /* @__PURE__ */ jsx17(Fragment2, { children: /* @__PURE__ */ jsx17(
|
|
825
|
+
ConfigProvider,
|
|
826
|
+
{
|
|
827
|
+
theme: {
|
|
828
|
+
components: {},
|
|
829
|
+
token: {
|
|
830
|
+
fontFamily: "Kanit",
|
|
831
|
+
fontSize: 14
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
children: /* @__PURE__ */ jsx17(
|
|
835
|
+
Table,
|
|
836
|
+
{
|
|
837
|
+
dataSource,
|
|
838
|
+
columns,
|
|
839
|
+
rowSelection: rowCheckbox ? rowSelection : void 0,
|
|
840
|
+
onChange: handleChange,
|
|
841
|
+
pagination: pagination ? { position: ["bottomCenter"], pageSize } : false,
|
|
842
|
+
style: { width },
|
|
843
|
+
scroll: { y: height }
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
}
|
|
847
|
+
) });
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// src/Calendar/Calendar/Calendar.tsx
|
|
851
|
+
import { useEffect, useRef, useState as useState4 } from "react";
|
|
852
|
+
import FullCalendar from "@fullcalendar/react";
|
|
853
|
+
import dayGridPlugin from "@fullcalendar/daygrid";
|
|
854
|
+
import timeGridPlugin from "@fullcalendar/timegrid";
|
|
855
|
+
import interactionPlugin from "@fullcalendar/interaction";
|
|
856
|
+
import thLocale from "@fullcalendar/core/locales/th";
|
|
857
|
+
import { IconChevronLeft, IconChevronRight, IconX } from "@tabler/icons-react";
|
|
858
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
859
|
+
function Calendar({ events }) {
|
|
860
|
+
const calendarRef = useRef(null);
|
|
861
|
+
const [monthTitle, setMonthTitle] = useState4("");
|
|
862
|
+
const [openPopup, setOpenPopup] = useState4(false);
|
|
863
|
+
const [selectedEvent, setSelectedEvent] = useState4(null);
|
|
864
|
+
const updateTitle = () => {
|
|
865
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
866
|
+
if (calendarApi) {
|
|
867
|
+
setMonthTitle(calendarApi.view.title);
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
const changeView = (viewName) => {
|
|
871
|
+
const calendarApi = calendarRef.current?.getApi();
|
|
872
|
+
calendarApi?.changeView(viewName);
|
|
873
|
+
};
|
|
874
|
+
useEffect(() => {
|
|
875
|
+
updateTitle();
|
|
876
|
+
}, []);
|
|
877
|
+
return /* @__PURE__ */ jsxs14("div", { className: "fc w-full h-full relative z-10", children: [
|
|
878
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex mb-[8px]", children: [
|
|
879
|
+
/* @__PURE__ */ jsx18("p", { className: "headline-5", children: monthTitle }),
|
|
880
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-[10px] ml-auto", children: [
|
|
881
|
+
/* @__PURE__ */ jsx18(
|
|
882
|
+
"p",
|
|
883
|
+
{
|
|
884
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
885
|
+
onClick: () => {
|
|
886
|
+
calendarRef.current.getApi().today();
|
|
887
|
+
updateTitle();
|
|
888
|
+
},
|
|
889
|
+
children: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49"
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
/* @__PURE__ */ jsx18(
|
|
893
|
+
"p",
|
|
894
|
+
{
|
|
895
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
896
|
+
onClick: () => {
|
|
897
|
+
changeView("dayGridMonth");
|
|
898
|
+
updateTitle();
|
|
899
|
+
},
|
|
900
|
+
children: "Month"
|
|
901
|
+
}
|
|
902
|
+
),
|
|
903
|
+
/* @__PURE__ */ jsx18(
|
|
904
|
+
"p",
|
|
905
|
+
{
|
|
906
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
907
|
+
onClick: () => {
|
|
908
|
+
changeView("timeGridWeek");
|
|
909
|
+
updateTitle();
|
|
910
|
+
},
|
|
911
|
+
children: "Week"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ jsx18(
|
|
915
|
+
"p",
|
|
916
|
+
{
|
|
917
|
+
className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
|
|
918
|
+
onClick: () => {
|
|
919
|
+
changeView("timeGridDay");
|
|
920
|
+
updateTitle();
|
|
921
|
+
},
|
|
922
|
+
children: "Day"
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ jsx18(
|
|
926
|
+
"button",
|
|
927
|
+
{
|
|
928
|
+
className: "cursor-pointer",
|
|
929
|
+
onClick: () => {
|
|
930
|
+
calendarRef.current?.getApi().prev();
|
|
931
|
+
updateTitle();
|
|
932
|
+
},
|
|
933
|
+
children: /* @__PURE__ */ jsx18(IconChevronLeft, {})
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
/* @__PURE__ */ jsx18(
|
|
937
|
+
"button",
|
|
938
|
+
{
|
|
939
|
+
className: "cursor-pointer",
|
|
940
|
+
onClick: () => {
|
|
941
|
+
calendarRef.current?.getApi().next();
|
|
942
|
+
updateTitle();
|
|
943
|
+
},
|
|
944
|
+
children: /* @__PURE__ */ jsx18(IconChevronRight, {})
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
] })
|
|
948
|
+
] }),
|
|
949
|
+
/* @__PURE__ */ jsx18("div", { className: "relative z-10", children: /* @__PURE__ */ jsx18(
|
|
950
|
+
FullCalendar,
|
|
951
|
+
{
|
|
952
|
+
ref: calendarRef,
|
|
953
|
+
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
|
|
954
|
+
events,
|
|
955
|
+
locale: thLocale,
|
|
956
|
+
slotLabelFormat: {
|
|
957
|
+
hour: "numeric",
|
|
958
|
+
minute: "2-digit"
|
|
959
|
+
},
|
|
960
|
+
firstDay: 0,
|
|
961
|
+
fixedWeekCount: false,
|
|
962
|
+
headerToolbar: false,
|
|
963
|
+
initialView: "dayGridMonth",
|
|
964
|
+
dayMaxEventRows: 4,
|
|
965
|
+
editable: true,
|
|
966
|
+
eventDrop: (info) => {
|
|
967
|
+
console.log("Event \u0E02\u0E2D\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48:", info.event.startStr);
|
|
968
|
+
},
|
|
969
|
+
eventClick: (info) => {
|
|
970
|
+
setOpenPopup(true);
|
|
971
|
+
setSelectedEvent({
|
|
972
|
+
title: info.event.title,
|
|
973
|
+
start: info.event._instance?.range.start.toISOString(),
|
|
974
|
+
end: info.event._instance?.range.end.toISOString()
|
|
975
|
+
});
|
|
976
|
+
},
|
|
977
|
+
eventContent: (arg) => {
|
|
978
|
+
return /* @__PURE__ */ jsx18(Fragment3, { children: /* @__PURE__ */ jsx18("div", { className: "flex items-center h-[28px] p-[4px] border-green-500 border-l-[10px] bg-red-400 rounded text-left text-white caption-1", children: arg.event.title }) });
|
|
979
|
+
},
|
|
980
|
+
moreLinkContent: (arg) => `+${arg.num} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23`
|
|
981
|
+
}
|
|
982
|
+
) }),
|
|
983
|
+
openPopup && /* @__PURE__ */ jsx18("div", { className: "fixed inset-0 flex justify-center items-center bg-black/50 z-50", children: /* @__PURE__ */ jsx18(EventPopUp, { event: selectedEvent, onClose: () => setOpenPopup(false) }) })
|
|
984
|
+
] });
|
|
985
|
+
}
|
|
986
|
+
function EventPopUp({ event, onClose }) {
|
|
987
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w-[500px] h-auto rounded-2xl bg-white relative z-50 shadow-2xl overflow-hidden", children: [
|
|
988
|
+
/* @__PURE__ */ jsx18("button", { className: "absolute top-3 right-3 rounded-full p-1 hover:bg-gray-200 transition", onClick: onClose, children: /* @__PURE__ */ jsx18(IconX, { className: "w-6 h-6 text-gray-600" }) }),
|
|
989
|
+
/* @__PURE__ */ jsx18("div", { className: "bg-red-400 text-left text-white px-6 py-4 headline-5", children: /* @__PURE__ */ jsx18("h2", { className: "text-lg font-semibold", children: event.title }) }),
|
|
990
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col w-full p-6 gap-3 text-gray-700 body-3", children: [
|
|
991
|
+
/* @__PURE__ */ jsxs14("p", { children: [
|
|
992
|
+
/* @__PURE__ */ jsx18("span", { className: "font-medium", children: "\u0E40\u0E23\u0E34\u0E48\u0E21: " }),
|
|
993
|
+
event?.start?.toLocaleString?.() || String(event?.start)
|
|
994
|
+
] }),
|
|
995
|
+
/* @__PURE__ */ jsxs14("p", { children: [
|
|
996
|
+
/* @__PURE__ */ jsx18("span", { className: "font-medium", children: "\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14: " }),
|
|
997
|
+
event?.end?.toLocaleString?.() || String(event?.end)
|
|
998
|
+
] }),
|
|
999
|
+
/* @__PURE__ */ jsx18("h3", { className: "text-sm font-semibold text-gray-500 uppercase mb-2 hover:underline cursor-pointer", children: "\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21" })
|
|
1000
|
+
] })
|
|
1001
|
+
] });
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// src/Input/TextInput/TextInput.tsx
|
|
1005
|
+
import { IconEye, IconEyeOff } from "@tabler/icons-react";
|
|
1006
|
+
import { useState as useState5 } from "react";
|
|
1007
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1008
|
+
function TextInput({
|
|
1009
|
+
label,
|
|
1010
|
+
placeholder,
|
|
1011
|
+
type = "text",
|
|
1012
|
+
maxLength,
|
|
1013
|
+
required,
|
|
1014
|
+
error,
|
|
1015
|
+
value,
|
|
1016
|
+
onChange,
|
|
1017
|
+
disabled
|
|
1018
|
+
}) {
|
|
1019
|
+
const [showPassword, setShowPassword] = useState5(false);
|
|
1020
|
+
const onShowPassword = () => {
|
|
1021
|
+
setShowPassword(!showPassword);
|
|
1022
|
+
};
|
|
1023
|
+
const inputType = type === "password" ? showPassword ? "text" : "password" : "text";
|
|
1024
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
1025
|
+
label && /* @__PURE__ */ jsxs15("p", { className: "body-1 mb-[8px]", children: [
|
|
1026
|
+
label,
|
|
1027
|
+
required && /* @__PURE__ */ jsx19("span", { className: "text-red-500", children: "\xA0*" })
|
|
1028
|
+
] }),
|
|
1029
|
+
/* @__PURE__ */ jsxs15(
|
|
1030
|
+
"div",
|
|
1031
|
+
{
|
|
1032
|
+
className: `border-[1px] rounded-[8px] w-full h-[40px] flex justify-center items-center
|
|
1033
|
+
${disabled ? "bg-gray-100 text-gray-400" : error ? "border-red-500" : ""}`,
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ jsx19(
|
|
1036
|
+
"input",
|
|
1037
|
+
{
|
|
1038
|
+
className: `w-full h-full px-[16px] ${disabled ? "cursor-not-allowed" : ""}`,
|
|
1039
|
+
style: { outline: "none" },
|
|
1040
|
+
placeholder,
|
|
1041
|
+
type: inputType,
|
|
1042
|
+
maxLength,
|
|
1043
|
+
value,
|
|
1044
|
+
onChange: (e) => onChange(e.target.value),
|
|
1045
|
+
disabled
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
type === "password" && (showPassword ? /* @__PURE__ */ jsx19(IconEye, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }) : /* @__PURE__ */ jsx19(IconEyeOff, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }))
|
|
1049
|
+
]
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
error && /* @__PURE__ */ jsx19("p", { className: "text-red-500 body-1", children: error })
|
|
1053
|
+
] });
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// src/Input/TextArea/TextArea.tsx
|
|
1057
|
+
import { ConfigProvider as ConfigProvider2, Input } from "antd";
|
|
1058
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1059
|
+
var { TextArea } = Input;
|
|
1060
|
+
function TextAreaInput({
|
|
1061
|
+
label,
|
|
1062
|
+
height = 4,
|
|
1063
|
+
placeholder,
|
|
1064
|
+
onChange,
|
|
1065
|
+
value,
|
|
1066
|
+
maxLength,
|
|
1067
|
+
resizable,
|
|
1068
|
+
showCount,
|
|
1069
|
+
required,
|
|
1070
|
+
error,
|
|
1071
|
+
disabled
|
|
1072
|
+
}) {
|
|
1073
|
+
return /* @__PURE__ */ jsx20(Fragment4, { children: /* @__PURE__ */ jsx20(
|
|
1074
|
+
ConfigProvider2,
|
|
1075
|
+
{
|
|
1076
|
+
theme: {
|
|
1077
|
+
components: {},
|
|
1078
|
+
token: {
|
|
1079
|
+
fontFamily: "Kanit",
|
|
1080
|
+
fontSize: 16
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
children: /* @__PURE__ */ jsxs16("div", { children: [
|
|
1084
|
+
label && /* @__PURE__ */ jsxs16("p", { className: "body-1 mb-[8px]", children: [
|
|
1085
|
+
label,
|
|
1086
|
+
" ",
|
|
1087
|
+
required && /* @__PURE__ */ jsx20("span", { className: "text-red-500", children: "\xA0*" })
|
|
1088
|
+
] }),
|
|
1089
|
+
/* @__PURE__ */ jsx20(
|
|
1090
|
+
TextArea,
|
|
1091
|
+
{
|
|
1092
|
+
value,
|
|
1093
|
+
rows: height,
|
|
1094
|
+
style: {
|
|
1095
|
+
...error && resizable ? { borderColor: "red" } : {},
|
|
1096
|
+
...disabled || !resizable ? { resize: "none" } : {}
|
|
1097
|
+
},
|
|
1098
|
+
placeholder,
|
|
1099
|
+
maxLength,
|
|
1100
|
+
showCount,
|
|
1101
|
+
onChange: (e) => onChange(e.target.value),
|
|
1102
|
+
disabled
|
|
1103
|
+
}
|
|
1104
|
+
),
|
|
1105
|
+
error && /* @__PURE__ */ jsx20("p", { className: "text-red-500 body-1", children: error })
|
|
1106
|
+
] })
|
|
1107
|
+
}
|
|
1108
|
+
) });
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// src/Input/InputField/InputField.tsx
|
|
1112
|
+
import { ConfigProvider as ConfigProvider3, Input as Input2, Space } from "antd";
|
|
1113
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1114
|
+
function InputField({
|
|
1115
|
+
value,
|
|
1116
|
+
onChange,
|
|
1117
|
+
placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
1118
|
+
label,
|
|
1119
|
+
required,
|
|
1120
|
+
disabled,
|
|
1121
|
+
error,
|
|
1122
|
+
addonBefore,
|
|
1123
|
+
addonAfter,
|
|
1124
|
+
defaultValue,
|
|
1125
|
+
className,
|
|
1126
|
+
onClear,
|
|
1127
|
+
statickey
|
|
1128
|
+
}) {
|
|
1129
|
+
return /* @__PURE__ */ jsx21(
|
|
1130
|
+
ConfigProvider3,
|
|
1131
|
+
{
|
|
1132
|
+
theme: {
|
|
1133
|
+
token: {
|
|
1134
|
+
fontFamily: "Kanit"
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "container-input", children: [
|
|
1138
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
1139
|
+
/* @__PURE__ */ jsx21("span", { className: "body-1", children: label }),
|
|
1140
|
+
" ",
|
|
1141
|
+
required && /* @__PURE__ */ jsx21("span", { className: "text-red-500", children: "*" })
|
|
1142
|
+
] }),
|
|
1143
|
+
/* @__PURE__ */ jsxs17(Space.Compact, { children: [
|
|
1144
|
+
statickey && /* @__PURE__ */ jsx21("span", { className: "items-center flex px-2 bg-gray-300 rounded-l-md body-1", children: statickey }),
|
|
1145
|
+
/* @__PURE__ */ jsx21(
|
|
1146
|
+
Input2,
|
|
1147
|
+
{
|
|
1148
|
+
value,
|
|
1149
|
+
placeholder,
|
|
1150
|
+
disabled,
|
|
1151
|
+
className: `body-1 w-full ${className ?? ""}`,
|
|
1152
|
+
onChange: (e) => onChange(e.target.value || void 0),
|
|
1153
|
+
allowClear: true,
|
|
1154
|
+
addonBefore,
|
|
1155
|
+
addonAfter,
|
|
1156
|
+
defaultValue,
|
|
1157
|
+
onClear
|
|
1158
|
+
}
|
|
1159
|
+
)
|
|
1160
|
+
] }),
|
|
1161
|
+
error && /* @__PURE__ */ jsx21("p", { className: "text-red-500 caption-1", children: error })
|
|
1162
|
+
] })
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// src/Input/InputFieldNumber/InputFieldNumber.tsx
|
|
1168
|
+
import { ConfigProvider as ConfigProvider4, InputNumber } from "antd";
|
|
1169
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1170
|
+
function InputFieldNumber({
|
|
1171
|
+
value,
|
|
1172
|
+
onChange,
|
|
1173
|
+
placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
1174
|
+
label,
|
|
1175
|
+
required,
|
|
1176
|
+
disabled,
|
|
1177
|
+
error,
|
|
1178
|
+
addonBefore,
|
|
1179
|
+
addonAfter,
|
|
1180
|
+
defaultValue,
|
|
1181
|
+
className,
|
|
1182
|
+
max,
|
|
1183
|
+
min,
|
|
1184
|
+
controls,
|
|
1185
|
+
size,
|
|
1186
|
+
changeOnWheel,
|
|
1187
|
+
formatter,
|
|
1188
|
+
parser
|
|
1189
|
+
}) {
|
|
1190
|
+
return /* @__PURE__ */ jsx22(
|
|
1191
|
+
ConfigProvider4,
|
|
1192
|
+
{
|
|
1193
|
+
theme: {
|
|
1194
|
+
token: {
|
|
1195
|
+
fontFamily: "Kanit"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "container-input", children: [
|
|
1199
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
1200
|
+
/* @__PURE__ */ jsx22("span", { className: "body-1", children: label }),
|
|
1201
|
+
" ",
|
|
1202
|
+
required && /* @__PURE__ */ jsx22("span", { className: "text-red-500", children: "*" })
|
|
1203
|
+
] }),
|
|
1204
|
+
/* @__PURE__ */ jsx22(
|
|
1205
|
+
InputNumber,
|
|
1206
|
+
{
|
|
1207
|
+
value: value ?? void 0,
|
|
1208
|
+
onChange: (val) => onChange(val),
|
|
1209
|
+
placeholder,
|
|
1210
|
+
disabled,
|
|
1211
|
+
className: `body-1 !w-full ${className ?? ""}`,
|
|
1212
|
+
addonBefore,
|
|
1213
|
+
addonAfter,
|
|
1214
|
+
defaultValue,
|
|
1215
|
+
max,
|
|
1216
|
+
min,
|
|
1217
|
+
controls,
|
|
1218
|
+
size,
|
|
1219
|
+
changeOnWheel,
|
|
1220
|
+
formatter,
|
|
1221
|
+
parser
|
|
1222
|
+
}
|
|
1223
|
+
),
|
|
1224
|
+
error && /* @__PURE__ */ jsx22("p", { className: "text-red-500 caption-1", children: error })
|
|
1225
|
+
] })
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
// src/DatePicker/DatePickerBasic/DatePickerBasic.tsx
|
|
1231
|
+
var import_dayjs = __toESM(require_dayjs_min());
|
|
1232
|
+
var import_th2 = __toESM(require_th());
|
|
1233
|
+
var import_buddhistEra = __toESM(require_buddhistEra());
|
|
1234
|
+
import { ConfigProvider as ConfigProvider5, DatePicker } from "antd";
|
|
1235
|
+
import th from "antd/es/date-picker/locale/th_TH.js";
|
|
1236
|
+
import thTH from "antd/locale/th_TH.js";
|
|
1237
|
+
import { th as thFns } from "date-fns/locale";
|
|
1238
|
+
import { format } from "date-fns";
|
|
1239
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1240
|
+
import_dayjs.default.extend(import_buddhistEra.default);
|
|
1241
|
+
function DatePickerBasic({
|
|
1242
|
+
value,
|
|
1243
|
+
onChange,
|
|
1244
|
+
required,
|
|
1245
|
+
label,
|
|
1246
|
+
error,
|
|
1247
|
+
placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
1248
|
+
disabled,
|
|
1249
|
+
defaultValue,
|
|
1250
|
+
minDate,
|
|
1251
|
+
maxDate,
|
|
1252
|
+
disabledDate,
|
|
1253
|
+
className,
|
|
1254
|
+
size
|
|
1255
|
+
}) {
|
|
1256
|
+
const dateFormat = "DD/MM/YYYY";
|
|
1257
|
+
import_dayjs.default.locale("th_TH");
|
|
1258
|
+
const buddhistLocale = {
|
|
1259
|
+
...th,
|
|
1260
|
+
lang: {
|
|
1261
|
+
...th.lang,
|
|
1262
|
+
fieldDateFormat: "BBBB-MM-DD",
|
|
1263
|
+
fieldDateTimeFormat: "BBBB-MM-DD HH:mm:ss",
|
|
1264
|
+
yearFormat: "BBBB",
|
|
1265
|
+
cellYearFormat: "BBBB"
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
return /* @__PURE__ */ jsx23(
|
|
1269
|
+
ConfigProvider5,
|
|
1270
|
+
{
|
|
1271
|
+
locale: thTH,
|
|
1272
|
+
theme: {
|
|
1273
|
+
token: {
|
|
1274
|
+
fontFamily: "Kanit",
|
|
1275
|
+
fontSize: 16
|
|
1276
|
+
}
|
|
1277
|
+
},
|
|
1278
|
+
children: /* @__PURE__ */ jsxs19("div", { className: "container-input", children: [
|
|
1279
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
1280
|
+
/* @__PURE__ */ jsx23("span", { className: "body-1", children: label }),
|
|
1281
|
+
" ",
|
|
1282
|
+
required && /* @__PURE__ */ jsx23("span", { className: "text-red-500", children: "*" })
|
|
1283
|
+
] }),
|
|
1284
|
+
/* @__PURE__ */ jsx23(
|
|
1285
|
+
DatePicker,
|
|
1286
|
+
{
|
|
1287
|
+
className: `body-1 w-full ${className ?? ""}`,
|
|
1288
|
+
value,
|
|
1289
|
+
placeholder,
|
|
1290
|
+
onChange,
|
|
1291
|
+
allowClear: true,
|
|
1292
|
+
disabled,
|
|
1293
|
+
format: (date) => date ? format(date.toDate(), "dd/MM/yyyy", { locale: thFns }).replace(
|
|
1294
|
+
/\d{4}$/,
|
|
1295
|
+
(y) => String(parseInt(y) + 543)
|
|
1296
|
+
) : "",
|
|
1297
|
+
defaultValue,
|
|
1298
|
+
disabledDate: (d) => disabledDate ? disabledDate(d.toDate()) : false,
|
|
1299
|
+
minDate: minDate ? (0, import_dayjs.default)(minDate) : void 0,
|
|
1300
|
+
maxDate: maxDate ? (0, import_dayjs.default)(maxDate) : void 0,
|
|
1301
|
+
size,
|
|
1302
|
+
locale: buddhistLocale
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
error && /* @__PURE__ */ jsx23("p", { className: "text-red-500 caption-1", children: error })
|
|
1306
|
+
] })
|
|
1307
|
+
}
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/ColorPicker/ColorPickerBasic/ColorPicker.tsx
|
|
1312
|
+
import { ConfigProvider as ConfigProvider6, ColorPicker } from "antd";
|
|
1313
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1314
|
+
function ColorPickerBasic({
|
|
1315
|
+
value,
|
|
1316
|
+
onChange,
|
|
1317
|
+
required,
|
|
1318
|
+
label,
|
|
1319
|
+
error,
|
|
1320
|
+
disabled,
|
|
1321
|
+
allowClear,
|
|
1322
|
+
defaultFormat,
|
|
1323
|
+
className,
|
|
1324
|
+
placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35"
|
|
1325
|
+
}) {
|
|
1326
|
+
return /* @__PURE__ */ jsx24(
|
|
1327
|
+
ConfigProvider6,
|
|
1328
|
+
{
|
|
1329
|
+
theme: {
|
|
1330
|
+
token: {
|
|
1331
|
+
fontFamily: "Kanit",
|
|
1332
|
+
fontSize: 16
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
children: /* @__PURE__ */ jsxs20("div", { className: "container-input", children: [
|
|
1336
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
1337
|
+
/* @__PURE__ */ jsx24("span", { className: "body-1", children: label }),
|
|
1338
|
+
" ",
|
|
1339
|
+
required && /* @__PURE__ */ jsx24("span", { className: "text-red-500", children: "*" })
|
|
1340
|
+
] }),
|
|
1341
|
+
/* @__PURE__ */ jsx24(
|
|
1342
|
+
ColorPicker,
|
|
1343
|
+
{
|
|
1344
|
+
defaultFormat,
|
|
1345
|
+
className: `body-1 w-full ${className ?? ""}`,
|
|
1346
|
+
value,
|
|
1347
|
+
defaultValue: "#ffff",
|
|
1348
|
+
onChange,
|
|
1349
|
+
allowClear,
|
|
1350
|
+
showText: (color) => {
|
|
1351
|
+
const hex = color.toHexString();
|
|
1352
|
+
if (!value) {
|
|
1353
|
+
return /* @__PURE__ */ jsx24("span", { children: placeholder });
|
|
1354
|
+
}
|
|
1355
|
+
return /* @__PURE__ */ jsxs20("span", { children: [
|
|
1356
|
+
"(",
|
|
1357
|
+
hex,
|
|
1358
|
+
")"
|
|
1359
|
+
] });
|
|
1360
|
+
},
|
|
1361
|
+
disabled
|
|
1362
|
+
}
|
|
1363
|
+
),
|
|
1364
|
+
error && /* @__PURE__ */ jsx24("p", { className: "text-red-500 caption-1", children: error })
|
|
1365
|
+
] })
|
|
1366
|
+
}
|
|
1367
|
+
);
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
// src/ColorPicker/ColorPalettePickerBasic/ColorPalettePickerBasic.tsx
|
|
1371
|
+
import { ConfigProvider as ConfigProvider7, ColorPicker as ColorPicker2, theme } from "antd";
|
|
1372
|
+
|
|
1373
|
+
// node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
1374
|
+
function _typeof(o) {
|
|
1375
|
+
"@babel/helpers - typeof";
|
|
1376
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
1377
|
+
return typeof o2;
|
|
1378
|
+
} : function(o2) {
|
|
1379
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
1380
|
+
}, _typeof(o);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
// node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
1384
|
+
function toPrimitive(t, r) {
|
|
1385
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1386
|
+
var e = t[Symbol.toPrimitive];
|
|
1387
|
+
if (void 0 !== e) {
|
|
1388
|
+
var i = e.call(t, r || "default");
|
|
1389
|
+
if ("object" != _typeof(i)) return i;
|
|
1390
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1391
|
+
}
|
|
1392
|
+
return ("string" === r ? String : Number)(t);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
1396
|
+
function toPropertyKey(t) {
|
|
1397
|
+
var i = toPrimitive(t, "string");
|
|
1398
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
1402
|
+
function _defineProperty(e, r, t) {
|
|
1403
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1404
|
+
value: t,
|
|
1405
|
+
enumerable: true,
|
|
1406
|
+
configurable: true,
|
|
1407
|
+
writable: true
|
|
1408
|
+
}) : e[r] = t, e;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// node_modules/@ant-design/fast-color/es/FastColor.js
|
|
1412
|
+
var round = Math.round;
|
|
1413
|
+
function splitColorStr(str, parseNum) {
|
|
1414
|
+
const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
|
|
1415
|
+
const numList = match.map((item) => parseFloat(item));
|
|
1416
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1417
|
+
numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
|
|
1418
|
+
}
|
|
1419
|
+
if (match[3]) {
|
|
1420
|
+
numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
|
|
1421
|
+
} else {
|
|
1422
|
+
numList[3] = 1;
|
|
1423
|
+
}
|
|
1424
|
+
return numList;
|
|
1425
|
+
}
|
|
1426
|
+
var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
|
|
1427
|
+
function limitRange(value, max) {
|
|
1428
|
+
const mergedMax = max || 255;
|
|
1429
|
+
if (value > mergedMax) {
|
|
1430
|
+
return mergedMax;
|
|
1431
|
+
}
|
|
1432
|
+
if (value < 0) {
|
|
1433
|
+
return 0;
|
|
1434
|
+
}
|
|
1435
|
+
return value;
|
|
1436
|
+
}
|
|
1437
|
+
var FastColor = class _FastColor {
|
|
1438
|
+
constructor(input) {
|
|
1439
|
+
_defineProperty(this, "isValid", true);
|
|
1440
|
+
_defineProperty(this, "r", 0);
|
|
1441
|
+
_defineProperty(this, "g", 0);
|
|
1442
|
+
_defineProperty(this, "b", 0);
|
|
1443
|
+
_defineProperty(this, "a", 1);
|
|
1444
|
+
_defineProperty(this, "_h", void 0);
|
|
1445
|
+
_defineProperty(this, "_s", void 0);
|
|
1446
|
+
_defineProperty(this, "_l", void 0);
|
|
1447
|
+
_defineProperty(this, "_v", void 0);
|
|
1448
|
+
_defineProperty(this, "_max", void 0);
|
|
1449
|
+
_defineProperty(this, "_min", void 0);
|
|
1450
|
+
_defineProperty(this, "_brightness", void 0);
|
|
1451
|
+
function matchFormat(str) {
|
|
1452
|
+
return str[0] in input && str[1] in input && str[2] in input;
|
|
1453
|
+
}
|
|
1454
|
+
if (!input) {
|
|
1455
|
+
} else if (typeof input === "string") {
|
|
1456
|
+
let matchPrefix2 = function(prefix) {
|
|
1457
|
+
return trimStr.startsWith(prefix);
|
|
1458
|
+
};
|
|
1459
|
+
var matchPrefix = matchPrefix2;
|
|
1460
|
+
const trimStr = input.trim();
|
|
1461
|
+
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
|
|
1462
|
+
this.fromHexString(trimStr);
|
|
1463
|
+
} else if (matchPrefix2("rgb")) {
|
|
1464
|
+
this.fromRgbString(trimStr);
|
|
1465
|
+
} else if (matchPrefix2("hsl")) {
|
|
1466
|
+
this.fromHslString(trimStr);
|
|
1467
|
+
} else if (matchPrefix2("hsv") || matchPrefix2("hsb")) {
|
|
1468
|
+
this.fromHsvString(trimStr);
|
|
1469
|
+
}
|
|
1470
|
+
} else if (input instanceof _FastColor) {
|
|
1471
|
+
this.r = input.r;
|
|
1472
|
+
this.g = input.g;
|
|
1473
|
+
this.b = input.b;
|
|
1474
|
+
this.a = input.a;
|
|
1475
|
+
this._h = input._h;
|
|
1476
|
+
this._s = input._s;
|
|
1477
|
+
this._l = input._l;
|
|
1478
|
+
this._v = input._v;
|
|
1479
|
+
} else if (matchFormat("rgb")) {
|
|
1480
|
+
this.r = limitRange(input.r);
|
|
1481
|
+
this.g = limitRange(input.g);
|
|
1482
|
+
this.b = limitRange(input.b);
|
|
1483
|
+
this.a = typeof input.a === "number" ? limitRange(input.a, 1) : 1;
|
|
1484
|
+
} else if (matchFormat("hsl")) {
|
|
1485
|
+
this.fromHsl(input);
|
|
1486
|
+
} else if (matchFormat("hsv")) {
|
|
1487
|
+
this.fromHsv(input);
|
|
1488
|
+
} else {
|
|
1489
|
+
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input));
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
// ======================= Setter =======================
|
|
1493
|
+
setR(value) {
|
|
1494
|
+
return this._sc("r", value);
|
|
1495
|
+
}
|
|
1496
|
+
setG(value) {
|
|
1497
|
+
return this._sc("g", value);
|
|
1498
|
+
}
|
|
1499
|
+
setB(value) {
|
|
1500
|
+
return this._sc("b", value);
|
|
1501
|
+
}
|
|
1502
|
+
setA(value) {
|
|
1503
|
+
return this._sc("a", value, 1);
|
|
1504
|
+
}
|
|
1505
|
+
setHue(value) {
|
|
1506
|
+
const hsv = this.toHsv();
|
|
1507
|
+
hsv.h = value;
|
|
1508
|
+
return this._c(hsv);
|
|
1509
|
+
}
|
|
1510
|
+
// ======================= Getter =======================
|
|
1511
|
+
/**
|
|
1512
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
1513
|
+
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
1514
|
+
*/
|
|
1515
|
+
getLuminance() {
|
|
1516
|
+
function adjustGamma(raw) {
|
|
1517
|
+
const val = raw / 255;
|
|
1518
|
+
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
1519
|
+
}
|
|
1520
|
+
const R = adjustGamma(this.r);
|
|
1521
|
+
const G = adjustGamma(this.g);
|
|
1522
|
+
const B = adjustGamma(this.b);
|
|
1523
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
1524
|
+
}
|
|
1525
|
+
getHue() {
|
|
1526
|
+
if (typeof this._h === "undefined") {
|
|
1527
|
+
const delta = this.getMax() - this.getMin();
|
|
1528
|
+
if (delta === 0) {
|
|
1529
|
+
this._h = 0;
|
|
1530
|
+
} else {
|
|
1531
|
+
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
return this._h;
|
|
1535
|
+
}
|
|
1536
|
+
getSaturation() {
|
|
1537
|
+
if (typeof this._s === "undefined") {
|
|
1538
|
+
const delta = this.getMax() - this.getMin();
|
|
1539
|
+
if (delta === 0) {
|
|
1540
|
+
this._s = 0;
|
|
1541
|
+
} else {
|
|
1542
|
+
this._s = delta / this.getMax();
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
return this._s;
|
|
1546
|
+
}
|
|
1547
|
+
getLightness() {
|
|
1548
|
+
if (typeof this._l === "undefined") {
|
|
1549
|
+
this._l = (this.getMax() + this.getMin()) / 510;
|
|
1550
|
+
}
|
|
1551
|
+
return this._l;
|
|
1552
|
+
}
|
|
1553
|
+
getValue() {
|
|
1554
|
+
if (typeof this._v === "undefined") {
|
|
1555
|
+
this._v = this.getMax() / 255;
|
|
1556
|
+
}
|
|
1557
|
+
return this._v;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Returns the perceived brightness of the color, from 0-255.
|
|
1561
|
+
* Note: this is not the b of HSB
|
|
1562
|
+
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
1563
|
+
*/
|
|
1564
|
+
getBrightness() {
|
|
1565
|
+
if (typeof this._brightness === "undefined") {
|
|
1566
|
+
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
|
|
1567
|
+
}
|
|
1568
|
+
return this._brightness;
|
|
1569
|
+
}
|
|
1570
|
+
// ======================== Func ========================
|
|
1571
|
+
darken(amount = 10) {
|
|
1572
|
+
const h = this.getHue();
|
|
1573
|
+
const s = this.getSaturation();
|
|
1574
|
+
let l = this.getLightness() - amount / 100;
|
|
1575
|
+
if (l < 0) {
|
|
1576
|
+
l = 0;
|
|
1577
|
+
}
|
|
1578
|
+
return this._c({
|
|
1579
|
+
h,
|
|
1580
|
+
s,
|
|
1581
|
+
l,
|
|
1582
|
+
a: this.a
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
lighten(amount = 10) {
|
|
1586
|
+
const h = this.getHue();
|
|
1587
|
+
const s = this.getSaturation();
|
|
1588
|
+
let l = this.getLightness() + amount / 100;
|
|
1589
|
+
if (l > 1) {
|
|
1590
|
+
l = 1;
|
|
1591
|
+
}
|
|
1592
|
+
return this._c({
|
|
1593
|
+
h,
|
|
1594
|
+
s,
|
|
1595
|
+
l,
|
|
1596
|
+
a: this.a
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Mix the current color a given amount with another color, from 0 to 100.
|
|
1601
|
+
* 0 means no mixing (return current color).
|
|
1602
|
+
*/
|
|
1603
|
+
mix(input, amount = 50) {
|
|
1604
|
+
const color = this._c(input);
|
|
1605
|
+
const p = amount / 100;
|
|
1606
|
+
const calc = (key) => (color[key] - this[key]) * p + this[key];
|
|
1607
|
+
const rgba = {
|
|
1608
|
+
r: round(calc("r")),
|
|
1609
|
+
g: round(calc("g")),
|
|
1610
|
+
b: round(calc("b")),
|
|
1611
|
+
a: round(calc("a") * 100) / 100
|
|
1612
|
+
};
|
|
1613
|
+
return this._c(rgba);
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Mix the color with pure white, from 0 to 100.
|
|
1617
|
+
* Providing 0 will do nothing, providing 100 will always return white.
|
|
1618
|
+
*/
|
|
1619
|
+
tint(amount = 10) {
|
|
1620
|
+
return this.mix({
|
|
1621
|
+
r: 255,
|
|
1622
|
+
g: 255,
|
|
1623
|
+
b: 255,
|
|
1624
|
+
a: 1
|
|
1625
|
+
}, amount);
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Mix the color with pure black, from 0 to 100.
|
|
1629
|
+
* Providing 0 will do nothing, providing 100 will always return black.
|
|
1630
|
+
*/
|
|
1631
|
+
shade(amount = 10) {
|
|
1632
|
+
return this.mix({
|
|
1633
|
+
r: 0,
|
|
1634
|
+
g: 0,
|
|
1635
|
+
b: 0,
|
|
1636
|
+
a: 1
|
|
1637
|
+
}, amount);
|
|
1638
|
+
}
|
|
1639
|
+
onBackground(background) {
|
|
1640
|
+
const bg = this._c(background);
|
|
1641
|
+
const alpha = this.a + bg.a * (1 - this.a);
|
|
1642
|
+
const calc = (key) => {
|
|
1643
|
+
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
|
|
1644
|
+
};
|
|
1645
|
+
return this._c({
|
|
1646
|
+
r: calc("r"),
|
|
1647
|
+
g: calc("g"),
|
|
1648
|
+
b: calc("b"),
|
|
1649
|
+
a: alpha
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
// ======================= Status =======================
|
|
1653
|
+
isDark() {
|
|
1654
|
+
return this.getBrightness() < 128;
|
|
1655
|
+
}
|
|
1656
|
+
isLight() {
|
|
1657
|
+
return this.getBrightness() >= 128;
|
|
1658
|
+
}
|
|
1659
|
+
// ======================== MISC ========================
|
|
1660
|
+
equals(other) {
|
|
1661
|
+
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
1662
|
+
}
|
|
1663
|
+
clone() {
|
|
1664
|
+
return this._c(this);
|
|
1665
|
+
}
|
|
1666
|
+
// ======================= Format =======================
|
|
1667
|
+
toHexString() {
|
|
1668
|
+
let hex = "#";
|
|
1669
|
+
const rHex = (this.r || 0).toString(16);
|
|
1670
|
+
hex += rHex.length === 2 ? rHex : "0" + rHex;
|
|
1671
|
+
const gHex = (this.g || 0).toString(16);
|
|
1672
|
+
hex += gHex.length === 2 ? gHex : "0" + gHex;
|
|
1673
|
+
const bHex = (this.b || 0).toString(16);
|
|
1674
|
+
hex += bHex.length === 2 ? bHex : "0" + bHex;
|
|
1675
|
+
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
|
|
1676
|
+
const aHex = round(this.a * 255).toString(16);
|
|
1677
|
+
hex += aHex.length === 2 ? aHex : "0" + aHex;
|
|
1678
|
+
}
|
|
1679
|
+
return hex;
|
|
1680
|
+
}
|
|
1681
|
+
/** CSS support color pattern */
|
|
1682
|
+
toHsl() {
|
|
1683
|
+
return {
|
|
1684
|
+
h: this.getHue(),
|
|
1685
|
+
s: this.getSaturation(),
|
|
1686
|
+
l: this.getLightness(),
|
|
1687
|
+
a: this.a
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
/** CSS support color pattern */
|
|
1691
|
+
toHslString() {
|
|
1692
|
+
const h = this.getHue();
|
|
1693
|
+
const s = round(this.getSaturation() * 100);
|
|
1694
|
+
const l = round(this.getLightness() * 100);
|
|
1695
|
+
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
|
|
1696
|
+
}
|
|
1697
|
+
/** Same as toHsb */
|
|
1698
|
+
toHsv() {
|
|
1699
|
+
return {
|
|
1700
|
+
h: this.getHue(),
|
|
1701
|
+
s: this.getSaturation(),
|
|
1702
|
+
v: this.getValue(),
|
|
1703
|
+
a: this.a
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
toRgb() {
|
|
1707
|
+
return {
|
|
1708
|
+
r: this.r,
|
|
1709
|
+
g: this.g,
|
|
1710
|
+
b: this.b,
|
|
1711
|
+
a: this.a
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
toRgbString() {
|
|
1715
|
+
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
1716
|
+
}
|
|
1717
|
+
toString() {
|
|
1718
|
+
return this.toRgbString();
|
|
1719
|
+
}
|
|
1720
|
+
// ====================== Privates ======================
|
|
1721
|
+
/** Return a new FastColor object with one channel changed */
|
|
1722
|
+
_sc(rgb, value, max) {
|
|
1723
|
+
const clone = this.clone();
|
|
1724
|
+
clone[rgb] = limitRange(value, max);
|
|
1725
|
+
return clone;
|
|
1726
|
+
}
|
|
1727
|
+
_c(input) {
|
|
1728
|
+
return new this.constructor(input);
|
|
1729
|
+
}
|
|
1730
|
+
getMax() {
|
|
1731
|
+
if (typeof this._max === "undefined") {
|
|
1732
|
+
this._max = Math.max(this.r, this.g, this.b);
|
|
1733
|
+
}
|
|
1734
|
+
return this._max;
|
|
1735
|
+
}
|
|
1736
|
+
getMin() {
|
|
1737
|
+
if (typeof this._min === "undefined") {
|
|
1738
|
+
this._min = Math.min(this.r, this.g, this.b);
|
|
1739
|
+
}
|
|
1740
|
+
return this._min;
|
|
1741
|
+
}
|
|
1742
|
+
fromHexString(trimStr) {
|
|
1743
|
+
const withoutPrefix = trimStr.replace("#", "");
|
|
1744
|
+
function connectNum(index1, index2) {
|
|
1745
|
+
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
|
|
1746
|
+
}
|
|
1747
|
+
if (withoutPrefix.length < 6) {
|
|
1748
|
+
this.r = connectNum(0);
|
|
1749
|
+
this.g = connectNum(1);
|
|
1750
|
+
this.b = connectNum(2);
|
|
1751
|
+
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
|
|
1752
|
+
} else {
|
|
1753
|
+
this.r = connectNum(0, 1);
|
|
1754
|
+
this.g = connectNum(2, 3);
|
|
1755
|
+
this.b = connectNum(4, 5);
|
|
1756
|
+
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
fromHsl({
|
|
1760
|
+
h,
|
|
1761
|
+
s,
|
|
1762
|
+
l,
|
|
1763
|
+
a
|
|
1764
|
+
}) {
|
|
1765
|
+
this._h = h % 360;
|
|
1766
|
+
this._s = s;
|
|
1767
|
+
this._l = l;
|
|
1768
|
+
this.a = typeof a === "number" ? a : 1;
|
|
1769
|
+
if (s <= 0) {
|
|
1770
|
+
const rgb = round(l * 255);
|
|
1771
|
+
this.r = rgb;
|
|
1772
|
+
this.g = rgb;
|
|
1773
|
+
this.b = rgb;
|
|
1774
|
+
}
|
|
1775
|
+
let r = 0, g = 0, b = 0;
|
|
1776
|
+
const huePrime = h / 60;
|
|
1777
|
+
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
1778
|
+
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
1779
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
1780
|
+
r = chroma;
|
|
1781
|
+
g = secondComponent;
|
|
1782
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
1783
|
+
r = secondComponent;
|
|
1784
|
+
g = chroma;
|
|
1785
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
1786
|
+
g = chroma;
|
|
1787
|
+
b = secondComponent;
|
|
1788
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
1789
|
+
g = secondComponent;
|
|
1790
|
+
b = chroma;
|
|
1791
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
1792
|
+
r = secondComponent;
|
|
1793
|
+
b = chroma;
|
|
1794
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
1795
|
+
r = chroma;
|
|
1796
|
+
b = secondComponent;
|
|
1797
|
+
}
|
|
1798
|
+
const lightnessModification = l - chroma / 2;
|
|
1799
|
+
this.r = round((r + lightnessModification) * 255);
|
|
1800
|
+
this.g = round((g + lightnessModification) * 255);
|
|
1801
|
+
this.b = round((b + lightnessModification) * 255);
|
|
1802
|
+
}
|
|
1803
|
+
fromHsv({
|
|
1804
|
+
h,
|
|
1805
|
+
s,
|
|
1806
|
+
v,
|
|
1807
|
+
a
|
|
1808
|
+
}) {
|
|
1809
|
+
this._h = h % 360;
|
|
1810
|
+
this._s = s;
|
|
1811
|
+
this._v = v;
|
|
1812
|
+
this.a = typeof a === "number" ? a : 1;
|
|
1813
|
+
const vv = round(v * 255);
|
|
1814
|
+
this.r = vv;
|
|
1815
|
+
this.g = vv;
|
|
1816
|
+
this.b = vv;
|
|
1817
|
+
if (s <= 0) {
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
const hh = h / 60;
|
|
1821
|
+
const i = Math.floor(hh);
|
|
1822
|
+
const ff = hh - i;
|
|
1823
|
+
const p = round(v * (1 - s) * 255);
|
|
1824
|
+
const q = round(v * (1 - s * ff) * 255);
|
|
1825
|
+
const t = round(v * (1 - s * (1 - ff)) * 255);
|
|
1826
|
+
switch (i) {
|
|
1827
|
+
case 0:
|
|
1828
|
+
this.g = t;
|
|
1829
|
+
this.b = p;
|
|
1830
|
+
break;
|
|
1831
|
+
case 1:
|
|
1832
|
+
this.r = q;
|
|
1833
|
+
this.b = p;
|
|
1834
|
+
break;
|
|
1835
|
+
case 2:
|
|
1836
|
+
this.r = p;
|
|
1837
|
+
this.b = t;
|
|
1838
|
+
break;
|
|
1839
|
+
case 3:
|
|
1840
|
+
this.r = p;
|
|
1841
|
+
this.g = q;
|
|
1842
|
+
break;
|
|
1843
|
+
case 4:
|
|
1844
|
+
this.r = t;
|
|
1845
|
+
this.g = p;
|
|
1846
|
+
break;
|
|
1847
|
+
case 5:
|
|
1848
|
+
default:
|
|
1849
|
+
this.g = p;
|
|
1850
|
+
this.b = q;
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
fromHsvString(trimStr) {
|
|
1855
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
1856
|
+
this.fromHsv({
|
|
1857
|
+
h: cells[0],
|
|
1858
|
+
s: cells[1],
|
|
1859
|
+
v: cells[2],
|
|
1860
|
+
a: cells[3]
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
fromHslString(trimStr) {
|
|
1864
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
1865
|
+
this.fromHsl({
|
|
1866
|
+
h: cells[0],
|
|
1867
|
+
s: cells[1],
|
|
1868
|
+
l: cells[2],
|
|
1869
|
+
a: cells[3]
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
fromRgbString(trimStr) {
|
|
1873
|
+
const cells = splitColorStr(trimStr, (num, txt) => (
|
|
1874
|
+
// Convert percentage to number. e.g. 50% -> 128
|
|
1875
|
+
txt.includes("%") ? round(num / 100 * 255) : num
|
|
1876
|
+
));
|
|
1877
|
+
this.r = cells[0];
|
|
1878
|
+
this.g = cells[1];
|
|
1879
|
+
this.b = cells[2];
|
|
1880
|
+
this.a = cells[3];
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
// node_modules/@ant-design/colors/es/generate.js
|
|
1885
|
+
var hueStep = 2;
|
|
1886
|
+
var saturationStep = 0.16;
|
|
1887
|
+
var saturationStep2 = 0.05;
|
|
1888
|
+
var brightnessStep1 = 0.05;
|
|
1889
|
+
var brightnessStep2 = 0.15;
|
|
1890
|
+
var lightColorCount = 5;
|
|
1891
|
+
var darkColorCount = 4;
|
|
1892
|
+
var darkColorMap = [{
|
|
1893
|
+
index: 7,
|
|
1894
|
+
amount: 15
|
|
1895
|
+
}, {
|
|
1896
|
+
index: 6,
|
|
1897
|
+
amount: 25
|
|
1898
|
+
}, {
|
|
1899
|
+
index: 5,
|
|
1900
|
+
amount: 30
|
|
1901
|
+
}, {
|
|
1902
|
+
index: 5,
|
|
1903
|
+
amount: 45
|
|
1904
|
+
}, {
|
|
1905
|
+
index: 5,
|
|
1906
|
+
amount: 65
|
|
1907
|
+
}, {
|
|
1908
|
+
index: 5,
|
|
1909
|
+
amount: 85
|
|
1910
|
+
}, {
|
|
1911
|
+
index: 4,
|
|
1912
|
+
amount: 90
|
|
1913
|
+
}, {
|
|
1914
|
+
index: 3,
|
|
1915
|
+
amount: 95
|
|
1916
|
+
}, {
|
|
1917
|
+
index: 2,
|
|
1918
|
+
amount: 97
|
|
1919
|
+
}, {
|
|
1920
|
+
index: 1,
|
|
1921
|
+
amount: 98
|
|
1922
|
+
}];
|
|
1923
|
+
function getHue(hsv, i, light) {
|
|
1924
|
+
var hue;
|
|
1925
|
+
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
1926
|
+
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
1927
|
+
} else {
|
|
1928
|
+
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
1929
|
+
}
|
|
1930
|
+
if (hue < 0) {
|
|
1931
|
+
hue += 360;
|
|
1932
|
+
} else if (hue >= 360) {
|
|
1933
|
+
hue -= 360;
|
|
1934
|
+
}
|
|
1935
|
+
return hue;
|
|
1936
|
+
}
|
|
1937
|
+
function getSaturation(hsv, i, light) {
|
|
1938
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
1939
|
+
return hsv.s;
|
|
1940
|
+
}
|
|
1941
|
+
var saturation;
|
|
1942
|
+
if (light) {
|
|
1943
|
+
saturation = hsv.s - saturationStep * i;
|
|
1944
|
+
} else if (i === darkColorCount) {
|
|
1945
|
+
saturation = hsv.s + saturationStep;
|
|
1946
|
+
} else {
|
|
1947
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
1948
|
+
}
|
|
1949
|
+
if (saturation > 1) {
|
|
1950
|
+
saturation = 1;
|
|
1951
|
+
}
|
|
1952
|
+
if (light && i === lightColorCount && saturation > 0.1) {
|
|
1953
|
+
saturation = 0.1;
|
|
1954
|
+
}
|
|
1955
|
+
if (saturation < 0.06) {
|
|
1956
|
+
saturation = 0.06;
|
|
1957
|
+
}
|
|
1958
|
+
return Math.round(saturation * 100) / 100;
|
|
1959
|
+
}
|
|
1960
|
+
function getValue(hsv, i, light) {
|
|
1961
|
+
var value;
|
|
1962
|
+
if (light) {
|
|
1963
|
+
value = hsv.v + brightnessStep1 * i;
|
|
1964
|
+
} else {
|
|
1965
|
+
value = hsv.v - brightnessStep2 * i;
|
|
1966
|
+
}
|
|
1967
|
+
value = Math.max(0, Math.min(1, value));
|
|
1968
|
+
return Math.round(value * 100) / 100;
|
|
1969
|
+
}
|
|
1970
|
+
function generate(color) {
|
|
1971
|
+
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1972
|
+
var patterns = [];
|
|
1973
|
+
var pColor = new FastColor(color);
|
|
1974
|
+
var hsv = pColor.toHsv();
|
|
1975
|
+
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
1976
|
+
var c = new FastColor({
|
|
1977
|
+
h: getHue(hsv, i, true),
|
|
1978
|
+
s: getSaturation(hsv, i, true),
|
|
1979
|
+
v: getValue(hsv, i, true)
|
|
1980
|
+
});
|
|
1981
|
+
patterns.push(c);
|
|
1982
|
+
}
|
|
1983
|
+
patterns.push(pColor);
|
|
1984
|
+
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
1985
|
+
var _c = new FastColor({
|
|
1986
|
+
h: getHue(hsv, _i),
|
|
1987
|
+
s: getSaturation(hsv, _i),
|
|
1988
|
+
v: getValue(hsv, _i)
|
|
1989
|
+
});
|
|
1990
|
+
patterns.push(_c);
|
|
1991
|
+
}
|
|
1992
|
+
if (opts.theme === "dark") {
|
|
1993
|
+
return darkColorMap.map(function(_ref) {
|
|
1994
|
+
var index = _ref.index, amount = _ref.amount;
|
|
1995
|
+
return new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString();
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
return patterns.map(function(c2) {
|
|
1999
|
+
return c2.toHexString();
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
// node_modules/@ant-design/colors/es/presets.js
|
|
2004
|
+
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
|
|
2005
|
+
red.primary = red[5];
|
|
2006
|
+
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
|
|
2007
|
+
volcano.primary = volcano[5];
|
|
2008
|
+
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
|
|
2009
|
+
orange.primary = orange[5];
|
|
2010
|
+
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
|
|
2011
|
+
gold.primary = gold[5];
|
|
2012
|
+
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
|
|
2013
|
+
yellow.primary = yellow[5];
|
|
2014
|
+
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
|
|
2015
|
+
lime.primary = lime[5];
|
|
2016
|
+
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
|
|
2017
|
+
green.primary = green[5];
|
|
2018
|
+
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
|
|
2019
|
+
cyan.primary = cyan[5];
|
|
2020
|
+
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
|
|
2021
|
+
blue.primary = blue[5];
|
|
2022
|
+
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
|
|
2023
|
+
geekblue.primary = geekblue[5];
|
|
2024
|
+
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
|
|
2025
|
+
purple.primary = purple[5];
|
|
2026
|
+
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
|
|
2027
|
+
magenta.primary = magenta[5];
|
|
2028
|
+
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
|
|
2029
|
+
grey.primary = grey[5];
|
|
2030
|
+
var presetPalettes = {
|
|
2031
|
+
red,
|
|
2032
|
+
volcano,
|
|
2033
|
+
orange,
|
|
2034
|
+
gold,
|
|
2035
|
+
yellow,
|
|
2036
|
+
lime,
|
|
2037
|
+
green,
|
|
2038
|
+
cyan,
|
|
2039
|
+
blue,
|
|
2040
|
+
geekblue,
|
|
2041
|
+
purple,
|
|
2042
|
+
magenta,
|
|
2043
|
+
grey
|
|
2044
|
+
};
|
|
2045
|
+
var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
|
|
2046
|
+
redDark.primary = redDark[5];
|
|
2047
|
+
var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
|
|
2048
|
+
volcanoDark.primary = volcanoDark[5];
|
|
2049
|
+
var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
|
|
2050
|
+
orangeDark.primary = orangeDark[5];
|
|
2051
|
+
var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
|
|
2052
|
+
goldDark.primary = goldDark[5];
|
|
2053
|
+
var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
|
|
2054
|
+
yellowDark.primary = yellowDark[5];
|
|
2055
|
+
var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
|
|
2056
|
+
limeDark.primary = limeDark[5];
|
|
2057
|
+
var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
|
|
2058
|
+
greenDark.primary = greenDark[5];
|
|
2059
|
+
var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
|
|
2060
|
+
cyanDark.primary = cyanDark[5];
|
|
2061
|
+
var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
|
|
2062
|
+
blueDark.primary = blueDark[5];
|
|
2063
|
+
var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
|
|
2064
|
+
geekblueDark.primary = geekblueDark[5];
|
|
2065
|
+
var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
|
|
2066
|
+
purpleDark.primary = purpleDark[5];
|
|
2067
|
+
var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
|
|
2068
|
+
magentaDark.primary = magentaDark[5];
|
|
2069
|
+
var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
|
|
2070
|
+
greyDark.primary = greyDark[5];
|
|
2071
|
+
|
|
2072
|
+
// src/ColorPicker/ColorPalettePickerBasic/ColorPalettePickerBasic.tsx
|
|
2073
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2074
|
+
function genPresets(presets = presetPalettes) {
|
|
2075
|
+
return Object.entries(presets).map(([label, colors]) => ({
|
|
2076
|
+
label,
|
|
2077
|
+
colors,
|
|
2078
|
+
key: label
|
|
2079
|
+
}));
|
|
2080
|
+
}
|
|
2081
|
+
function ColorPalettePickerBasic({
|
|
2082
|
+
value,
|
|
2083
|
+
onChange,
|
|
2084
|
+
required,
|
|
2085
|
+
label,
|
|
2086
|
+
error,
|
|
2087
|
+
disabled,
|
|
2088
|
+
allowClear,
|
|
2089
|
+
defaultFormat,
|
|
2090
|
+
className,
|
|
2091
|
+
placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35",
|
|
2092
|
+
onClear
|
|
2093
|
+
}) {
|
|
2094
|
+
const { token } = theme.useToken();
|
|
2095
|
+
const presets = genPresets({
|
|
2096
|
+
primary: generate(token.colorPrimary),
|
|
2097
|
+
red,
|
|
2098
|
+
green
|
|
2099
|
+
});
|
|
2100
|
+
return /* @__PURE__ */ jsx25(
|
|
2101
|
+
ConfigProvider7,
|
|
2102
|
+
{
|
|
2103
|
+
theme: {
|
|
2104
|
+
token: {
|
|
2105
|
+
fontFamily: "Kanit",
|
|
2106
|
+
fontSize: 16
|
|
2107
|
+
}
|
|
2108
|
+
},
|
|
2109
|
+
children: /* @__PURE__ */ jsxs21("div", { className: "container-input", children: [
|
|
2110
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
2111
|
+
/* @__PURE__ */ jsx25("span", { className: "body-1", children: label }),
|
|
2112
|
+
" ",
|
|
2113
|
+
required && /* @__PURE__ */ jsx25("span", { className: "text-red-500", children: "*" })
|
|
2114
|
+
] }),
|
|
2115
|
+
/* @__PURE__ */ jsx25(
|
|
2116
|
+
ColorPicker2,
|
|
2117
|
+
{
|
|
2118
|
+
defaultFormat,
|
|
2119
|
+
className: `body-1 w-full ${className ?? ""}`,
|
|
2120
|
+
presets,
|
|
2121
|
+
value,
|
|
2122
|
+
defaultValue: "#ffff",
|
|
2123
|
+
onChange,
|
|
2124
|
+
allowClear,
|
|
2125
|
+
showText: (color) => {
|
|
2126
|
+
const hex = color.toHexString();
|
|
2127
|
+
if (!value) {
|
|
2128
|
+
return /* @__PURE__ */ jsx25("span", { children: placeholder });
|
|
2129
|
+
}
|
|
2130
|
+
return /* @__PURE__ */ jsxs21("span", { children: [
|
|
2131
|
+
"(",
|
|
2132
|
+
hex,
|
|
2133
|
+
")"
|
|
2134
|
+
] });
|
|
2135
|
+
},
|
|
2136
|
+
disabled,
|
|
2137
|
+
onClear
|
|
2138
|
+
}
|
|
2139
|
+
),
|
|
2140
|
+
error && /* @__PURE__ */ jsx25("p", { className: "text-red-500 caption-1", children: error })
|
|
2141
|
+
] })
|
|
2142
|
+
}
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
// src/Select/SelectField/SelectField.tsx
|
|
2147
|
+
import { Select, ConfigProvider as ConfigProvider8 } from "antd";
|
|
2148
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2149
|
+
function SelectField({
|
|
2150
|
+
value,
|
|
2151
|
+
onChange,
|
|
2152
|
+
placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
2153
|
+
label,
|
|
2154
|
+
required,
|
|
2155
|
+
error,
|
|
2156
|
+
disabled,
|
|
2157
|
+
defaultValue,
|
|
2158
|
+
options,
|
|
2159
|
+
mode,
|
|
2160
|
+
prefix,
|
|
2161
|
+
prefixSize = 20,
|
|
2162
|
+
handleSearch,
|
|
2163
|
+
className,
|
|
2164
|
+
onClear
|
|
2165
|
+
}) {
|
|
2166
|
+
return /* @__PURE__ */ jsx26(
|
|
2167
|
+
ConfigProvider8,
|
|
2168
|
+
{
|
|
2169
|
+
theme: {
|
|
2170
|
+
token: {
|
|
2171
|
+
fontFamily: "Kanit",
|
|
2172
|
+
fontSize: 16
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
children: /* @__PURE__ */ jsxs22("div", { className: "container-input", children: [
|
|
2176
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
2177
|
+
/* @__PURE__ */ jsx26("span", { className: "body-1", children: label }),
|
|
2178
|
+
" ",
|
|
2179
|
+
required && /* @__PURE__ */ jsx26("span", { className: "text-red-500", children: "*" })
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ jsx26(
|
|
2182
|
+
Select,
|
|
2183
|
+
{
|
|
2184
|
+
showSearch: true,
|
|
2185
|
+
value,
|
|
2186
|
+
defaultValue,
|
|
2187
|
+
onChange,
|
|
2188
|
+
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
2189
|
+
placeholder,
|
|
2190
|
+
optionFilterProp: "label",
|
|
2191
|
+
filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
|
|
2192
|
+
disabled,
|
|
2193
|
+
options,
|
|
2194
|
+
mode,
|
|
2195
|
+
onSearch: handleSearch,
|
|
2196
|
+
prefix: prefix ? /* @__PURE__ */ jsx26(
|
|
2197
|
+
"span",
|
|
2198
|
+
{
|
|
2199
|
+
style: {
|
|
2200
|
+
width: prefixSize,
|
|
2201
|
+
height: prefixSize,
|
|
2202
|
+
display: "flex",
|
|
2203
|
+
alignItems: "center",
|
|
2204
|
+
justifyContent: "center"
|
|
2205
|
+
},
|
|
2206
|
+
children: prefix
|
|
2207
|
+
}
|
|
2208
|
+
) : void 0,
|
|
2209
|
+
allowClear: true,
|
|
2210
|
+
onClear
|
|
2211
|
+
}
|
|
2212
|
+
),
|
|
2213
|
+
error && /* @__PURE__ */ jsx26("p", { className: "text-red-500 caption-1", children: error })
|
|
2214
|
+
] })
|
|
2215
|
+
}
|
|
2216
|
+
);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
// src/Select/SelectFieldGroup/SelectFieldGroup.tsx
|
|
2220
|
+
import { Select as Select2, ConfigProvider as ConfigProvider9 } from "antd";
|
|
2221
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2222
|
+
function SelectFieldGroup({
|
|
2223
|
+
value,
|
|
2224
|
+
onChange,
|
|
2225
|
+
placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
2226
|
+
label,
|
|
2227
|
+
required,
|
|
2228
|
+
error,
|
|
2229
|
+
disabled,
|
|
2230
|
+
defaultValue,
|
|
2231
|
+
options,
|
|
2232
|
+
mode,
|
|
2233
|
+
prefix,
|
|
2234
|
+
prefixSize = 20,
|
|
2235
|
+
handleSearch,
|
|
2236
|
+
className
|
|
2237
|
+
}) {
|
|
2238
|
+
return /* @__PURE__ */ jsx27(
|
|
2239
|
+
ConfigProvider9,
|
|
2240
|
+
{
|
|
2241
|
+
theme: {
|
|
2242
|
+
token: {
|
|
2243
|
+
fontFamily: "Kanit"
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "container-input", children: [
|
|
2247
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
2248
|
+
/* @__PURE__ */ jsx27("span", { className: "body-1", children: label }),
|
|
2249
|
+
" ",
|
|
2250
|
+
required && /* @__PURE__ */ jsx27("span", { className: "text-red-500", children: "*" })
|
|
2251
|
+
] }),
|
|
2252
|
+
/* @__PURE__ */ jsx27(
|
|
2253
|
+
Select2,
|
|
2254
|
+
{
|
|
2255
|
+
showSearch: true,
|
|
2256
|
+
value,
|
|
2257
|
+
defaultValue,
|
|
2258
|
+
onChange,
|
|
2259
|
+
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
2260
|
+
placeholder,
|
|
2261
|
+
optionFilterProp: "label",
|
|
2262
|
+
filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
|
|
2263
|
+
disabled,
|
|
2264
|
+
options,
|
|
2265
|
+
mode,
|
|
2266
|
+
onSearch: handleSearch,
|
|
2267
|
+
prefix: prefix ? /* @__PURE__ */ jsx27(
|
|
2268
|
+
"span",
|
|
2269
|
+
{
|
|
2270
|
+
style: {
|
|
2271
|
+
width: prefixSize,
|
|
2272
|
+
height: prefixSize,
|
|
2273
|
+
display: "flex",
|
|
2274
|
+
alignItems: "center",
|
|
2275
|
+
justifyContent: "center"
|
|
2276
|
+
},
|
|
2277
|
+
children: prefix
|
|
2278
|
+
}
|
|
2279
|
+
) : void 0,
|
|
2280
|
+
allowClear: true
|
|
2281
|
+
}
|
|
2282
|
+
),
|
|
2283
|
+
error && /* @__PURE__ */ jsx27("p", { className: "text-red-500 caption-1", children: error })
|
|
2284
|
+
] })
|
|
2285
|
+
}
|
|
2286
|
+
);
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
// src/Select/SelectFieldStatus/SelectFieldStatus.tsx
|
|
2290
|
+
import { Select as Select3, ConfigProvider as ConfigProvider10 } from "antd";
|
|
2291
|
+
|
|
2292
|
+
// src/Select/SelectFieldStatus/StatusMockup.ts
|
|
2293
|
+
var status = [
|
|
2294
|
+
{ value: "1", label: "\u0E40\u0E1B\u0E34\u0E14", color: "var(--color-gray-500)" },
|
|
2295
|
+
{ value: "2", label: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23", color: "var(--color-yellow-400)" },
|
|
2296
|
+
{ value: "3", label: "\u0E23\u0E2D\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A", color: "var(--color-red-400)" },
|
|
2297
|
+
{ value: "4", label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-green-400)" },
|
|
2298
|
+
{ value: "5", label: "\u0E16\u0E39\u0E01\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01", color: "var(--color-gray-300)" }
|
|
2299
|
+
];
|
|
2300
|
+
|
|
2301
|
+
// src/Select/SelectFieldStatus/SelectFieldStatus.tsx
|
|
2302
|
+
import { DownOutlined } from "@ant-design/icons";
|
|
2303
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2304
|
+
function SelectFieldStatus({
|
|
2305
|
+
value,
|
|
2306
|
+
onChange,
|
|
2307
|
+
placeholder,
|
|
2308
|
+
label,
|
|
2309
|
+
required,
|
|
2310
|
+
disabled,
|
|
2311
|
+
error,
|
|
2312
|
+
options,
|
|
2313
|
+
className
|
|
2314
|
+
}) {
|
|
2315
|
+
const selectedItem = status.find((s) => s.value === value);
|
|
2316
|
+
return /* @__PURE__ */ jsx28(
|
|
2317
|
+
ConfigProvider10,
|
|
2318
|
+
{
|
|
2319
|
+
theme: {
|
|
2320
|
+
components: {
|
|
2321
|
+
Select: {
|
|
2322
|
+
selectorBg: selectedItem?.color || "#ffff",
|
|
2323
|
+
hoverBorderColor: "#D9D9D9",
|
|
2324
|
+
activeBorderColor: "#D9D9D9",
|
|
2325
|
+
activeOutlineColor: "#D9D9D9"
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
token: {
|
|
2329
|
+
fontFamily: "Kanit"
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
children: /* @__PURE__ */ jsxs24("div", { className: "container-input", children: [
|
|
2333
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
2334
|
+
/* @__PURE__ */ jsx28("span", { className: "body-1", children: label }),
|
|
2335
|
+
" ",
|
|
2336
|
+
required && /* @__PURE__ */ jsx28("span", { className: "text-red-500", children: "*" })
|
|
2337
|
+
] }),
|
|
2338
|
+
/* @__PURE__ */ jsx28(
|
|
2339
|
+
Select3,
|
|
2340
|
+
{
|
|
2341
|
+
disabled,
|
|
2342
|
+
suffixIcon: /* @__PURE__ */ jsx28(DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
|
|
2343
|
+
value,
|
|
2344
|
+
onChange,
|
|
2345
|
+
className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
|
|
2346
|
+
placeholder,
|
|
2347
|
+
optionFilterProp: "label",
|
|
2348
|
+
filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
|
|
2349
|
+
options,
|
|
2350
|
+
showSearch: true
|
|
2351
|
+
}
|
|
2352
|
+
),
|
|
2353
|
+
error && /* @__PURE__ */ jsx28("p", { className: "text-red-500 caption-1", children: error })
|
|
2354
|
+
] })
|
|
2355
|
+
}
|
|
2356
|
+
);
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
// src/Select/SelectFieldStatusReport/SelectFieldStatusReport.tsx
|
|
2360
|
+
import { Select as Select4, ConfigProvider as ConfigProvider11 } from "antd";
|
|
2361
|
+
|
|
2362
|
+
// src/Select/SelectFieldStatusReport/StatusReportMockup.ts
|
|
2363
|
+
var status2 = [
|
|
2364
|
+
{ value: "1", label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-green-400)" },
|
|
2365
|
+
{ value: "2", label: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-red-500)" }
|
|
2366
|
+
];
|
|
2367
|
+
|
|
2368
|
+
// src/Select/SelectFieldStatusReport/SelectFieldStatusReport.tsx
|
|
2369
|
+
import { DownOutlined as DownOutlined2 } from "@ant-design/icons";
|
|
2370
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2371
|
+
function SelectFieldStatusReport({
|
|
2372
|
+
value,
|
|
2373
|
+
onChange,
|
|
2374
|
+
placeholder,
|
|
2375
|
+
label,
|
|
2376
|
+
required,
|
|
2377
|
+
disabled,
|
|
2378
|
+
error,
|
|
2379
|
+
className,
|
|
2380
|
+
options
|
|
2381
|
+
}) {
|
|
2382
|
+
const selectedItem = status2.find((s) => s.value === value);
|
|
2383
|
+
return /* @__PURE__ */ jsx29(
|
|
2384
|
+
ConfigProvider11,
|
|
2385
|
+
{
|
|
2386
|
+
theme: {
|
|
2387
|
+
components: {
|
|
2388
|
+
Select: {
|
|
2389
|
+
selectorBg: selectedItem?.color || "#ffff",
|
|
2390
|
+
hoverBorderColor: "#D9D9D9",
|
|
2391
|
+
activeBorderColor: "#D9D9D9",
|
|
2392
|
+
activeOutlineColor: "#D9D9D9"
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
token: {
|
|
2396
|
+
fontFamily: "Kanit"
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "container-input", children: [
|
|
2400
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
2401
|
+
/* @__PURE__ */ jsx29("span", { className: "body-1", children: label }),
|
|
2402
|
+
" ",
|
|
2403
|
+
required && /* @__PURE__ */ jsx29("span", { className: "text-red-500", children: "*" })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ jsx29(
|
|
2406
|
+
Select4,
|
|
2407
|
+
{
|
|
2408
|
+
disabled,
|
|
2409
|
+
suffixIcon: /* @__PURE__ */ jsx29(DownOutlined2, { style: { color: value ? "#fff" : "#D9D9D9" } }),
|
|
2410
|
+
value,
|
|
2411
|
+
onChange,
|
|
2412
|
+
className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
|
|
2413
|
+
placeholder,
|
|
2414
|
+
optionFilterProp: "label",
|
|
2415
|
+
filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
|
|
2416
|
+
options,
|
|
2417
|
+
showSearch: true
|
|
2418
|
+
}
|
|
2419
|
+
),
|
|
2420
|
+
error && /* @__PURE__ */ jsx29("p", { className: "text-red-500 caption-1", children: error })
|
|
2421
|
+
] })
|
|
2422
|
+
}
|
|
2423
|
+
);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
// src/Select/SelectFieldTag/SelectFieldTag.tsx
|
|
2427
|
+
import { Select as Select5, ConfigProvider as ConfigProvider12 } from "antd";
|
|
2428
|
+
import { useState as useState6 } from "react";
|
|
2429
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2430
|
+
function SelectFieldTag({
|
|
2431
|
+
label,
|
|
2432
|
+
required,
|
|
2433
|
+
placeholder,
|
|
2434
|
+
options,
|
|
2435
|
+
error,
|
|
2436
|
+
value: controlledValue,
|
|
2437
|
+
className,
|
|
2438
|
+
onChange,
|
|
2439
|
+
onClear
|
|
2440
|
+
}) {
|
|
2441
|
+
const [internalValue, setInternalValue] = useState6([]);
|
|
2442
|
+
const isControlled = controlledValue !== void 0;
|
|
2443
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
2444
|
+
const [searchWord, setSearchWord] = useState6("");
|
|
2445
|
+
const handleChange = (val) => {
|
|
2446
|
+
const trimValue = val.map((v) => v.trim());
|
|
2447
|
+
const filtered = trimValue.filter((v) => v.trim() !== "");
|
|
2448
|
+
const latest = filtered.slice(-1);
|
|
2449
|
+
if (!isControlled) {
|
|
2450
|
+
setInternalValue(latest);
|
|
2451
|
+
}
|
|
2452
|
+
setSearchWord("");
|
|
2453
|
+
onChange?.(latest);
|
|
2454
|
+
};
|
|
2455
|
+
const handleSearch = (text) => {
|
|
2456
|
+
setSearchWord(text.trimStart());
|
|
2457
|
+
if (!isControlled) {
|
|
2458
|
+
setInternalValue([]);
|
|
2459
|
+
}
|
|
2460
|
+
onChange?.([]);
|
|
2461
|
+
};
|
|
2462
|
+
return /* @__PURE__ */ jsx30(
|
|
2463
|
+
ConfigProvider12,
|
|
2464
|
+
{
|
|
2465
|
+
theme: {
|
|
2466
|
+
token: {
|
|
2467
|
+
fontFamily: "Kanit"
|
|
2468
|
+
}
|
|
2469
|
+
},
|
|
2470
|
+
children: /* @__PURE__ */ jsxs26("div", { className: "container-input", children: [
|
|
2471
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
2472
|
+
/* @__PURE__ */ jsx30("span", { className: "body-1", children: label }),
|
|
2473
|
+
" ",
|
|
2474
|
+
required && /* @__PURE__ */ jsx30("span", { className: "text-red-500", children: "*" })
|
|
2475
|
+
] }),
|
|
2476
|
+
/* @__PURE__ */ jsx30(
|
|
2477
|
+
Select5,
|
|
2478
|
+
{
|
|
2479
|
+
mode: "tags",
|
|
2480
|
+
className: `body-1 flex justify-center w-full ${className ?? ""}`,
|
|
2481
|
+
placeholder,
|
|
2482
|
+
value,
|
|
2483
|
+
onChange: handleChange,
|
|
2484
|
+
onSearch: handleSearch,
|
|
2485
|
+
filterOption: (input, option) => {
|
|
2486
|
+
if (!input.trim()) return true;
|
|
2487
|
+
return (option?.label).toLowerCase().includes(input.toLowerCase());
|
|
2488
|
+
},
|
|
2489
|
+
searchValue: searchWord,
|
|
2490
|
+
options,
|
|
2491
|
+
allowClear: true,
|
|
2492
|
+
onClear
|
|
2493
|
+
}
|
|
2494
|
+
),
|
|
2495
|
+
error && /* @__PURE__ */ jsx30("p", { className: "text-red-500 caption-1", children: error })
|
|
2496
|
+
] })
|
|
2497
|
+
}
|
|
2498
|
+
);
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
// src/Select/SelectCustom/SelectCustom.tsx
|
|
2502
|
+
import { IconTrash } from "@tabler/icons-react";
|
|
2503
|
+
import { Select as Select6, ConfigProvider as ConfigProvider13 } from "antd";
|
|
2504
|
+
import { useState as useState7 } from "react";
|
|
2505
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2506
|
+
function SelectCustom({
|
|
2507
|
+
label = "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23",
|
|
2508
|
+
placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01",
|
|
2509
|
+
options,
|
|
2510
|
+
required = false,
|
|
2511
|
+
onChange,
|
|
2512
|
+
error,
|
|
2513
|
+
onClear
|
|
2514
|
+
}) {
|
|
2515
|
+
const [value, setValue] = useState7([]);
|
|
2516
|
+
const [valueList, setValueList] = useState7([]);
|
|
2517
|
+
const handleChange = (selectedValues) => {
|
|
2518
|
+
const newValues = selectedValues.filter((v) => !valueList.includes(v));
|
|
2519
|
+
setValueList((prev) => {
|
|
2520
|
+
const updated = [...prev, ...newValues];
|
|
2521
|
+
onChange && onChange(updated);
|
|
2522
|
+
return updated;
|
|
2523
|
+
});
|
|
2524
|
+
setValue([]);
|
|
2525
|
+
};
|
|
2526
|
+
const handleDelete = (val) => {
|
|
2527
|
+
setValueList((prev) => {
|
|
2528
|
+
const updated = prev.filter((v) => v !== val);
|
|
2529
|
+
onChange && onChange(updated);
|
|
2530
|
+
return updated;
|
|
2531
|
+
});
|
|
2532
|
+
};
|
|
2533
|
+
const filteredOptions = options.filter((opt) => !valueList.includes(opt.value)).map((opt) => ({ value: opt.value, label: opt.label }));
|
|
2534
|
+
return /* @__PURE__ */ jsx31(
|
|
2535
|
+
ConfigProvider13,
|
|
2536
|
+
{
|
|
2537
|
+
theme: {
|
|
2538
|
+
token: {
|
|
2539
|
+
fontFamily: "Kanit",
|
|
2540
|
+
fontSize: 16
|
|
2541
|
+
}
|
|
2542
|
+
},
|
|
2543
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "container-input", children: [
|
|
2544
|
+
/* @__PURE__ */ jsxs27("div", { children: [
|
|
2545
|
+
/* @__PURE__ */ jsx31("span", { className: "body-1", children: label }),
|
|
2546
|
+
" ",
|
|
2547
|
+
required && /* @__PURE__ */ jsx31("span", { className: "text-red-500", children: "*" })
|
|
2548
|
+
] }),
|
|
2549
|
+
/* @__PURE__ */ jsx31(
|
|
2550
|
+
Select6,
|
|
2551
|
+
{
|
|
2552
|
+
value,
|
|
2553
|
+
onChange: handleChange,
|
|
2554
|
+
placeholder,
|
|
2555
|
+
options: filteredOptions,
|
|
2556
|
+
mode: "tags",
|
|
2557
|
+
onClear
|
|
2558
|
+
}
|
|
2559
|
+
),
|
|
2560
|
+
error && /* @__PURE__ */ jsx31("p", { className: "text-red-500 caption-1", children: error }),
|
|
2561
|
+
/* @__PURE__ */ jsx31("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ jsxs27("div", { className: "flex justify-between items-center py-[2px] body-1", children: [
|
|
2562
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row gap-[8px]", children: [
|
|
2563
|
+
/* @__PURE__ */ jsxs27("p", { children: [
|
|
2564
|
+
index + 1,
|
|
2565
|
+
"."
|
|
2566
|
+
] }),
|
|
2567
|
+
/* @__PURE__ */ jsx31("p", { children: v })
|
|
2568
|
+
] }),
|
|
2569
|
+
/* @__PURE__ */ jsx31(IconTrash, { className: "cursor-pointer", onClick: () => handleDelete(v) })
|
|
2570
|
+
] }, index)) })
|
|
2571
|
+
] })
|
|
2572
|
+
}
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
// src/SortFilter/SortFilter.tsx
|
|
2577
|
+
import { ConfigProvider as ConfigProvider14 } from "antd";
|
|
2578
|
+
import { CalendarOutlined } from "@ant-design/icons";
|
|
2579
|
+
|
|
2580
|
+
// src/SortFilter/DataMockSortFilter.ts
|
|
2581
|
+
var years = [
|
|
2582
|
+
{ value: "\u0E1B\u0E35 2566", label: "\u0E1B\u0E35 2566" },
|
|
2583
|
+
{ value: "\u0E1B\u0E35 2567", label: "\u0E1B\u0E35 2567" },
|
|
2584
|
+
{ value: "\u0E1B\u0E35 2568", label: "\u0E1B\u0E35 2568" }
|
|
2585
|
+
];
|
|
2586
|
+
var months = [
|
|
2587
|
+
{ value: "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21", label: "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21" },
|
|
2588
|
+
{ value: "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C", label: "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C" },
|
|
2589
|
+
{ value: "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21", label: "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21" },
|
|
2590
|
+
{ value: "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19", label: "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19" },
|
|
2591
|
+
{ value: "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21", label: "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21" },
|
|
2592
|
+
{ value: "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19", label: "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19" },
|
|
2593
|
+
{ value: "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21", label: "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21" },
|
|
2594
|
+
{ value: "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21", label: "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21" },
|
|
2595
|
+
{ value: "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19", label: "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19" },
|
|
2596
|
+
{ value: "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21", label: "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21" },
|
|
2597
|
+
{ value: "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19", label: "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19" },
|
|
2598
|
+
{ value: "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21", label: "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21" }
|
|
2599
|
+
];
|
|
2600
|
+
var quarters = [
|
|
2601
|
+
{ value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 1", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 1" },
|
|
2602
|
+
{ value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 2", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 2" },
|
|
2603
|
+
{ value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 3", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 3" },
|
|
2604
|
+
{ value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 4", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 4" }
|
|
2605
|
+
];
|
|
2606
|
+
|
|
2607
|
+
// src/SortFilter/SortFilter.tsx
|
|
2608
|
+
import { useState as useState8 } from "react";
|
|
2609
|
+
import { IconSortDescending as IconSortDescending2, IconFilter } from "@tabler/icons-react";
|
|
2610
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2611
|
+
function SortFilter({
|
|
2612
|
+
showYear = true,
|
|
2613
|
+
showQuarter = true,
|
|
2614
|
+
showMonth = true,
|
|
2615
|
+
onSortClick,
|
|
2616
|
+
onFilterClick
|
|
2617
|
+
}) {
|
|
2618
|
+
const [yearValue, setYearValue] = useState8();
|
|
2619
|
+
const [monthValue, setMonthValue] = useState8();
|
|
2620
|
+
const [quarterValue, setQuartersValue] = useState8();
|
|
2621
|
+
return /* @__PURE__ */ jsx32(
|
|
2622
|
+
ConfigProvider14,
|
|
2623
|
+
{
|
|
2624
|
+
theme: {
|
|
2625
|
+
token: {
|
|
2626
|
+
fontFamily: "Kanit"
|
|
2627
|
+
}
|
|
2628
|
+
},
|
|
2629
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "w-full flex items-center justify-between", children: [
|
|
2630
|
+
/* @__PURE__ */ jsxs28("div", { className: "w-full flex gap-[10px]", children: [
|
|
2631
|
+
showYear && /* @__PURE__ */ jsx32("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx32(
|
|
2632
|
+
SelectField,
|
|
2633
|
+
{
|
|
2634
|
+
prefix: /* @__PURE__ */ jsx32(CalendarOutlined, {}),
|
|
2635
|
+
onChange: setYearValue,
|
|
2636
|
+
options: years.map((s) => ({
|
|
2637
|
+
value: s.value,
|
|
2638
|
+
label: s.label
|
|
2639
|
+
})),
|
|
2640
|
+
placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E1B\u0E35",
|
|
2641
|
+
value: yearValue
|
|
2642
|
+
}
|
|
2643
|
+
) }),
|
|
2644
|
+
showMonth && /* @__PURE__ */ jsx32("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx32(
|
|
2645
|
+
SelectField,
|
|
2646
|
+
{
|
|
2647
|
+
prefix: /* @__PURE__ */ jsx32(CalendarOutlined, {}),
|
|
2648
|
+
onChange: setMonthValue,
|
|
2649
|
+
options: months.map((s) => ({
|
|
2650
|
+
value: s.value,
|
|
2651
|
+
label: s.label
|
|
2652
|
+
})),
|
|
2653
|
+
value: monthValue,
|
|
2654
|
+
placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E14\u0E37\u0E2D\u0E19"
|
|
2655
|
+
}
|
|
2656
|
+
) }),
|
|
2657
|
+
showQuarter && /* @__PURE__ */ jsx32("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx32(
|
|
2658
|
+
SelectField,
|
|
2659
|
+
{
|
|
2660
|
+
prefix: /* @__PURE__ */ jsx32(CalendarOutlined, {}),
|
|
2661
|
+
onChange: setQuartersValue,
|
|
2662
|
+
options: quarters.map((s) => ({
|
|
2663
|
+
value: s.value,
|
|
2664
|
+
label: s.label
|
|
2665
|
+
})),
|
|
2666
|
+
value: quarterValue,
|
|
2667
|
+
placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A"
|
|
2668
|
+
}
|
|
2669
|
+
) })
|
|
2670
|
+
] }),
|
|
2671
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-[10px]", children: [
|
|
2672
|
+
/* @__PURE__ */ jsx32(
|
|
2673
|
+
IconSortDescending2,
|
|
2674
|
+
{
|
|
2675
|
+
size: 24,
|
|
2676
|
+
className: "cursor-pointer",
|
|
2677
|
+
onClick: onSortClick
|
|
2678
|
+
}
|
|
2679
|
+
),
|
|
2680
|
+
/* @__PURE__ */ jsx32(
|
|
2681
|
+
IconFilter,
|
|
2682
|
+
{
|
|
2683
|
+
size: 24,
|
|
2684
|
+
className: "cursor-pointer",
|
|
2685
|
+
onClick: onFilterClick
|
|
2686
|
+
}
|
|
2687
|
+
)
|
|
2688
|
+
] })
|
|
2689
|
+
] })
|
|
2690
|
+
}
|
|
2691
|
+
);
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
// src/Upload/FileUploader/FileUploader.tsx
|
|
2695
|
+
import { IconPaperclip, IconUpload, IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
2696
|
+
import { useRef as useRef2, useState as useState9 } from "react";
|
|
2697
|
+
import { Fragment as Fragment5, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2698
|
+
function FileUploader({
|
|
2699
|
+
onUpload,
|
|
2700
|
+
onError,
|
|
2701
|
+
onRemove,
|
|
2702
|
+
accept,
|
|
2703
|
+
maxSize,
|
|
2704
|
+
disabled,
|
|
2705
|
+
mode = "drop",
|
|
2706
|
+
description,
|
|
2707
|
+
label
|
|
2708
|
+
}) {
|
|
2709
|
+
const [fileList, setFileList] = useState9([]);
|
|
2710
|
+
const [uploading, setUploading] = useState9(false);
|
|
2711
|
+
const [dragActive, setDragActive] = useState9(false);
|
|
2712
|
+
const inputRef = useRef2(null);
|
|
2713
|
+
const validateFile = (file) => {
|
|
2714
|
+
if (accept && !accept.includes(file.type)) {
|
|
2715
|
+
onError?.(`Invalid file type. file: ${file.name}`);
|
|
2716
|
+
throw new Error("Invalid file type");
|
|
2717
|
+
}
|
|
2718
|
+
if (maxSize && file.size > maxSize * 1024 * 1024) {
|
|
2719
|
+
onError?.(`Invalid file size. file: ${file.name}`);
|
|
2720
|
+
throw new Error("Invalid file size");
|
|
2721
|
+
}
|
|
2722
|
+
return true;
|
|
2723
|
+
};
|
|
2724
|
+
const handleUploadClick = () => {
|
|
2725
|
+
inputRef.current?.click();
|
|
2726
|
+
};
|
|
2727
|
+
const handleRemoveFile = async (index) => {
|
|
2728
|
+
try {
|
|
2729
|
+
if (onRemove) {
|
|
2730
|
+
await onRemove(index);
|
|
2731
|
+
}
|
|
2732
|
+
const updatedList = [...fileList];
|
|
2733
|
+
updatedList.splice(index, 1);
|
|
2734
|
+
setFileList(updatedList);
|
|
2735
|
+
} catch (error) {
|
|
2736
|
+
console.log(error);
|
|
2737
|
+
}
|
|
2738
|
+
};
|
|
2739
|
+
const handleUpload = (event) => {
|
|
2740
|
+
handleFileChange(event.target.files);
|
|
2741
|
+
};
|
|
2742
|
+
const handleDrop = (event) => {
|
|
2743
|
+
event.preventDefault();
|
|
2744
|
+
setDragActive(false);
|
|
2745
|
+
if (disabled) return;
|
|
2746
|
+
handleFileChange(event.dataTransfer.files);
|
|
2747
|
+
};
|
|
2748
|
+
const handleFileChange = async (files) => {
|
|
2749
|
+
if (!files) return;
|
|
2750
|
+
const fileArray = Array.from(files);
|
|
2751
|
+
for (const file of fileArray) {
|
|
2752
|
+
if (!validateFile(file)) continue;
|
|
2753
|
+
setUploading(true);
|
|
2754
|
+
try {
|
|
2755
|
+
if (onUpload) {
|
|
2756
|
+
await onUpload(file);
|
|
2757
|
+
}
|
|
2758
|
+
setFileList((prev) => [...prev, file]);
|
|
2759
|
+
} catch (err) {
|
|
2760
|
+
console.log("catch");
|
|
2761
|
+
console.error(err);
|
|
2762
|
+
} finally {
|
|
2763
|
+
setUploading(false);
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
2767
|
+
};
|
|
2768
|
+
return /* @__PURE__ */ jsxs29("div", { className: "w-full", children: [
|
|
2769
|
+
label && /* @__PURE__ */ jsx33("p", { className: "body-1", children: label }),
|
|
2770
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
2771
|
+
mode === "upload" ? /* @__PURE__ */ jsx33(
|
|
2772
|
+
"button",
|
|
2773
|
+
{
|
|
2774
|
+
type: "button",
|
|
2775
|
+
onClick: handleUploadClick,
|
|
2776
|
+
className: `h-[34px] flex justify-center items-center gap-2 w-full rounded-[2px] border border-gray-200 body-1
|
|
2777
|
+
${disabled ? "cursor-not-allowed text-gray-400 bg-gray-100" : "cursor-pointer hover:text-primary-400 hover:border-primary-200 duration-300"}`,
|
|
2778
|
+
disabled: disabled ? disabled : uploading,
|
|
2779
|
+
children: uploading ? /* @__PURE__ */ jsxs29(Fragment5, { children: [
|
|
2780
|
+
/* @__PURE__ */ jsx33(Loader, { size: 15 }),
|
|
2781
|
+
" \u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14"
|
|
2782
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment5, { children: [
|
|
2783
|
+
/* @__PURE__ */ jsx33(IconUpload, { size: 15, className: "text-gray-400" }),
|
|
2784
|
+
" \u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C"
|
|
2785
|
+
] })
|
|
2786
|
+
}
|
|
2787
|
+
) : /* @__PURE__ */ jsx33(
|
|
2788
|
+
"div",
|
|
2789
|
+
{
|
|
2790
|
+
className: `min-w-[400px] min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
|
|
2791
|
+
${dragActive ? "border-primary-500 bg-primary-50" : "border-gray-300 bg-white"}
|
|
2792
|
+
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2793
|
+
`,
|
|
2794
|
+
onClick: handleUploadClick,
|
|
2795
|
+
onDragOver: (e) => {
|
|
2796
|
+
e.preventDefault();
|
|
2797
|
+
if (!disabled) setDragActive(true);
|
|
2798
|
+
},
|
|
2799
|
+
onDragLeave: () => setDragActive(false),
|
|
2800
|
+
onDrop: handleDrop,
|
|
2801
|
+
children: uploading ? /* @__PURE__ */ jsxs29("div", { className: "flex justify-center items-center gap-2", children: [
|
|
2802
|
+
/* @__PURE__ */ jsx33(Loader, { size: 15 }),
|
|
2803
|
+
" \u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14"
|
|
2804
|
+
] }) : /* @__PURE__ */ jsxs29("div", { className: "flex flex-col items-center gap-2", children: [
|
|
2805
|
+
/* @__PURE__ */ jsx33(IconUpload, { size: 20 }),
|
|
2806
|
+
/* @__PURE__ */ jsx33("span", { className: "body-1", children: "\u0E04\u0E25\u0E34\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E17\u0E35\u0E48\u0E1A\u0E23\u0E34\u0E40\u0E27\u0E13\u0E19\u0E35\u0E49\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14" }),
|
|
2807
|
+
/* @__PURE__ */ jsx33("span", { className: "text-gray-400 body-3", children: "\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u0E41\u0E1A\u0E1A\u0E40\u0E14\u0E35\u0E48\u0E22\u0E27\u0E2B\u0E23\u0E37\u0E2D\u0E2B\u0E25\u0E32\u0E22\u0E44\u0E1F\u0E25\u0E4C" })
|
|
2808
|
+
] })
|
|
2809
|
+
}
|
|
2810
|
+
),
|
|
2811
|
+
/* @__PURE__ */ jsx33(
|
|
2812
|
+
"input",
|
|
2813
|
+
{
|
|
2814
|
+
type: "file",
|
|
2815
|
+
multiple: true,
|
|
2816
|
+
ref: inputRef,
|
|
2817
|
+
onChange: handleUpload,
|
|
2818
|
+
style: { display: "none" },
|
|
2819
|
+
accept: accept?.join(","),
|
|
2820
|
+
disabled
|
|
2821
|
+
}
|
|
2822
|
+
)
|
|
2823
|
+
] }),
|
|
2824
|
+
description && /* @__PURE__ */ jsx33("p", { className: "text-gray-400 body-4", children: description }),
|
|
2825
|
+
/* @__PURE__ */ jsx33("div", { className: "mt-[8px]", children: fileList.length !== 0 && fileList.map((file, index) => /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2 rounded-[4px] px-[8px] py-[4px] body-1", children: [
|
|
2826
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2 w-[75%] overflow-hidden", children: [
|
|
2827
|
+
/* @__PURE__ */ jsx33("div", { className: "w-[15px] h-[15px]", children: /* @__PURE__ */ jsx33(IconPaperclip, { size: 15 }) }),
|
|
2828
|
+
/* @__PURE__ */ jsx33("span", { className: "truncate", children: file.name })
|
|
2829
|
+
] }),
|
|
2830
|
+
/* @__PURE__ */ jsx33(
|
|
2831
|
+
IconTrash2,
|
|
2832
|
+
{
|
|
2833
|
+
size: 20,
|
|
2834
|
+
className: "ml-auto hover:text-red-500 cursor-pointer",
|
|
2835
|
+
onClick: () => handleRemoveFile(index)
|
|
2836
|
+
}
|
|
2837
|
+
)
|
|
2838
|
+
] }, index)) })
|
|
2839
|
+
] });
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
// src/Message/Message/Message.tsx
|
|
2843
|
+
var messageApi = null;
|
|
2844
|
+
function setMessageApi(api) {
|
|
2845
|
+
messageApi = api;
|
|
2846
|
+
}
|
|
2847
|
+
function messageSuccess(content) {
|
|
2848
|
+
messageApi?.success({ content, className: "message message-success" });
|
|
2849
|
+
}
|
|
2850
|
+
function messageError(content) {
|
|
2851
|
+
messageApi?.error({ content, className: "message message-error" });
|
|
2852
|
+
}
|
|
2853
|
+
function messageWarning(content) {
|
|
2854
|
+
messageApi?.warning({ content, className: "message message-warning" });
|
|
2855
|
+
}
|
|
2856
|
+
function messageInfo(content) {
|
|
2857
|
+
messageApi?.info({ content, className: "message message-info" });
|
|
2858
|
+
}
|
|
2859
|
+
function messageLoading(content, duration) {
|
|
2860
|
+
messageApi?.loading({ content, duration, className: "message message-loading" });
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
// src/Breadcrumb/Breadcrumb.tsx
|
|
2864
|
+
import { ConfigProvider as ConfigProvider15 } from "antd";
|
|
2865
|
+
import { Breadcrumb } from "antd";
|
|
2866
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2867
|
+
function Breadcrumbs({
|
|
2868
|
+
items,
|
|
2869
|
+
separator,
|
|
2870
|
+
itemRender,
|
|
2871
|
+
classname,
|
|
2872
|
+
params
|
|
2873
|
+
}) {
|
|
2874
|
+
return /* @__PURE__ */ jsx34(
|
|
2875
|
+
ConfigProvider15,
|
|
2876
|
+
{
|
|
2877
|
+
theme: {
|
|
2878
|
+
token: {
|
|
2879
|
+
fontFamily: "Kanit"
|
|
2880
|
+
}
|
|
2881
|
+
},
|
|
2882
|
+
children: /* @__PURE__ */ jsx34(
|
|
2883
|
+
Breadcrumb,
|
|
2884
|
+
{
|
|
2885
|
+
items,
|
|
2886
|
+
separator,
|
|
2887
|
+
itemRender,
|
|
2888
|
+
className: classname,
|
|
2889
|
+
params
|
|
2890
|
+
}
|
|
2891
|
+
)
|
|
2892
|
+
}
|
|
2893
|
+
);
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
// src/HeadingPage/HeadingPage.tsx
|
|
2897
|
+
import { ConfigProvider as ConfigProvider16 } from "antd";
|
|
2898
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2899
|
+
function HeadingPage({ Heading }) {
|
|
2900
|
+
const today = (/* @__PURE__ */ new Date()).toLocaleDateString("th-TH", {
|
|
2901
|
+
weekday: "long",
|
|
2902
|
+
day: "numeric",
|
|
2903
|
+
month: "long",
|
|
2904
|
+
year: "numeric"
|
|
2905
|
+
});
|
|
2906
|
+
return /* @__PURE__ */ jsx35(
|
|
2907
|
+
ConfigProvider16,
|
|
2908
|
+
{
|
|
2909
|
+
theme: {
|
|
2910
|
+
token: {
|
|
2911
|
+
fontFamily: "Kanit"
|
|
2912
|
+
}
|
|
2913
|
+
},
|
|
2914
|
+
children: /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-[10px] px-[20px] py-[10px]", children: [
|
|
2915
|
+
/* @__PURE__ */ jsx35("p", { className: "headline-5", children: Heading }),
|
|
2916
|
+
/* @__PURE__ */ jsxs30("p", { className: "body-1", children: [
|
|
2917
|
+
" \u0E27\u0E31\u0E19\u0E19\u0E35\u0E49 ",
|
|
2918
|
+
today
|
|
2919
|
+
] })
|
|
2920
|
+
] })
|
|
2921
|
+
}
|
|
2922
|
+
);
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
// src/Progress/ProgressBar.tsx
|
|
2926
|
+
import { ConfigProvider as ConfigProvider17, Progress } from "antd";
|
|
2927
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState10 } from "react";
|
|
2928
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2929
|
+
function ProgressBar({
|
|
2930
|
+
percent = 0,
|
|
2931
|
+
size = "default",
|
|
2932
|
+
checkpoints = [],
|
|
2933
|
+
showInfo,
|
|
2934
|
+
trailColor = "#DBE0E5",
|
|
2935
|
+
type,
|
|
2936
|
+
strokeLinecap,
|
|
2937
|
+
strokeWidth,
|
|
2938
|
+
steps,
|
|
2939
|
+
isCheckPoints
|
|
2940
|
+
}) {
|
|
2941
|
+
const [barWidth, setBarWidth] = useState10(0);
|
|
2942
|
+
const progressRef = useRef3(null);
|
|
2943
|
+
let strokeColor = "--color-green-500";
|
|
2944
|
+
const defaultStrokeWidth = type === "circle" ? 13 : strokeWidth ?? 8;
|
|
2945
|
+
const defaultSize = type === "circle" ? 43 : size;
|
|
2946
|
+
if (percent < 100 && checkpoints.length > 0) {
|
|
2947
|
+
const minCheckpoint = Math.min(...checkpoints);
|
|
2948
|
+
strokeColor = percent >= minCheckpoint ? "var(--color-green-500)" : "var(--color-red-500)";
|
|
2949
|
+
}
|
|
2950
|
+
useEffect2(() => {
|
|
2951
|
+
const inner = progressRef.current?.querySelector(".ant-progress-inner");
|
|
2952
|
+
if (!inner) return;
|
|
2953
|
+
const observer = new ResizeObserver(() => {
|
|
2954
|
+
setBarWidth(inner.offsetWidth);
|
|
2955
|
+
});
|
|
2956
|
+
observer.observe(inner);
|
|
2957
|
+
return () => observer.disconnect();
|
|
2958
|
+
}, []);
|
|
2959
|
+
return /* @__PURE__ */ jsx36(
|
|
2960
|
+
ConfigProvider17,
|
|
2961
|
+
{
|
|
2962
|
+
theme: {
|
|
2963
|
+
token: {
|
|
2964
|
+
fontFamily: "Kanit"
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2967
|
+
children: /* @__PURE__ */ jsxs31("div", { className: "relative w-full", ref: progressRef, children: [
|
|
2968
|
+
/* @__PURE__ */ jsx36(
|
|
2969
|
+
Progress,
|
|
2970
|
+
{
|
|
2971
|
+
className: "w-full",
|
|
2972
|
+
percent,
|
|
2973
|
+
size: defaultSize,
|
|
2974
|
+
type,
|
|
2975
|
+
showInfo,
|
|
2976
|
+
trailColor,
|
|
2977
|
+
format: (percent2) => `${percent2}%`,
|
|
2978
|
+
strokeLinecap,
|
|
2979
|
+
strokeWidth: defaultStrokeWidth,
|
|
2980
|
+
steps,
|
|
2981
|
+
strokeColor
|
|
2982
|
+
}
|
|
2983
|
+
),
|
|
2984
|
+
barWidth > 0 && isCheckPoints && type !== "circle" && checkpoints.map((cp) => /* @__PURE__ */ jsx36(
|
|
2985
|
+
"div",
|
|
2986
|
+
{
|
|
2987
|
+
className: "checkpoint absolute top-0",
|
|
2988
|
+
style: {
|
|
2989
|
+
left: `${cp / 100 * barWidth}px`,
|
|
2990
|
+
width: 0,
|
|
2991
|
+
height: 0,
|
|
2992
|
+
borderLeft: "6px solid transparent",
|
|
2993
|
+
borderRight: "6px solid transparent",
|
|
2994
|
+
borderTop: "10px solid red",
|
|
2995
|
+
transform: "translateX(-50%)"
|
|
2996
|
+
}
|
|
2997
|
+
},
|
|
2998
|
+
cp
|
|
2999
|
+
))
|
|
3000
|
+
] })
|
|
3001
|
+
}
|
|
3002
|
+
);
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
// src/KpiSection/KpiSection.tsx
|
|
3006
|
+
import { ConfigProvider as ConfigProvider18, message } from "antd";
|
|
3007
|
+
import { useEffect as useEffect3, useState as useState12 } from "react";
|
|
3008
|
+
|
|
3009
|
+
// src/KpiSection/hooks/useGetKpiSection.ts
|
|
3010
|
+
import { useState as useState11 } from "react";
|
|
3011
|
+
import cuid from "cuid";
|
|
3012
|
+
function useGetKpiSection() {
|
|
3013
|
+
const [nameKpi, setNameKpi] = useState11("");
|
|
3014
|
+
const [kpiValue, setKpiValue] = useState11("");
|
|
3015
|
+
const [unitValue, setUnitValue] = useState11("");
|
|
3016
|
+
const [kpiList, setKpiList] = useState11([]);
|
|
3017
|
+
const [editingBackup, setEditingBackup] = useState11({});
|
|
3018
|
+
const [selected, setSelected] = useState11("2");
|
|
3019
|
+
const [errors, setErrors] = useState11({
|
|
3020
|
+
nameKpi: "",
|
|
3021
|
+
kpiValue: "",
|
|
3022
|
+
unitValue: ""
|
|
3023
|
+
});
|
|
3024
|
+
const [itemErrors, setItemErrors] = useState11({});
|
|
3025
|
+
const options = [
|
|
3026
|
+
{ value: "1", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
|
|
3027
|
+
{ value: "2", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
|
|
3028
|
+
];
|
|
3029
|
+
const handleAddKpi = (type) => {
|
|
3030
|
+
let newErrors = { nameKpi: "", kpiValue: "", unitValue: "" };
|
|
3031
|
+
let hasError = false;
|
|
3032
|
+
if (!nameKpi) {
|
|
3033
|
+
newErrors.nameKpi = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3034
|
+
hasError = true;
|
|
3035
|
+
}
|
|
3036
|
+
if (type === "number") {
|
|
3037
|
+
if (!kpiValue) {
|
|
3038
|
+
newErrors.kpiValue = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3039
|
+
hasError = true;
|
|
3040
|
+
}
|
|
3041
|
+
if (!unitValue) {
|
|
3042
|
+
newErrors.unitValue = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3043
|
+
hasError = true;
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
setErrors(newErrors);
|
|
3047
|
+
if (hasError) return;
|
|
3048
|
+
const newKpi = {
|
|
3049
|
+
id: cuid(),
|
|
3050
|
+
name: nameKpi,
|
|
3051
|
+
value: kpiValue,
|
|
3052
|
+
unit: unitValue,
|
|
3053
|
+
isEditing: false
|
|
3054
|
+
};
|
|
3055
|
+
setKpiList([...kpiList, newKpi]);
|
|
3056
|
+
setNameKpi("");
|
|
3057
|
+
setKpiValue("");
|
|
3058
|
+
setUnitValue("");
|
|
3059
|
+
setErrors({ nameKpi: "", kpiValue: "", unitValue: "" });
|
|
3060
|
+
};
|
|
3061
|
+
const handleEdit = (id) => {
|
|
3062
|
+
const current = kpiList.find((kpi) => kpi.id === id);
|
|
3063
|
+
if (current) {
|
|
3064
|
+
setEditingBackup((prev) => ({ ...prev, [id]: { ...current } }));
|
|
3065
|
+
}
|
|
3066
|
+
setKpiList(
|
|
3067
|
+
(prev) => prev.map((item) => item.id === id ? { ...item, isEditing: true } : item)
|
|
3068
|
+
);
|
|
3069
|
+
};
|
|
3070
|
+
const handleSave = (id, type) => {
|
|
3071
|
+
setKpiList((prev) => {
|
|
3072
|
+
return prev.map((item) => {
|
|
3073
|
+
if (item.id === id) {
|
|
3074
|
+
let hasError = false;
|
|
3075
|
+
const errorsForItem = {};
|
|
3076
|
+
if (!item.name) {
|
|
3077
|
+
errorsForItem.name = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3078
|
+
hasError = true;
|
|
3079
|
+
}
|
|
3080
|
+
if (type === "number") {
|
|
3081
|
+
if (!item.value) {
|
|
3082
|
+
errorsForItem.value = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3083
|
+
hasError = true;
|
|
3084
|
+
}
|
|
3085
|
+
if (!item.unit) {
|
|
3086
|
+
errorsForItem.unit = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
|
|
3087
|
+
hasError = true;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
if (hasError) {
|
|
3091
|
+
setItemErrors((prev2) => ({ ...prev2, [id]: errorsForItem }));
|
|
3092
|
+
return item;
|
|
3093
|
+
}
|
|
3094
|
+
setItemErrors((prev2) => {
|
|
3095
|
+
const copy = { ...prev2 };
|
|
3096
|
+
delete copy[id];
|
|
3097
|
+
return copy;
|
|
3098
|
+
});
|
|
3099
|
+
return { ...item, isEditing: false };
|
|
3100
|
+
}
|
|
3101
|
+
return item;
|
|
3102
|
+
});
|
|
3103
|
+
});
|
|
3104
|
+
};
|
|
3105
|
+
const handleCancel = (id) => {
|
|
3106
|
+
const backup = editingBackup[id];
|
|
3107
|
+
if (backup) {
|
|
3108
|
+
setKpiList(
|
|
3109
|
+
(prev) => prev.map(
|
|
3110
|
+
(item) => item.id === id ? { ...backup, isEditing: false } : item
|
|
3111
|
+
)
|
|
3112
|
+
);
|
|
3113
|
+
setEditingBackup((prev) => {
|
|
3114
|
+
const copy = { ...prev };
|
|
3115
|
+
delete copy[id];
|
|
3116
|
+
return copy;
|
|
3117
|
+
});
|
|
3118
|
+
} else {
|
|
3119
|
+
setKpiList(
|
|
3120
|
+
(prev) => prev.map(
|
|
3121
|
+
(item) => item.id === id ? { ...item, isEditing: false } : item
|
|
3122
|
+
)
|
|
3123
|
+
);
|
|
3124
|
+
}
|
|
3125
|
+
};
|
|
3126
|
+
const handleDelete = (id) => {
|
|
3127
|
+
setKpiList((prev) => prev.filter((item) => item.id !== id));
|
|
3128
|
+
};
|
|
3129
|
+
return {
|
|
3130
|
+
handleAddKpi,
|
|
3131
|
+
handleEdit,
|
|
3132
|
+
handleSave,
|
|
3133
|
+
handleCancel,
|
|
3134
|
+
handleDelete,
|
|
3135
|
+
nameKpi,
|
|
3136
|
+
setNameKpi,
|
|
3137
|
+
kpiValue,
|
|
3138
|
+
setKpiValue,
|
|
3139
|
+
unitValue,
|
|
3140
|
+
setUnitValue,
|
|
3141
|
+
kpiList,
|
|
3142
|
+
setKpiList,
|
|
3143
|
+
editingBackup,
|
|
3144
|
+
setEditingBackup,
|
|
3145
|
+
options,
|
|
3146
|
+
selected,
|
|
3147
|
+
setSelected,
|
|
3148
|
+
errors,
|
|
3149
|
+
setErrors,
|
|
3150
|
+
itemErrors,
|
|
3151
|
+
setItemErrors
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
// src/KpiSection/KpiSection.tsx
|
|
3156
|
+
import { IconCheck as IconCheck2, IconCirclePlus, IconPencil, IconTrash as IconTrash3, IconX as IconX2 } from "@tabler/icons-react";
|
|
3157
|
+
import { Fragment as Fragment6, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3158
|
+
function KpiSection({ type, onChangeKpiList }) {
|
|
3159
|
+
const {
|
|
3160
|
+
handleAddKpi,
|
|
3161
|
+
handleEdit,
|
|
3162
|
+
handleSave,
|
|
3163
|
+
handleCancel,
|
|
3164
|
+
handleDelete,
|
|
3165
|
+
nameKpi,
|
|
3166
|
+
setNameKpi,
|
|
3167
|
+
kpiValue,
|
|
3168
|
+
setKpiValue,
|
|
3169
|
+
unitValue,
|
|
3170
|
+
setUnitValue,
|
|
3171
|
+
kpiList,
|
|
3172
|
+
setKpiList,
|
|
3173
|
+
errors,
|
|
3174
|
+
itemErrors,
|
|
3175
|
+
setItemErrors
|
|
3176
|
+
} = useGetKpiSection();
|
|
3177
|
+
const [messageApi2, messageContainer] = message.useMessage();
|
|
3178
|
+
const [hasShownError, setHasShownError] = useState12(false);
|
|
3179
|
+
useEffect3(() => {
|
|
3180
|
+
setMessageApi(messageApi2);
|
|
3181
|
+
}, [messageApi2]);
|
|
3182
|
+
useEffect3(() => {
|
|
3183
|
+
if (onChangeKpiList) {
|
|
3184
|
+
onChangeKpiList(kpiList);
|
|
3185
|
+
}
|
|
3186
|
+
}, [kpiList]);
|
|
3187
|
+
return /* @__PURE__ */ jsx37(
|
|
3188
|
+
ConfigProvider18,
|
|
3189
|
+
{
|
|
3190
|
+
theme: {
|
|
3191
|
+
token: {
|
|
3192
|
+
fontFamily: "Kanit",
|
|
3193
|
+
fontSize: 16
|
|
3194
|
+
}
|
|
3195
|
+
},
|
|
3196
|
+
children: /* @__PURE__ */ jsxs32("div", { className: "container-input", children: [
|
|
3197
|
+
messageContainer,
|
|
3198
|
+
type === "number" && /* @__PURE__ */ jsxs32("div", { className: "space-y-4", children: [
|
|
3199
|
+
/* @__PURE__ */ jsxs32("div", { className: "grid grid-cols-[1fr_200px_200px_50px] w-full gap-[24px] items-start", children: [
|
|
3200
|
+
/* @__PURE__ */ jsx37(
|
|
3201
|
+
InputField,
|
|
3202
|
+
{
|
|
3203
|
+
value: nameKpi,
|
|
3204
|
+
label: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
|
|
3205
|
+
placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
3206
|
+
required: true,
|
|
3207
|
+
onChange: (value) => setNameKpi(value ?? ""),
|
|
3208
|
+
className: "h-[32px]",
|
|
3209
|
+
error: errors.nameKpi
|
|
3210
|
+
}
|
|
3211
|
+
),
|
|
3212
|
+
/* @__PURE__ */ jsx37(
|
|
3213
|
+
InputField,
|
|
3214
|
+
{
|
|
3215
|
+
value: kpiValue,
|
|
3216
|
+
label: "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
|
|
3217
|
+
placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
3218
|
+
required: true,
|
|
3219
|
+
onChange: (value) => {
|
|
3220
|
+
if (value === void 0 || value === "") {
|
|
3221
|
+
setKpiValue("");
|
|
3222
|
+
setHasShownError(false);
|
|
3223
|
+
} else if (/^\d*\.?\d*$/.test(value)) {
|
|
3224
|
+
setKpiValue(value);
|
|
3225
|
+
setHasShownError(false);
|
|
3226
|
+
} else {
|
|
3227
|
+
if (!hasShownError) {
|
|
3228
|
+
messageError("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E40\u0E17\u0E48\u0E32\u0E19\u0E31\u0E49\u0E19");
|
|
3229
|
+
setHasShownError(true);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
},
|
|
3233
|
+
error: errors.kpiValue
|
|
3234
|
+
}
|
|
3235
|
+
),
|
|
3236
|
+
/* @__PURE__ */ jsx37(
|
|
3237
|
+
InputField,
|
|
3238
|
+
{
|
|
3239
|
+
value: unitValue,
|
|
3240
|
+
label: "\u0E2B\u0E19\u0E48\u0E27\u0E22",
|
|
3241
|
+
placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
3242
|
+
required: true,
|
|
3243
|
+
onChange: (value) => setUnitValue(value ?? ""),
|
|
3244
|
+
className: "h-[32px]",
|
|
3245
|
+
error: errors.unitValue
|
|
3246
|
+
}
|
|
3247
|
+
),
|
|
3248
|
+
/* @__PURE__ */ jsx37("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ jsx37(
|
|
3249
|
+
IconCirclePlus,
|
|
3250
|
+
{
|
|
3251
|
+
className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
|
|
3252
|
+
stroke: 1,
|
|
3253
|
+
onClick: () => handleAddKpi(type)
|
|
3254
|
+
}
|
|
3255
|
+
) })
|
|
3256
|
+
] }),
|
|
3257
|
+
/* @__PURE__ */ jsx37("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ jsxs32(
|
|
3258
|
+
"div",
|
|
3259
|
+
{
|
|
3260
|
+
className: "grid grid-cols-[30px_1fr_100px_120px_80px] items-start py-2 body-1 gap-[8px]",
|
|
3261
|
+
children: [
|
|
3262
|
+
/* @__PURE__ */ jsxs32("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
|
|
3263
|
+
index + 1,
|
|
3264
|
+
"."
|
|
3265
|
+
] }),
|
|
3266
|
+
kpi.isEditing ? /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
3267
|
+
/* @__PURE__ */ jsx37(
|
|
3268
|
+
InputField,
|
|
3269
|
+
{
|
|
3270
|
+
value: kpi.name,
|
|
3271
|
+
onChange: (value) => setKpiList(
|
|
3272
|
+
(prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
|
|
3273
|
+
),
|
|
3274
|
+
error: itemErrors[kpi.id]?.name
|
|
3275
|
+
}
|
|
3276
|
+
),
|
|
3277
|
+
/* @__PURE__ */ jsx37(
|
|
3278
|
+
InputField,
|
|
3279
|
+
{
|
|
3280
|
+
value: kpi.value?.toString(),
|
|
3281
|
+
onChange: (value) => {
|
|
3282
|
+
if (value === void 0 || value === "") {
|
|
3283
|
+
setKpiList(
|
|
3284
|
+
(prev) => prev.map((item) => item.id === kpi.id ? { ...item, value: "" } : item)
|
|
3285
|
+
);
|
|
3286
|
+
setHasShownError(false);
|
|
3287
|
+
} else if (/^\d*\.?\d*$/.test(value)) {
|
|
3288
|
+
setKpiList(
|
|
3289
|
+
(prev) => prev.map((item) => item.id === kpi.id ? { ...item, value } : item)
|
|
3290
|
+
);
|
|
3291
|
+
setHasShownError(false);
|
|
3292
|
+
} else {
|
|
3293
|
+
if (!hasShownError) {
|
|
3294
|
+
messageError("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E40\u0E17\u0E48\u0E32\u0E19\u0E31\u0E49\u0E19");
|
|
3295
|
+
setHasShownError(true);
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
},
|
|
3299
|
+
error: itemErrors[kpi.id]?.value
|
|
3300
|
+
}
|
|
3301
|
+
),
|
|
3302
|
+
/* @__PURE__ */ jsx37(
|
|
3303
|
+
InputField,
|
|
3304
|
+
{
|
|
3305
|
+
value: kpi.unit,
|
|
3306
|
+
onChange: (value) => setKpiList(
|
|
3307
|
+
(prev) => prev.map((item) => item.id === kpi.id ? { ...item, unit: value ?? "" } : item)
|
|
3308
|
+
),
|
|
3309
|
+
error: itemErrors[kpi.id]?.unit
|
|
3310
|
+
}
|
|
3311
|
+
),
|
|
3312
|
+
/* @__PURE__ */ jsxs32(
|
|
3313
|
+
"div",
|
|
3314
|
+
{
|
|
3315
|
+
className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.value || !!itemErrors[kpi.id]?.unit || !!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
|
|
3316
|
+
children: [
|
|
3317
|
+
/* @__PURE__ */ jsx37(
|
|
3318
|
+
IconCheck2,
|
|
3319
|
+
{
|
|
3320
|
+
className: "w-[30px] h-[30px] cursor-pointer",
|
|
3321
|
+
onClick: () => handleSave(kpi.id, type)
|
|
3322
|
+
}
|
|
3323
|
+
),
|
|
3324
|
+
/* @__PURE__ */ jsx37(IconX2, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
|
|
3325
|
+
]
|
|
3326
|
+
}
|
|
3327
|
+
)
|
|
3328
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
3329
|
+
/* @__PURE__ */ jsx37("p", { className: "body-1", children: kpi.name }),
|
|
3330
|
+
/* @__PURE__ */ jsx37("p", { className: "body-1", children: kpi.value }),
|
|
3331
|
+
/* @__PURE__ */ jsx37("p", { className: "body-1", children: kpi.unit }),
|
|
3332
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex gap-3 justify-end", children: [
|
|
3333
|
+
/* @__PURE__ */ jsx37(IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
|
|
3334
|
+
/* @__PURE__ */ jsx37(IconTrash3, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
|
|
3335
|
+
] })
|
|
3336
|
+
] })
|
|
3337
|
+
]
|
|
3338
|
+
},
|
|
3339
|
+
kpi.id
|
|
3340
|
+
)) })
|
|
3341
|
+
] }),
|
|
3342
|
+
type === "text" && /* @__PURE__ */ jsxs32("div", { className: "space-y-4", children: [
|
|
3343
|
+
/* @__PURE__ */ jsxs32("div", { className: "grid grid-cols-[1fr_50px] w-full gap-[24px] items-start", children: [
|
|
3344
|
+
/* @__PURE__ */ jsx37(
|
|
3345
|
+
InputField,
|
|
3346
|
+
{
|
|
3347
|
+
value: nameKpi,
|
|
3348
|
+
label: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
|
|
3349
|
+
placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
|
|
3350
|
+
required: true,
|
|
3351
|
+
onChange: (value) => setNameKpi(value ?? ""),
|
|
3352
|
+
className: "h-[32px]",
|
|
3353
|
+
error: errors.nameKpi
|
|
3354
|
+
}
|
|
3355
|
+
),
|
|
3356
|
+
/* @__PURE__ */ jsx37("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ jsx37(
|
|
3357
|
+
IconCirclePlus,
|
|
3358
|
+
{
|
|
3359
|
+
className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
|
|
3360
|
+
stroke: 1,
|
|
3361
|
+
onClick: () => handleAddKpi(type)
|
|
3362
|
+
}
|
|
3363
|
+
) })
|
|
3364
|
+
] }),
|
|
3365
|
+
/* @__PURE__ */ jsx37("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ jsxs32("div", { className: "grid grid-cols-[30px_1fr_80px] items-start py-2 body-1 gap-[8px]", children: [
|
|
3366
|
+
/* @__PURE__ */ jsxs32("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
|
|
3367
|
+
index + 1,
|
|
3368
|
+
"."
|
|
3369
|
+
] }),
|
|
3370
|
+
kpi.isEditing ? /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
3371
|
+
/* @__PURE__ */ jsx37(
|
|
3372
|
+
InputField,
|
|
3373
|
+
{
|
|
3374
|
+
value: kpi.name,
|
|
3375
|
+
onChange: (value) => setKpiList(
|
|
3376
|
+
(prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
|
|
3377
|
+
),
|
|
3378
|
+
error: itemErrors[kpi.id]?.name
|
|
3379
|
+
}
|
|
3380
|
+
),
|
|
3381
|
+
/* @__PURE__ */ jsxs32(
|
|
3382
|
+
"div",
|
|
3383
|
+
{
|
|
3384
|
+
className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
|
|
3385
|
+
children: [
|
|
3386
|
+
/* @__PURE__ */ jsx37(
|
|
3387
|
+
IconCheck2,
|
|
3388
|
+
{
|
|
3389
|
+
className: "w-[30px] h-[30px] cursor-pointer",
|
|
3390
|
+
onClick: () => handleSave(kpi.id, type)
|
|
3391
|
+
}
|
|
3392
|
+
),
|
|
3393
|
+
/* @__PURE__ */ jsx37(IconX2, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
|
|
3394
|
+
]
|
|
3395
|
+
}
|
|
3396
|
+
)
|
|
3397
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
3398
|
+
/* @__PURE__ */ jsx37("p", { className: "body-1", children: kpi.name }),
|
|
3399
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex gap-3 justify-end", children: [
|
|
3400
|
+
/* @__PURE__ */ jsx37(IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
|
|
3401
|
+
/* @__PURE__ */ jsx37(IconTrash3, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
|
|
3402
|
+
] })
|
|
3403
|
+
] })
|
|
3404
|
+
] }, kpi.id)) })
|
|
3405
|
+
] })
|
|
3406
|
+
] })
|
|
3407
|
+
}
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
// src/Modal/Modal/Modal.tsx
|
|
3412
|
+
import { Modal } from "antd";
|
|
3413
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3414
|
+
function AntDModal({ children, isOpen, width, onCancel }) {
|
|
3415
|
+
return /* @__PURE__ */ jsx38("div", { children: /* @__PURE__ */ jsx38(Modal, { open: isOpen, onCancel, width, centered: true, footer: null, children: /* @__PURE__ */ jsx38("div", { children }) }) });
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
// src/Indicator/Indicator/Indicator.tsx
|
|
3419
|
+
import { IconCheck as IconCheck3, IconCirclePlus as IconCirclePlus2, IconPencil as IconPencil2, IconTrash as IconTrash4, IconX as IconX3 } from "@tabler/icons-react";
|
|
3420
|
+
import { useState as useState13 } from "react";
|
|
3421
|
+
import { Input as Input4 } from "antd";
|
|
3422
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3423
|
+
function Indicator({
|
|
3424
|
+
option = [
|
|
3425
|
+
{ value: "TEXT", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
|
|
3426
|
+
{ value: "NUMBER", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
|
|
3427
|
+
],
|
|
3428
|
+
type,
|
|
3429
|
+
arrayData,
|
|
3430
|
+
setArrayData
|
|
3431
|
+
}) {
|
|
3432
|
+
const [valueSwitch, setValueSwitch] = useState13("TEXT");
|
|
3433
|
+
const [cacheData, setCacheData] = useState13({
|
|
3434
|
+
indicatorType: type,
|
|
3435
|
+
inputType: valueSwitch,
|
|
3436
|
+
textValue: "",
|
|
3437
|
+
numberValue: "",
|
|
3438
|
+
unit: ""
|
|
3439
|
+
});
|
|
3440
|
+
const [cacheEditData, setCacheEditData] = useState13({
|
|
3441
|
+
indicatorType: type,
|
|
3442
|
+
inputType: valueSwitch,
|
|
3443
|
+
textValue: "",
|
|
3444
|
+
numberValue: "",
|
|
3445
|
+
unit: ""
|
|
3446
|
+
});
|
|
3447
|
+
const [editIndex, setEditIndex] = useState13(null);
|
|
3448
|
+
const handleAddIndicator = () => {
|
|
3449
|
+
if (cacheData.textValue.trim() === "") return;
|
|
3450
|
+
setArrayData([
|
|
3451
|
+
...arrayData,
|
|
3452
|
+
valueSwitch === "TEXT" ? {
|
|
3453
|
+
indicatorType: type,
|
|
3454
|
+
inputType: "TEXT",
|
|
3455
|
+
textValue: cacheData.textValue
|
|
3456
|
+
} : cacheData
|
|
3457
|
+
]);
|
|
3458
|
+
setCacheData({
|
|
3459
|
+
indicatorType: type,
|
|
3460
|
+
inputType: valueSwitch,
|
|
3461
|
+
textValue: "",
|
|
3462
|
+
numberValue: "",
|
|
3463
|
+
unit: ""
|
|
3464
|
+
});
|
|
3465
|
+
};
|
|
3466
|
+
const handleChangeCashData = (key, value) => {
|
|
3467
|
+
setCacheData((prev) => ({
|
|
3468
|
+
...prev,
|
|
3469
|
+
[key]: value
|
|
3470
|
+
}));
|
|
3471
|
+
console.log(cacheData);
|
|
3472
|
+
};
|
|
3473
|
+
const handleClick = (active) => {
|
|
3474
|
+
handleChangeCashData("inputType", active);
|
|
3475
|
+
setValueSwitch(active);
|
|
3476
|
+
};
|
|
3477
|
+
const handleDeleteIndicator = (index) => {
|
|
3478
|
+
const newData = arrayData.filter((_, i) => i !== index);
|
|
3479
|
+
setArrayData(newData);
|
|
3480
|
+
setEditIndex(null);
|
|
3481
|
+
};
|
|
3482
|
+
const handleEditIndicator = (index) => {
|
|
3483
|
+
setCacheEditData(arrayData[index]);
|
|
3484
|
+
setEditIndex(index);
|
|
3485
|
+
};
|
|
3486
|
+
const handleCancelEditIndicator = () => {
|
|
3487
|
+
setEditIndex(null);
|
|
3488
|
+
};
|
|
3489
|
+
const handleConfirmEditIndicator = (index) => {
|
|
3490
|
+
if (cacheEditData.textValue.trim() === "") return;
|
|
3491
|
+
const newData = [...arrayData];
|
|
3492
|
+
newData[index] = cacheEditData;
|
|
3493
|
+
setArrayData(newData);
|
|
3494
|
+
setEditIndex(null);
|
|
3495
|
+
};
|
|
3496
|
+
const handleChangeEditCashData = (e) => {
|
|
3497
|
+
const { name, value } = e.target;
|
|
3498
|
+
setCacheEditData((prev) => ({
|
|
3499
|
+
...prev,
|
|
3500
|
+
[name]: value
|
|
3501
|
+
}));
|
|
3502
|
+
console.log(cacheEditData);
|
|
3503
|
+
};
|
|
3504
|
+
return /* @__PURE__ */ jsxs33("div", { className: "w-full", children: [
|
|
3505
|
+
/* @__PURE__ */ jsxs33(
|
|
3506
|
+
"div",
|
|
3507
|
+
{
|
|
3508
|
+
className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
|
|
3509
|
+
children: [
|
|
3510
|
+
/* @__PURE__ */ jsx39(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
|
|
3511
|
+
/* @__PURE__ */ jsx39(
|
|
3512
|
+
InputField,
|
|
3513
|
+
{
|
|
3514
|
+
label: `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
3515
|
+
value: cacheData.textValue,
|
|
3516
|
+
className: "h-[32px]",
|
|
3517
|
+
onChange: (e) => handleChangeCashData("textValue", String(e)),
|
|
3518
|
+
placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
3519
|
+
required: true
|
|
3520
|
+
}
|
|
3521
|
+
),
|
|
3522
|
+
valueSwitch === "NUMBER" && /* @__PURE__ */ jsxs33(Fragment7, { children: [
|
|
3523
|
+
/* @__PURE__ */ jsx39(
|
|
3524
|
+
InputFieldNumber,
|
|
3525
|
+
{
|
|
3526
|
+
label: `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
3527
|
+
value: cacheData.numberValue ?? "",
|
|
3528
|
+
className: "h-[32px]",
|
|
3529
|
+
onChange: (e) => handleChangeCashData("numberValue", String(e)),
|
|
3530
|
+
placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
|
|
3531
|
+
required: true
|
|
3532
|
+
}
|
|
3533
|
+
),
|
|
3534
|
+
/* @__PURE__ */ jsx39(
|
|
3535
|
+
InputField,
|
|
3536
|
+
{
|
|
3537
|
+
label: `\u0E2B\u0E19\u0E48\u0E27\u0E22`,
|
|
3538
|
+
value: cacheData.unit ?? "",
|
|
3539
|
+
className: "h-[32px]",
|
|
3540
|
+
onChange: (e) => handleChangeCashData("unit", String(e)),
|
|
3541
|
+
placeholder: "\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22",
|
|
3542
|
+
required: true
|
|
3543
|
+
}
|
|
3544
|
+
)
|
|
3545
|
+
] }),
|
|
3546
|
+
/* @__PURE__ */ jsx39(IconCirclePlus2, { onClick: handleAddIndicator, className: "mt-7 cursor-pointer", size: 32 })
|
|
3547
|
+
]
|
|
3548
|
+
}
|
|
3549
|
+
),
|
|
3550
|
+
/* @__PURE__ */ jsx39(Fragment7, { children: arrayData.map((item, index) => /* @__PURE__ */ jsxs33(
|
|
3551
|
+
"div",
|
|
3552
|
+
{
|
|
3553
|
+
className: `space-y-4 grid ${item.inputType === "TEXT" ? `grid-cols-[140px_1fr_50px_50px]` : `grid-cols-[140px_1fr_200px_150px_50px_50px]`} items-start`,
|
|
3554
|
+
children: [
|
|
3555
|
+
/* @__PURE__ */ jsx39("div", { className: "body-1 mt-2", children: item.inputType === "TEXT" ? "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }),
|
|
3556
|
+
index === editIndex ? /* @__PURE__ */ jsx39(
|
|
3557
|
+
Input4,
|
|
3558
|
+
{
|
|
3559
|
+
className: "body-1 mt-2",
|
|
3560
|
+
variant: "underlined",
|
|
3561
|
+
value: cacheEditData.textValue,
|
|
3562
|
+
name: "textValue",
|
|
3563
|
+
onChange: (e) => handleChangeEditCashData(e)
|
|
3564
|
+
}
|
|
3565
|
+
) : /* @__PURE__ */ jsx39("div", { className: "body-1 mt-2", children: item.textValue }),
|
|
3566
|
+
item.inputType === "NUMBER" && /* @__PURE__ */ jsxs33(Fragment7, { children: [
|
|
3567
|
+
index === editIndex ? /* @__PURE__ */ jsx39(
|
|
3568
|
+
Input4,
|
|
3569
|
+
{
|
|
3570
|
+
className: "body-1 mt-2",
|
|
3571
|
+
variant: "underlined",
|
|
3572
|
+
value: cacheEditData.numberValue,
|
|
3573
|
+
name: "numberValue",
|
|
3574
|
+
onChange: (e) => handleChangeEditCashData(e)
|
|
3575
|
+
}
|
|
3576
|
+
) : /* @__PURE__ */ jsx39("div", { className: "body-1 mt-2", children: item.numberValue }),
|
|
3577
|
+
index === editIndex ? /* @__PURE__ */ jsx39(
|
|
3578
|
+
Input4,
|
|
3579
|
+
{
|
|
3580
|
+
className: "body-1 mt-2",
|
|
3581
|
+
variant: "underlined",
|
|
3582
|
+
value: cacheEditData.unit,
|
|
3583
|
+
name: "unit",
|
|
3584
|
+
onChange: (e) => handleChangeEditCashData(e)
|
|
3585
|
+
}
|
|
3586
|
+
) : /* @__PURE__ */ jsx39("div", { className: "body-1 mt-2", children: item.unit })
|
|
3587
|
+
] }),
|
|
3588
|
+
/* @__PURE__ */ jsx39("div", { className: "body-1 mt-2 flex", children: editIndex !== null ? editIndex === index ? /* @__PURE__ */ jsxs33("div", { className: "flex", children: [
|
|
3589
|
+
/* @__PURE__ */ jsx39(
|
|
3590
|
+
IconCheck3,
|
|
3591
|
+
{
|
|
3592
|
+
className: "cursor-pointer text-green-600",
|
|
3593
|
+
onClick: () => handleConfirmEditIndicator(index)
|
|
3594
|
+
}
|
|
3595
|
+
),
|
|
3596
|
+
/* @__PURE__ */ jsx39(IconX3, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
|
|
3597
|
+
] }) : void 0 : /* @__PURE__ */ jsx39(IconPencil2, { className: "cursor-pointer", onClick: () => handleEditIndicator(index) }) }),
|
|
3598
|
+
/* @__PURE__ */ jsx39("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ jsx39(IconTrash4, { onClick: () => handleDeleteIndicator(index) }) })
|
|
3599
|
+
]
|
|
3600
|
+
}
|
|
3601
|
+
)) })
|
|
3602
|
+
] });
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
// src/FilterPopUp/FilterPopUp.tsx
|
|
3606
|
+
import { IconCheck as IconCheck4, IconFilter as IconFilter2, IconTrash as IconTrash5 } from "@tabler/icons-react";
|
|
3607
|
+
import { useState as useState14 } from "react";
|
|
3608
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3609
|
+
var FilterPopUp = (filter) => {
|
|
3610
|
+
const [isAction, setIsAction] = useState14(true);
|
|
3611
|
+
const [filterArray, setFilterArray] = useState14([""]);
|
|
3612
|
+
const handleClearFilter = () => {
|
|
3613
|
+
setFilterArray([]);
|
|
3614
|
+
};
|
|
3615
|
+
const handleSubmitFilter = () => {
|
|
3616
|
+
filter.handleSearch(filterArray);
|
|
3617
|
+
};
|
|
3618
|
+
return /* @__PURE__ */ jsxs34("div", { className: "relative", children: [
|
|
3619
|
+
/* @__PURE__ */ jsxs34("button", { className: "flex px-2 py-1 rounded-lg border-1", onClick: () => setIsAction(!isAction), children: [
|
|
3620
|
+
/* @__PURE__ */ jsx40(IconFilter2, {}),
|
|
3621
|
+
"filter"
|
|
3622
|
+
] }),
|
|
3623
|
+
isAction ? /* @__PURE__ */ jsxs34("div", { className: "absolute bg-white p-5 rounded-lg shadow-2xl w-[600px]", children: [
|
|
3624
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex justify-end", children: [
|
|
3625
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex justify-end text-nowrap gap-2", children: [
|
|
3626
|
+
/* @__PURE__ */ jsx40(GhostButton, { title: "\u0E43\u0E0A\u0E49\u0E1F\u0E34\u0E25\u0E40\u0E15\u0E2D\u0E23\u0E4C", onClick: handleSubmitFilter, iconLeft: /* @__PURE__ */ jsx40(IconCheck4, {}) }),
|
|
3627
|
+
/* @__PURE__ */ jsx40(GhostButton, { title: "\u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14", onClick: handleClearFilter, iconLeft: /* @__PURE__ */ jsx40(IconTrash5, {}) })
|
|
3628
|
+
] }),
|
|
3629
|
+
""
|
|
3630
|
+
] }),
|
|
3631
|
+
/* @__PURE__ */ jsx40(
|
|
3632
|
+
SelectCustom,
|
|
3633
|
+
{
|
|
3634
|
+
options: filter.selectionFilter,
|
|
3635
|
+
onChange: (list) => setFilterArray(list),
|
|
3636
|
+
label: "\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01"
|
|
3637
|
+
}
|
|
3638
|
+
)
|
|
3639
|
+
] }) : void 0
|
|
3640
|
+
] });
|
|
3641
|
+
};
|
|
3642
|
+
export {
|
|
3643
|
+
AntDModal,
|
|
3644
|
+
AntDataTable,
|
|
3645
|
+
Breadcrumbs,
|
|
3646
|
+
Calendar,
|
|
3647
|
+
Checkbox,
|
|
3648
|
+
CheckboxGroup,
|
|
3649
|
+
ColorPalettePickerBasic,
|
|
3650
|
+
ColorPickerBasic,
|
|
3651
|
+
DataTable,
|
|
3652
|
+
DatePickerBasic,
|
|
3653
|
+
FileUploader,
|
|
3654
|
+
FilterPopUp,
|
|
3655
|
+
GhostButton,
|
|
3656
|
+
HeadingPage,
|
|
3657
|
+
Indicator,
|
|
3658
|
+
InputField,
|
|
3659
|
+
InputFieldNumber,
|
|
3660
|
+
KpiSection,
|
|
3661
|
+
Loader,
|
|
3662
|
+
MenuNavBar,
|
|
3663
|
+
PrimaryButton,
|
|
3664
|
+
ProgressBar,
|
|
3665
|
+
Radio,
|
|
3666
|
+
RadioGroup,
|
|
3667
|
+
SecondaryButton,
|
|
3668
|
+
SelectCustom,
|
|
3669
|
+
SelectField,
|
|
3670
|
+
SelectFieldGroup,
|
|
3671
|
+
SelectFieldStatus,
|
|
3672
|
+
SelectFieldStatusReport,
|
|
3673
|
+
SelectFieldTag,
|
|
3674
|
+
Sidebar,
|
|
3675
|
+
SortFilter,
|
|
3676
|
+
Switch,
|
|
3677
|
+
SwitchSelect,
|
|
3678
|
+
TabSelectionButton,
|
|
3679
|
+
TextAreaInput,
|
|
3680
|
+
TextInput,
|
|
3681
|
+
TopNavBar,
|
|
3682
|
+
messageError,
|
|
3683
|
+
messageInfo,
|
|
3684
|
+
messageLoading,
|
|
3685
|
+
messageSuccess,
|
|
3686
|
+
messageWarning,
|
|
3687
|
+
setMessageApi
|
|
3688
|
+
};
|