@mamrp/components 1.4.10 → 1.4.11
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 +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +104 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1239,8 +1239,7 @@ var JalaliDatePicker = ({
|
|
|
1239
1239
|
maxDate,
|
|
1240
1240
|
minDate,
|
|
1241
1241
|
clear = true,
|
|
1242
|
-
views
|
|
1243
|
-
showArrows = false
|
|
1242
|
+
views
|
|
1244
1243
|
}) => {
|
|
1245
1244
|
const today = (0, import_moment_jalaali.default)();
|
|
1246
1245
|
const customLocaleText = {
|
|
@@ -1251,7 +1250,21 @@ var JalaliDatePicker = ({
|
|
|
1251
1250
|
start: "\u0634\u0631\u0648\u0639",
|
|
1252
1251
|
end: "\u067E\u0627\u06CC\u0627\u0646",
|
|
1253
1252
|
previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
|
|
1254
|
-
nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F"
|
|
1253
|
+
nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
|
|
1254
|
+
openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
|
|
1255
|
+
openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
|
|
1256
|
+
selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
|
|
1257
|
+
selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
|
|
1258
|
+
datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
|
|
1259
|
+
timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
|
|
1260
|
+
dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
|
|
1261
|
+
hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
|
|
1262
|
+
minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
|
|
1263
|
+
secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
|
|
1264
|
+
calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
|
|
1265
|
+
calendarWeekNumberHeaderText: "#",
|
|
1266
|
+
calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
|
|
1267
|
+
calendarWeekNumberText: (weekNumber) => `${weekNumber}`
|
|
1255
1268
|
};
|
|
1256
1269
|
return /* @__PURE__ */ import_react7.default.createElement(
|
|
1257
1270
|
import_x_date_pickers.LocalizationProvider,
|
|
@@ -1270,8 +1283,9 @@ var JalaliDatePicker = ({
|
|
|
1270
1283
|
e.stopPropagation();
|
|
1271
1284
|
const currentValue = field.value ? (0, import_moment_jalaali.default)(field.value) : (0, import_moment_jalaali.default)();
|
|
1272
1285
|
const previousDate = currentValue.clone().subtract(1, "day");
|
|
1273
|
-
if (minDate && previousDate.isBefore((0, import_moment_jalaali.default)(minDate), "day"))
|
|
1286
|
+
if (minDate && previousDate.isBefore((0, import_moment_jalaali.default)(minDate), "day")) {
|
|
1274
1287
|
return;
|
|
1288
|
+
}
|
|
1275
1289
|
const nowUTC3 = /* @__PURE__ */ new Date();
|
|
1276
1290
|
const iranHour = nowUTC3.getUTCHours();
|
|
1277
1291
|
const iranMinute = nowUTC3.getUTCMinutes();
|
|
@@ -1283,7 +1297,9 @@ var JalaliDatePicker = ({
|
|
|
1283
1297
|
const currentValue = field.value ? (0, import_moment_jalaali.default)(field.value) : (0, import_moment_jalaali.default)();
|
|
1284
1298
|
const nextDate = currentValue.clone().add(1, "day");
|
|
1285
1299
|
const maxDateValue = maxDate ? maxDate : today;
|
|
1286
|
-
if (nextDate.isAfter((0, import_moment_jalaali.default)(maxDateValue), "day"))
|
|
1300
|
+
if (nextDate.isAfter((0, import_moment_jalaali.default)(maxDateValue), "day")) {
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1287
1303
|
const nowUTC3 = /* @__PURE__ */ new Date();
|
|
1288
1304
|
const iranHour = nowUTC3.getUTCHours();
|
|
1289
1305
|
const iranMinute = nowUTC3.getUTCMinutes();
|
|
@@ -1304,6 +1320,22 @@ var JalaliDatePicker = ({
|
|
|
1304
1320
|
value: field.value ? (0, import_moment_jalaali.default)(field.value) : null,
|
|
1305
1321
|
slotProps: {
|
|
1306
1322
|
...clear && !disabled ? { field: { clearable: true } } : {},
|
|
1323
|
+
popper: {
|
|
1324
|
+
modifiers: [
|
|
1325
|
+
{
|
|
1326
|
+
name: "preventOverflow",
|
|
1327
|
+
options: {
|
|
1328
|
+
boundary: "window"
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
name: "flip",
|
|
1333
|
+
options: {
|
|
1334
|
+
fallbackPlacements: ["right", "left", "top"]
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
]
|
|
1338
|
+
},
|
|
1307
1339
|
textField: {
|
|
1308
1340
|
size,
|
|
1309
1341
|
placeholder: field.value || isLoading ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ",
|
|
@@ -1317,7 +1349,7 @@ var JalaliDatePicker = ({
|
|
|
1317
1349
|
style: { cursor: "pointer" }
|
|
1318
1350
|
},
|
|
1319
1351
|
InputProps: {
|
|
1320
|
-
startAdornment:
|
|
1352
|
+
startAdornment: !isLoading && /* @__PURE__ */ import_react7.default.createElement(
|
|
1321
1353
|
import_material9.Box,
|
|
1322
1354
|
{
|
|
1323
1355
|
sx: {
|
|
@@ -1332,12 +1364,14 @@ var JalaliDatePicker = ({
|
|
|
1332
1364
|
{
|
|
1333
1365
|
onClick: handlePreviousDate,
|
|
1334
1366
|
disabled: isLoading || disabled,
|
|
1335
|
-
sx: {
|
|
1367
|
+
sx: {
|
|
1368
|
+
padding: "2px"
|
|
1369
|
+
}
|
|
1336
1370
|
},
|
|
1337
1371
|
/* @__PURE__ */ import_react7.default.createElement(import_md3.MdChevronRight, { size: 26 })
|
|
1338
1372
|
))
|
|
1339
|
-
)
|
|
1340
|
-
endAdornment: isLoading ? /* @__PURE__ */ import_react7.default.createElement(import_CircularProgress.default, { color: "secondary", size: 20 }) :
|
|
1373
|
+
),
|
|
1374
|
+
endAdornment: isLoading ? /* @__PURE__ */ import_react7.default.createElement(import_CircularProgress.default, { color: "secondary", size: 20 }) : disabled ? null : /* @__PURE__ */ import_react7.default.createElement(
|
|
1341
1375
|
import_material9.Box,
|
|
1342
1376
|
{
|
|
1343
1377
|
sx: { display: "flex", alignItems: "center", ml: 1 }
|
|
@@ -1347,11 +1381,13 @@ var JalaliDatePicker = ({
|
|
|
1347
1381
|
{
|
|
1348
1382
|
onClick: handleNextDate,
|
|
1349
1383
|
disabled: isLoading || disabled,
|
|
1350
|
-
sx: {
|
|
1384
|
+
sx: {
|
|
1385
|
+
padding: "2px"
|
|
1386
|
+
}
|
|
1351
1387
|
},
|
|
1352
1388
|
/* @__PURE__ */ import_react7.default.createElement(import_md3.MdChevronLeft, { size: 26 })
|
|
1353
1389
|
))
|
|
1354
|
-
)
|
|
1390
|
+
),
|
|
1355
1391
|
...field.value && {
|
|
1356
1392
|
value: persian ? `${(0, import_moment_jalaali.default)(field.value).format(
|
|
1357
1393
|
"dddd - jDD/jMMMM/jYYYY"
|
|
@@ -1365,17 +1401,22 @@ var JalaliDatePicker = ({
|
|
|
1365
1401
|
}
|
|
1366
1402
|
}
|
|
1367
1403
|
}
|
|
1404
|
+
},
|
|
1405
|
+
actionBar: {
|
|
1406
|
+
actions: ["cancel", "accept"]
|
|
1368
1407
|
}
|
|
1369
1408
|
},
|
|
1370
1409
|
onChange: (value) => {
|
|
1371
|
-
if (value == null)
|
|
1410
|
+
if (value == null) {
|
|
1411
|
+
field.onChange(null);
|
|
1412
|
+
}
|
|
1372
1413
|
},
|
|
1373
1414
|
onAccept: (newValue) => {
|
|
1374
1415
|
if (newValue) {
|
|
1375
1416
|
const currentDate = (0, import_dayjs.default)(newValue);
|
|
1376
1417
|
const nowUTC3 = /* @__PURE__ */ new Date();
|
|
1377
|
-
|
|
1378
|
-
|
|
1418
|
+
let iranHour = nowUTC3.getUTCHours();
|
|
1419
|
+
let iranMinute = nowUTC3.getUTCMinutes();
|
|
1379
1420
|
const dateTimeWithIranTime4 = currentDate.hour(iranHour).minute(iranMinute).second(nowUTC3.getUTCSeconds());
|
|
1380
1421
|
field.onChange(
|
|
1381
1422
|
dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
|
|
@@ -1386,13 +1427,61 @@ var JalaliDatePicker = ({
|
|
|
1386
1427
|
},
|
|
1387
1428
|
sx: {
|
|
1388
1429
|
width: "100%",
|
|
1430
|
+
borderColor: error ? "#D32F2F" : "#C4C4C4",
|
|
1389
1431
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
1390
1432
|
borderColor: error ? "#D32F2F" : "#C4C4C4"
|
|
1391
1433
|
},
|
|
1392
1434
|
"& .MuiInputBase-root": {
|
|
1393
1435
|
height: size === "small" ? 40 : 56
|
|
1394
1436
|
}
|
|
1395
|
-
}
|
|
1437
|
+
},
|
|
1438
|
+
slots: {
|
|
1439
|
+
...!clear && {
|
|
1440
|
+
clearButton: import_react7.default.Fragment,
|
|
1441
|
+
clearIcon: import_react7.default.Fragment
|
|
1442
|
+
},
|
|
1443
|
+
toolbar: () => {
|
|
1444
|
+
const currentDate = (0, import_moment_jalaali.default)(field.value);
|
|
1445
|
+
const formattedDate = currentDate.format("dddd, jDD jMMMM");
|
|
1446
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
1447
|
+
import_material9.Box,
|
|
1448
|
+
{
|
|
1449
|
+
sx: {
|
|
1450
|
+
my: 2,
|
|
1451
|
+
mx: 4
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
/* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { variant: "overline", color: "primary" }, "\u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F"),
|
|
1455
|
+
/* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { variant: "h4" }, formattedDate == "Invalid date" ? "" : formattedDate)
|
|
1456
|
+
);
|
|
1457
|
+
},
|
|
1458
|
+
monthButton: (props) => {
|
|
1459
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
1460
|
+
"button",
|
|
1461
|
+
{
|
|
1462
|
+
className: `${props.className}`,
|
|
1463
|
+
style: {
|
|
1464
|
+
width: "80%",
|
|
1465
|
+
padding: "10px",
|
|
1466
|
+
marginBottom: "20px",
|
|
1467
|
+
border: "1px solid #ccc",
|
|
1468
|
+
borderRadius: "12px",
|
|
1469
|
+
backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
|
|
1470
|
+
fontSize: "14px",
|
|
1471
|
+
cursor: props.disabled ? "default" : "pointer"
|
|
1472
|
+
},
|
|
1473
|
+
disabled: props.disabled,
|
|
1474
|
+
onFocus: props.onFocus,
|
|
1475
|
+
onBlur: props.onBlur,
|
|
1476
|
+
onClick: props.onClick,
|
|
1477
|
+
ref: props.ref
|
|
1478
|
+
},
|
|
1479
|
+
props["aria-label"]
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
minDate: minDate ? minDate : null,
|
|
1484
|
+
maxDate: maxDate ? maxDate : today
|
|
1396
1485
|
}
|
|
1397
1486
|
), error && /* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message));
|
|
1398
1487
|
}
|