react-ui89 0.61.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/Ui89DateTimePicker.d.ts +0 -1
- package/dist/esm/components/Ui89DateTimePicker.stories.d.ts +5 -0
- package/dist/esm/components/Ui89InputNumber.d.ts +1 -0
- package/dist/esm/components/Ui89InputText.d.ts +1 -0
- package/dist/esm/components/Ui89InputText.stories.d.ts +1 -0
- package/dist/esm/components/Ui89InputTextNumber.d.ts +1 -0
- package/dist/esm/components/Ui89ModalDialog.d.ts +2 -1
- package/dist/esm/components/Ui89ModalDialog.stories.d.ts +3 -0
- package/dist/esm/components/Ui89Popover.d.ts +6 -2
- package/dist/esm/date-utils.d.ts +1 -0
- package/dist/esm/date-utils.test.d.ts +1 -0
- package/dist/esm/index.css +5 -6
- package/dist/esm/index.js +742 -522
- package/dist/esm/index.js.map +1 -1
- package/package.json +5 -4
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { createContext, useState, useContext, useEffect, useRef,
|
|
2
|
+
import React__default, { createContext, useState, useContext, useEffect, useRef, useImperativeHandle, useMemo, useCallback } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import DatePicker from 'react-datepicker';
|
|
5
|
-
import Timeout from 'smart-timeout';
|
|
6
4
|
import { useFloating, size, autoUpdate, useClick, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
|
|
5
|
+
import Timeout from 'smart-timeout';
|
|
7
6
|
import { toast, ToastContainer } from 'react-toastify';
|
|
8
7
|
|
|
9
8
|
var Ui89Theme;
|
|
@@ -208,33 +207,123 @@ function Ui89CardHorizontalConnection({ children, overflow, }) {
|
|
|
208
207
|
return (React__default.createElement("div", { className: `ui89-card__horizontal-connection ${overflow ? "ui89-card__horizontal-connection--overflow" : ""}` }, children));
|
|
209
208
|
}
|
|
210
209
|
|
|
211
|
-
function
|
|
212
|
-
|
|
213
|
-
if (props.onChange) {
|
|
214
|
-
props.onChange(value);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return (React__default.createElement("span", { className: "ui89-date-time-picker" },
|
|
218
|
-
React__default.createElement(DatePicker, { className: ["ui89-input-box"].join(" "), calendarClassName: "ui89-typo-normal", showTimeSelect: true, dateFormat: props.dateFormat ?? "yyyy/MM/dd HH:mm:ss", timeFormat: "HH:mm", selected: props.value, onChange: datepickerOnChange, popperPlacement: "bottom-start" })));
|
|
210
|
+
function Ui89Scene({ look = Ui89Look.main, children }) {
|
|
211
|
+
return (React__default.createElement("div", { className: `ui89-scene ui-89-look-${look} ui89-typo-normal ui89-scrollbar` }, children));
|
|
219
212
|
}
|
|
220
213
|
|
|
221
|
-
|
|
222
|
-
const
|
|
214
|
+
function useZIndexer(open) {
|
|
215
|
+
const overrides = useUi89();
|
|
216
|
+
const [value, setValue] = useState(overrides.currentZIndex);
|
|
223
217
|
useEffect(() => {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
218
|
+
if (open) {
|
|
219
|
+
setValue(overrides.nextZIndex());
|
|
220
|
+
}
|
|
221
|
+
}, [open]);
|
|
222
|
+
return {
|
|
223
|
+
value,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
var Ui89PopoverPropsPlacement;
|
|
228
|
+
(function (Ui89PopoverPropsPlacement) {
|
|
229
|
+
Ui89PopoverPropsPlacement["top"] = "top";
|
|
230
|
+
Ui89PopoverPropsPlacement["topStart"] = "topStart";
|
|
231
|
+
Ui89PopoverPropsPlacement["topEnd"] = "topEnd";
|
|
232
|
+
Ui89PopoverPropsPlacement["right"] = "right";
|
|
233
|
+
Ui89PopoverPropsPlacement["rightStart"] = "rightStart";
|
|
234
|
+
Ui89PopoverPropsPlacement["rightEnd"] = "rightEnd";
|
|
235
|
+
Ui89PopoverPropsPlacement["bottom"] = "bottom";
|
|
236
|
+
Ui89PopoverPropsPlacement["bottomStart"] = "bottomStart";
|
|
237
|
+
Ui89PopoverPropsPlacement["bottomEnd"] = "bottomEnd";
|
|
238
|
+
Ui89PopoverPropsPlacement["left"] = "left";
|
|
239
|
+
Ui89PopoverPropsPlacement["leftStart"] = "leftStart";
|
|
240
|
+
Ui89PopoverPropsPlacement["leftEnd"] = "leftEnd";
|
|
241
|
+
})(Ui89PopoverPropsPlacement || (Ui89PopoverPropsPlacement = {}));
|
|
242
|
+
function toFloatingUiPlacement(placement) {
|
|
243
|
+
switch (placement) {
|
|
244
|
+
case Ui89PopoverPropsPlacement.top:
|
|
245
|
+
return "top";
|
|
246
|
+
case Ui89PopoverPropsPlacement.topStart:
|
|
247
|
+
return "top-start";
|
|
248
|
+
case Ui89PopoverPropsPlacement.topEnd:
|
|
249
|
+
return "top-end";
|
|
250
|
+
case Ui89PopoverPropsPlacement.right:
|
|
251
|
+
return "right";
|
|
252
|
+
case Ui89PopoverPropsPlacement.rightStart:
|
|
253
|
+
return "right-start";
|
|
254
|
+
case Ui89PopoverPropsPlacement.rightEnd:
|
|
255
|
+
return "right-end";
|
|
256
|
+
case Ui89PopoverPropsPlacement.bottom:
|
|
257
|
+
return "bottom";
|
|
258
|
+
case Ui89PopoverPropsPlacement.bottomStart:
|
|
259
|
+
return "bottom-start";
|
|
260
|
+
case Ui89PopoverPropsPlacement.bottomEnd:
|
|
261
|
+
return "bottom-end";
|
|
262
|
+
case Ui89PopoverPropsPlacement.left:
|
|
263
|
+
return "left";
|
|
264
|
+
case Ui89PopoverPropsPlacement.leftStart:
|
|
265
|
+
return "left-start";
|
|
266
|
+
case Ui89PopoverPropsPlacement.leftEnd:
|
|
267
|
+
return "left-end";
|
|
268
|
+
default:
|
|
269
|
+
throw new Error(`Unknown placement: ${placement}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function Ui89Popover(props) {
|
|
273
|
+
const zIndexer = useZIndexer(props.open);
|
|
274
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
275
|
+
open: props.open,
|
|
276
|
+
onOpenChange: props.onOpenChange,
|
|
277
|
+
middleware: [
|
|
278
|
+
size({
|
|
279
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
280
|
+
let width = elements.reference.getBoundingClientRect().width;
|
|
281
|
+
if (props.popoverOverflowMaxWidth !== undefined) {
|
|
282
|
+
if (props.popoverOverflowMaxWidth > width) {
|
|
283
|
+
width = props.popoverOverflowMaxWidth;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const style = {
|
|
287
|
+
maxWidth: `${width}px`,
|
|
288
|
+
maxHeight: `${Math.max(0, availableHeight)}px`,
|
|
289
|
+
};
|
|
290
|
+
if (props.popoverOverflowForce) {
|
|
291
|
+
style.width = `${availableWidth}px`;
|
|
292
|
+
}
|
|
293
|
+
// Change styles, e.g.
|
|
294
|
+
Object.assign(elements.floating.style, style);
|
|
295
|
+
},
|
|
296
|
+
}),
|
|
297
|
+
],
|
|
298
|
+
whileElementsMounted: autoUpdate,
|
|
299
|
+
placement: toFloatingUiPlacement(props.placement ?? Ui89PopoverPropsPlacement.bottomStart),
|
|
300
|
+
strategy: "fixed",
|
|
301
|
+
});
|
|
302
|
+
const click = useClick(context, {
|
|
303
|
+
keyboardHandlers: false,
|
|
304
|
+
});
|
|
305
|
+
const dismiss = useDismiss(context);
|
|
306
|
+
const role = useRole(context);
|
|
307
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
308
|
+
click,
|
|
309
|
+
dismiss,
|
|
310
|
+
role,
|
|
311
|
+
]);
|
|
312
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
313
|
+
props.renderContainer({
|
|
314
|
+
setRef: refs.setReference,
|
|
315
|
+
props: getReferenceProps(),
|
|
316
|
+
}),
|
|
317
|
+
props.open && (React__default.createElement(FloatingPortal, null,
|
|
318
|
+
React__default.createElement(FloatingFocusManager, { context: context, modal: false, initialFocus: -1 },
|
|
319
|
+
React__default.createElement(Ui89Scene, null,
|
|
320
|
+
React__default.createElement("div", { ref: refs.setFloating, style: {
|
|
321
|
+
...floatingStyles,
|
|
322
|
+
zIndex: zIndexer.value,
|
|
323
|
+
display: "flex",
|
|
324
|
+
flexDirection: "column",
|
|
325
|
+
} }, props.renderPopover())))))));
|
|
326
|
+
}
|
|
238
327
|
|
|
239
328
|
function dateFormat(date, format) {
|
|
240
329
|
const placeholders = {
|
|
@@ -250,82 +339,555 @@ function dateFormat(date, format) {
|
|
|
250
339
|
// Replace placeholders in the format string
|
|
251
340
|
let formattedDate = format;
|
|
252
341
|
for (const [key, value] of Object.entries(placeholders)) {
|
|
253
|
-
formattedDate = formattedDate.replace(key, value);
|
|
342
|
+
formattedDate = formattedDate.replace(new RegExp(key, "g"), value);
|
|
254
343
|
}
|
|
255
344
|
return formattedDate;
|
|
256
345
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
346
|
+
function dateParse(dateStr, format) {
|
|
347
|
+
const placeholderRegex = {
|
|
348
|
+
YYYY: "(\\d{4})",
|
|
349
|
+
MM: "(\\d{2})",
|
|
350
|
+
DD: "(\\d{2})",
|
|
351
|
+
HH: "(\\d{2})",
|
|
352
|
+
mm: "(\\d{2})",
|
|
353
|
+
ss: "(\\d{2})",
|
|
354
|
+
hh: "(\\d{2})",
|
|
355
|
+
A: "(AM|PM)",
|
|
356
|
+
};
|
|
357
|
+
const placeholderKeys = Object.keys(placeholderRegex).sort((a, b) => b.length - a.length);
|
|
358
|
+
let regexPattern = "^";
|
|
359
|
+
const partTypes = [];
|
|
360
|
+
let i = 0;
|
|
361
|
+
while (i < format.length) {
|
|
362
|
+
let found = false;
|
|
363
|
+
for (const key of placeholderKeys) {
|
|
364
|
+
if (format.startsWith(key, i)) {
|
|
365
|
+
regexPattern += placeholderRegex[key];
|
|
366
|
+
partTypes.push(key);
|
|
367
|
+
i += key.length;
|
|
368
|
+
found = true;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (!found) {
|
|
373
|
+
const char = format[i];
|
|
374
|
+
regexPattern += char.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
375
|
+
i++;
|
|
376
|
+
}
|
|
261
377
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
378
|
+
regexPattern += "$";
|
|
379
|
+
const regex = new RegExp(regexPattern);
|
|
380
|
+
const match = dateStr.match(regex);
|
|
381
|
+
if (!match) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
const now = new Date();
|
|
385
|
+
const parts = {
|
|
386
|
+
year: now.getFullYear(),
|
|
387
|
+
month: now.getMonth(),
|
|
388
|
+
day: now.getDate(),
|
|
389
|
+
hours: 0,
|
|
390
|
+
minutes: 0,
|
|
391
|
+
seconds: 0,
|
|
392
|
+
};
|
|
393
|
+
let ampm;
|
|
394
|
+
const parsedFields = new Set();
|
|
395
|
+
for (let j = 1; j < match.length; j++) {
|
|
396
|
+
const type = partTypes[j - 1];
|
|
397
|
+
const value = match[j];
|
|
398
|
+
parsedFields.add(type);
|
|
399
|
+
if (type === "YYYY")
|
|
400
|
+
parts.year = parseInt(value, 10);
|
|
401
|
+
else if (type === "MM")
|
|
402
|
+
parts.month = parseInt(value, 10) - 1;
|
|
403
|
+
else if (type === "DD")
|
|
404
|
+
parts.day = parseInt(value, 10);
|
|
405
|
+
else if (type === "HH")
|
|
406
|
+
parts.hours = parseInt(value, 10);
|
|
407
|
+
else if (type === "mm")
|
|
408
|
+
parts.minutes = parseInt(value, 10);
|
|
409
|
+
else if (type === "ss")
|
|
410
|
+
parts.seconds = parseInt(value, 10);
|
|
411
|
+
else if (type === "hh")
|
|
412
|
+
parts.hours = parseInt(value, 10);
|
|
413
|
+
else if (type === "A")
|
|
414
|
+
ampm = value;
|
|
415
|
+
}
|
|
416
|
+
if (ampm) {
|
|
417
|
+
let hours = parts.hours;
|
|
418
|
+
if (ampm === "PM" && hours < 12) {
|
|
419
|
+
hours += 12;
|
|
420
|
+
}
|
|
421
|
+
if (ampm === "AM" && hours === 12) {
|
|
422
|
+
// 12 AM is 00 hours
|
|
423
|
+
hours = 0;
|
|
424
|
+
}
|
|
425
|
+
parts.hours = hours;
|
|
426
|
+
}
|
|
427
|
+
const date = new Date(parts.year, parts.month, parts.day, parts.hours, parts.minutes, parts.seconds);
|
|
428
|
+
// Validate date by checking if components overflowed for parsed fields
|
|
429
|
+
if (parsedFields.has("YYYY") && date.getFullYear() !== parts.year)
|
|
430
|
+
return null;
|
|
431
|
+
if (parsedFields.has("MM") && date.getMonth() !== parts.month)
|
|
432
|
+
return null;
|
|
433
|
+
if (parsedFields.has("DD") && date.getDate() !== parts.day)
|
|
434
|
+
return null;
|
|
435
|
+
if ((parsedFields.has("HH") || parsedFields.has("hh")) &&
|
|
436
|
+
date.getHours() !== parts.hours)
|
|
437
|
+
return null;
|
|
438
|
+
if (parsedFields.has("mm") && date.getMinutes() !== parts.minutes)
|
|
439
|
+
return null;
|
|
440
|
+
if (parsedFields.has("ss") && date.getSeconds() !== parts.seconds)
|
|
441
|
+
return null;
|
|
442
|
+
return date;
|
|
280
443
|
}
|
|
281
444
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
445
|
+
let uniqueId = 0;
|
|
446
|
+
function throttledTimeout() {
|
|
447
|
+
const id = String(uniqueId++);
|
|
448
|
+
let callback;
|
|
449
|
+
return {
|
|
450
|
+
call(delay, f) {
|
|
451
|
+
callback = f;
|
|
452
|
+
if (Timeout.pending(id)) {
|
|
453
|
+
Timeout.restart(id);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
Timeout.set(id, () => callback(), delay);
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
/**
|
|
460
|
+
* If there is a call that has been scheduled, remove it from the queue.
|
|
461
|
+
*/
|
|
462
|
+
abort() {
|
|
463
|
+
Timeout.clear(id, true);
|
|
464
|
+
},
|
|
465
|
+
/**
|
|
466
|
+
* Lets you know whether a call is pending.
|
|
467
|
+
*/
|
|
468
|
+
isPending() {
|
|
469
|
+
return Timeout.pending(id);
|
|
470
|
+
},
|
|
289
471
|
};
|
|
290
|
-
return React__default.createElement("div", { style: style }, props.children);
|
|
291
472
|
}
|
|
292
473
|
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
|
|
474
|
+
function useUpdatedRef(value) {
|
|
475
|
+
const valueRef = useRef(value);
|
|
476
|
+
useEffect(() => {
|
|
477
|
+
valueRef.current = value;
|
|
478
|
+
}, [value]);
|
|
479
|
+
return valueRef;
|
|
296
480
|
}
|
|
297
481
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
482
|
+
const LAST_VALUE_CHANGED = Symbol("LAST_VALUE_CHANGED");
|
|
483
|
+
const OVERRIDEN_VALUE_UNDEFINED = Symbol("OVERRIDEN_VALUE_UNDEFINED");
|
|
484
|
+
function useDelayedOnChange(props) {
|
|
485
|
+
const valueRef = useUpdatedRef(props.value);
|
|
486
|
+
const onChangeRef = useUpdatedRef(props.onChange);
|
|
487
|
+
const [intermediateValue, setIntermediateValue] = useState(props.defaultValue || props.value);
|
|
488
|
+
useEffect(() => {
|
|
489
|
+
stateRef.current.setValue(props.value);
|
|
490
|
+
}, [props.value]);
|
|
491
|
+
function callOnChange() {
|
|
492
|
+
let newVal = stateRef.current.value;
|
|
493
|
+
if (props.filter !== undefined) {
|
|
494
|
+
newVal = props.filter(newVal);
|
|
495
|
+
}
|
|
496
|
+
if (newVal !== valueRef.current) {
|
|
497
|
+
onChangeRef.current?.call(null, newVal);
|
|
302
498
|
}
|
|
499
|
+
return newVal;
|
|
303
500
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
useEffect(() => {
|
|
311
|
-
const observer = new ResizeObserver((entries) => {
|
|
312
|
-
for (let entry of entries) {
|
|
313
|
-
setSize({
|
|
314
|
-
width: entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width,
|
|
315
|
-
height: entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height,
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
if (ref.current) {
|
|
320
|
-
observer.observe(ref.current);
|
|
501
|
+
class StateUnknown {
|
|
502
|
+
state = "unknown";
|
|
503
|
+
value;
|
|
504
|
+
throttledTimeout;
|
|
505
|
+
constructor() {
|
|
506
|
+
this.throttledTimeout = throttledTimeout();
|
|
321
507
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
508
|
+
setValue(newVal) {
|
|
509
|
+
setIntermediateValue(newVal);
|
|
510
|
+
}
|
|
511
|
+
onChange(newVal) {
|
|
512
|
+
setIntermediateValue(newVal);
|
|
513
|
+
stateRef.current.throttledTimeout.call(300, callOnChange);
|
|
514
|
+
}
|
|
515
|
+
onFocus() {
|
|
516
|
+
let newState = new StateFocus();
|
|
517
|
+
newState.value = stateRef.current.value;
|
|
518
|
+
newState.lastValue = newState.value;
|
|
519
|
+
setState(newState);
|
|
520
|
+
}
|
|
521
|
+
onBlur() { }
|
|
522
|
+
onConfirm() {
|
|
523
|
+
callOnChange();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
class StateFocus {
|
|
527
|
+
state = "focus";
|
|
528
|
+
value;
|
|
529
|
+
lastValue;
|
|
530
|
+
/**
|
|
531
|
+
* If we receive a new value, we keep track of it here. We set this to
|
|
532
|
+
* OVERRIDEN_VALUE_UNDEFINED if the value is meant to be discarded.
|
|
533
|
+
*/
|
|
534
|
+
overridenValue;
|
|
535
|
+
throttledTimeout;
|
|
536
|
+
constructor() {
|
|
537
|
+
this.overridenValue = OVERRIDEN_VALUE_UNDEFINED;
|
|
538
|
+
this.throttledTimeout = throttledTimeout();
|
|
539
|
+
}
|
|
540
|
+
setValue(newVal) {
|
|
541
|
+
if (stateRef.current.value === stateRef.current.lastValue) {
|
|
542
|
+
// No changes.
|
|
543
|
+
setIntermediateValue(newVal);
|
|
544
|
+
// Making sure we keep updating.
|
|
545
|
+
stateRef.current.lastValue = newVal;
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
// There have been changes. Let's not bother the user.
|
|
549
|
+
stateRef.current.overridenValue = newVal;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
onChange(newVal) {
|
|
553
|
+
// Discard last setValue call
|
|
554
|
+
stateRef.current.overridenValue = OVERRIDEN_VALUE_UNDEFINED;
|
|
555
|
+
stateRef.current.lastValue = LAST_VALUE_CHANGED;
|
|
556
|
+
setIntermediateValue(newVal);
|
|
557
|
+
stateRef.current.throttledTimeout.call(300, callOnChange);
|
|
558
|
+
}
|
|
559
|
+
onFocus() { }
|
|
560
|
+
onBlur() {
|
|
561
|
+
// We need to make sure that we emit immediately. Do not want to leave
|
|
562
|
+
// user waiting.
|
|
563
|
+
// We can cancel this one.
|
|
564
|
+
stateRef.current.throttledTimeout.abort();
|
|
565
|
+
if (stateRef.current.overridenValue !== OVERRIDEN_VALUE_UNDEFINED) {
|
|
566
|
+
stateRef.current.value = stateRef.current.overridenValue;
|
|
567
|
+
}
|
|
568
|
+
let newVal = callOnChange();
|
|
569
|
+
setIntermediateValue(newVal);
|
|
570
|
+
let newState = new StateUnknown();
|
|
571
|
+
newState.value = newVal;
|
|
572
|
+
setState(newState);
|
|
573
|
+
}
|
|
574
|
+
onConfirm() {
|
|
575
|
+
callOnChange();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
const [state, setState] = useState(() => {
|
|
579
|
+
let newState = new StateUnknown();
|
|
580
|
+
newState.value = intermediateValue;
|
|
581
|
+
return newState;
|
|
582
|
+
});
|
|
583
|
+
const stateRef = useUpdatedRef(state);
|
|
584
|
+
stateRef.current.value = intermediateValue;
|
|
585
|
+
return state;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const Ui89InputText = React__default.forwardRef(function Ui89InputText({ value, placeholder, autoTrim = true, disabled, textAlign, onChange, onTyping, onFocus, onBlur, }, ref) {
|
|
589
|
+
const inputRef = useRef(null);
|
|
590
|
+
const delayedState = useDelayedOnChange({
|
|
591
|
+
defaultValue: "",
|
|
592
|
+
value,
|
|
593
|
+
onChange,
|
|
594
|
+
filter(value) {
|
|
595
|
+
if (autoTrim) {
|
|
596
|
+
if (typeof value === "string") {
|
|
597
|
+
value = value.replace(/\s+/g, " ").trim();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return value;
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
useImperativeHandle(ref, () => ({
|
|
604
|
+
focus: () => {
|
|
605
|
+
inputRef.current?.focus();
|
|
606
|
+
},
|
|
607
|
+
}));
|
|
608
|
+
return (React__default.createElement("div", null,
|
|
609
|
+
React__default.createElement("input", { ref: inputRef, className: [
|
|
610
|
+
"ui89-input-box",
|
|
611
|
+
disabled ? "ui89-input-box--disabled" : "",
|
|
612
|
+
].join(" "), style: { textAlign }, type: "text", disabled: disabled, value: delayedState.value, onChange: (e) => delayedState.onChange(e.target.value), onBlur: delayedState.onBlur, onFocus: delayedState.onFocus, onKeyDown: (e) => {
|
|
613
|
+
if (e.key === "Enter") {
|
|
614
|
+
delayedState.onConfirm();
|
|
615
|
+
}
|
|
616
|
+
}, placeholder: placeholder })));
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
function stringRemoveAllWhitespace(str) {
|
|
620
|
+
return str.replace(/\s+/g, "");
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function isTextNumber(text) {
|
|
624
|
+
return /^\d+(\.\d+)?$/.test(text);
|
|
625
|
+
}
|
|
626
|
+
function displayText(value) {
|
|
627
|
+
if (value === undefined) {
|
|
628
|
+
// No idea how to display this.
|
|
629
|
+
return "";
|
|
630
|
+
}
|
|
631
|
+
else if (isNaN(value)) {
|
|
632
|
+
// No idea what to display.
|
|
633
|
+
return "";
|
|
634
|
+
}
|
|
635
|
+
return value.toString();
|
|
636
|
+
}
|
|
637
|
+
function dotsMakeMoreSense(value) {
|
|
638
|
+
return value.replaceAll(",", ".");
|
|
639
|
+
}
|
|
640
|
+
function Ui89InputTextNumber(props) {
|
|
641
|
+
const wrappedValue = useMemo(() => {
|
|
642
|
+
return displayText(props.value);
|
|
643
|
+
}, [props.value]);
|
|
644
|
+
function implOnChange(value) {
|
|
645
|
+
if (props.onChange === undefined) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
if (value === "") {
|
|
649
|
+
// Use empty value.
|
|
650
|
+
props.onChange(props.emptyValue);
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
value = stringRemoveAllWhitespace(value);
|
|
654
|
+
value = dotsMakeMoreSense(value);
|
|
655
|
+
if (!isTextNumber(value)) {
|
|
656
|
+
// We end here.
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
const numberValue = Number(value);
|
|
660
|
+
if (props.min !== undefined) {
|
|
661
|
+
if (numberValue <= props.min) {
|
|
662
|
+
value = String(props.min);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
if (props.max !== undefined) {
|
|
666
|
+
if (numberValue >= props.max) {
|
|
667
|
+
value = String(props.max);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
props.onChange(value);
|
|
671
|
+
}
|
|
672
|
+
return (React__default.createElement(Ui89InputText, { value: wrappedValue, onChange: implOnChange, disabled: props.disabled, textAlign: props.textAlign }));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function Ui89DateTimePicker(props) {
|
|
676
|
+
const [open, setOpen] = useState(false);
|
|
677
|
+
const [inputValue, setInputValue] = useState("");
|
|
678
|
+
const [viewDate, setViewDate] = useState(new Date());
|
|
679
|
+
const dateFormat$1 = props.dateFormat ?? "YYYY/MM/DD HH:mm:ss";
|
|
680
|
+
useEffect(() => {
|
|
681
|
+
if (props.value) {
|
|
682
|
+
setInputValue(dateFormat(props.value, dateFormat$1));
|
|
683
|
+
setViewDate(props.value);
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
setInputValue("");
|
|
687
|
+
}
|
|
688
|
+
}, [props.value, dateFormat$1]);
|
|
689
|
+
function handleInputChange(val) {
|
|
690
|
+
setInputValue(val);
|
|
691
|
+
const date = dateParse(val, dateFormat$1);
|
|
692
|
+
if (date !== null) {
|
|
693
|
+
if (props.onChange)
|
|
694
|
+
props.onChange(date);
|
|
695
|
+
setViewDate(date);
|
|
696
|
+
}
|
|
697
|
+
else if (val.trim() === "") {
|
|
698
|
+
if (props.onChange)
|
|
699
|
+
props.onChange(null);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
function adjustMonth(offset) {
|
|
703
|
+
const newDate = new Date(viewDate);
|
|
704
|
+
newDate.setMonth(newDate.getMonth() + offset);
|
|
705
|
+
setViewDate(newDate);
|
|
706
|
+
}
|
|
707
|
+
function handleDayClick(day) {
|
|
708
|
+
const newDate = new Date(day);
|
|
709
|
+
if (props.value) {
|
|
710
|
+
newDate.setHours(props.value.getHours());
|
|
711
|
+
newDate.setMinutes(props.value.getMinutes());
|
|
712
|
+
newDate.setSeconds(props.value.getSeconds());
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
newDate.setHours(12, 0, 0, 0);
|
|
716
|
+
}
|
|
717
|
+
if (props.onChange)
|
|
718
|
+
props.onChange(newDate);
|
|
719
|
+
}
|
|
720
|
+
function handleTimeChange(type, val) {
|
|
721
|
+
if (!props.value)
|
|
722
|
+
return;
|
|
723
|
+
const num = parseInt(val, 10);
|
|
724
|
+
if (isNaN(num))
|
|
725
|
+
return;
|
|
726
|
+
const newDate = new Date(props.value);
|
|
727
|
+
if (type === "h")
|
|
728
|
+
newDate.setHours(Math.min(23, Math.max(0, num)));
|
|
729
|
+
if (type === "m")
|
|
730
|
+
newDate.setMinutes(Math.min(59, Math.max(0, num)));
|
|
731
|
+
if (type === "s")
|
|
732
|
+
newDate.setSeconds(Math.min(59, Math.max(0, num)));
|
|
733
|
+
if (props.onChange)
|
|
734
|
+
props.onChange(newDate);
|
|
735
|
+
}
|
|
736
|
+
function renderCalendar() {
|
|
737
|
+
const year = viewDate.getFullYear();
|
|
738
|
+
const month = viewDate.getMonth();
|
|
739
|
+
const firstDay = new Date(year, month, 1);
|
|
740
|
+
const startDay = firstDay.getDay();
|
|
741
|
+
const startDate = new Date(year, month, 1 - startDay);
|
|
742
|
+
const days = [];
|
|
743
|
+
const current = new Date(startDate);
|
|
744
|
+
for (let i = 0; i < 42; i++) {
|
|
745
|
+
days.push(new Date(current));
|
|
746
|
+
current.setDate(current.getDate() + 1);
|
|
747
|
+
}
|
|
748
|
+
return (React__default.createElement("div", { style: { width: "300px", padding: "10px" } },
|
|
749
|
+
React__default.createElement("div", { style: {
|
|
750
|
+
display: "flex",
|
|
751
|
+
justifyContent: "space-between",
|
|
752
|
+
alignItems: "center",
|
|
753
|
+
marginBottom: "10px",
|
|
754
|
+
} },
|
|
755
|
+
React__default.createElement(Ui89Button, { size: Ui89ButtonPropsSize.square, onClick: () => adjustMonth(-1) }, "<"),
|
|
756
|
+
React__default.createElement("div", { className: "ui89-typo-normal" }, dateFormat(viewDate, "MM/YYYY")),
|
|
757
|
+
React__default.createElement(Ui89Button, { size: Ui89ButtonPropsSize.square, onClick: () => adjustMonth(1) }, ">")),
|
|
758
|
+
React__default.createElement("div", { style: {
|
|
759
|
+
display: "grid",
|
|
760
|
+
gridTemplateColumns: "repeat(7, 1fr)",
|
|
761
|
+
gap: "2px",
|
|
762
|
+
} },
|
|
763
|
+
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((d) => (React__default.createElement("div", { key: d, className: "ui89-typo-small-bold", style: { textAlign: "center", padding: "5px" } }, d))),
|
|
764
|
+
days.map((d, i) => {
|
|
765
|
+
const isSelected = props.value &&
|
|
766
|
+
d.getDate() === props.value.getDate() &&
|
|
767
|
+
d.getMonth() === props.value.getMonth() &&
|
|
768
|
+
d.getFullYear() === props.value.getFullYear();
|
|
769
|
+
const isCurrentMonth = d.getMonth() === month;
|
|
770
|
+
return (React__default.createElement("div", { key: i, className: "ui89-typo-normal", onClick: () => handleDayClick(d), style: {
|
|
771
|
+
textAlign: "center",
|
|
772
|
+
padding: "5px",
|
|
773
|
+
cursor: "pointer",
|
|
774
|
+
backgroundColor: isSelected
|
|
775
|
+
? "var(--ui89-theme-primary-bg-color)"
|
|
776
|
+
: "transparent",
|
|
777
|
+
opacity: isCurrentMonth ? 1 : 0.3,
|
|
778
|
+
} }, d.getDate()));
|
|
779
|
+
})),
|
|
780
|
+
props.value && (React__default.createElement("div", { style: {
|
|
781
|
+
display: "flex",
|
|
782
|
+
gap: "5px",
|
|
783
|
+
marginTop: "10px",
|
|
784
|
+
justifyContent: "center",
|
|
785
|
+
alignItems: "center",
|
|
786
|
+
} },
|
|
787
|
+
React__default.createElement("div", { style: { width: "35px" } },
|
|
788
|
+
React__default.createElement(Ui89InputTextNumber, { value: props.value.getHours(), onChange: (val) => handleTimeChange("h", val), min: 0, max: 23, textAlign: "right" })),
|
|
789
|
+
":",
|
|
790
|
+
React__default.createElement("div", { style: { width: "35px" } },
|
|
791
|
+
React__default.createElement(Ui89InputTextNumber, { value: props.value.getMinutes(), onChange: (val) => handleTimeChange("m", val), min: 0, max: 59, textAlign: "right" })),
|
|
792
|
+
":",
|
|
793
|
+
React__default.createElement("div", { style: { width: "35px" } },
|
|
794
|
+
React__default.createElement(Ui89InputTextNumber, { value: props.value.getSeconds(), onChange: (val) => handleTimeChange("s", val), min: 0, max: 59, textAlign: "right" }))))));
|
|
795
|
+
}
|
|
796
|
+
return (React__default.createElement(Ui89Popover, { open: open, onOpenChange: setOpen, popoverOverflowMaxWidth: 360, renderContainer: ({ setRef, props: popoverProps }) => (React__default.createElement("div", { className: "ui89-date-time-picker", ref: setRef, ...popoverProps },
|
|
797
|
+
React__default.createElement(Ui89InputText, { value: inputValue, onChange: handleInputChange, placeholder: dateFormat$1 }))), renderPopover: () => (React__default.createElement("div", { style: { maxWidth: "360px" } },
|
|
798
|
+
React__default.createElement(HoverShadow, null,
|
|
799
|
+
React__default.createElement(Ui89Card, null, renderCalendar())))) }));
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
const TimeAnimation = ({ children }) => {
|
|
803
|
+
const [currentTime, setCurrentTime] = useState(new Date());
|
|
804
|
+
useEffect(() => {
|
|
805
|
+
const tick = () => {
|
|
806
|
+
const now = new Date();
|
|
807
|
+
setCurrentTime(now);
|
|
808
|
+
// Calculate time until the next exact second
|
|
809
|
+
const msUntilNextSecond = 1000 - now.getMilliseconds();
|
|
810
|
+
setTimeout(tick, msUntilNextSecond);
|
|
811
|
+
};
|
|
812
|
+
// Start the first tick
|
|
813
|
+
const msUntilNextSecond = 1000 - currentTime.getMilliseconds();
|
|
814
|
+
const timeoutId = setTimeout(tick, msUntilNextSecond);
|
|
815
|
+
return () => clearTimeout(timeoutId);
|
|
816
|
+
}, []);
|
|
817
|
+
return React__default.createElement(React__default.Fragment, null, children({ now: currentTime }));
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
function Ui89DigitalClock({ format = "HH:mm:ss", }) {
|
|
821
|
+
function render({ now }) {
|
|
822
|
+
return dateFormat(now, format);
|
|
823
|
+
}
|
|
824
|
+
return (React__default.createElement("span", { className: "ui89-typo-special" },
|
|
825
|
+
React__default.createElement(TimeAnimation, null, render)));
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function Ui89HighlightText({ theme, block, children, }) {
|
|
829
|
+
return (React__default.createElement("span", { className: `ui89-highlight-text ui89-chosen-theme-${theme} ${block ? "ui89-highlight-text--block" : null}` }, children));
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
var Ui89HrPropsLook;
|
|
833
|
+
(function (Ui89HrPropsLook) {
|
|
834
|
+
Ui89HrPropsLook["straight"] = "straight";
|
|
835
|
+
Ui89HrPropsLook["dotted"] = "dotted";
|
|
836
|
+
Ui89HrPropsLook["dashed"] = "dashed";
|
|
837
|
+
Ui89HrPropsLook["double"] = "double";
|
|
838
|
+
})(Ui89HrPropsLook || (Ui89HrPropsLook = {}));
|
|
839
|
+
function Ui89Hr({ look = "straight", theme }) {
|
|
840
|
+
return (React__default.createElement("div", { className: `ui-89-hr ${`ui-89-hr--${look}`} ${theme !== undefined ? "ui-89-hr--use-theme" : ""} ${theme !== undefined ? `ui89-chosen-theme-${theme}` : ""}` },
|
|
841
|
+
React__default.createElement("div", { className: "ui-89-hr__double" })));
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function Ui89SpacePadding(props) {
|
|
845
|
+
const gap = props.gap ?? 1;
|
|
846
|
+
const style = {
|
|
847
|
+
paddingTop: `calc(var(--ui89-safe-space) * ${props.gapTop ?? props.gapVertical ?? gap})`,
|
|
848
|
+
paddingRight: `calc(var(--ui89-safe-space) * ${props.gapRight ?? props.gapHorizontal ?? gap})`,
|
|
849
|
+
paddingBottom: `calc(var(--ui89-safe-space) * ${props.gapBottom ?? props.gapVertical ?? gap})`,
|
|
850
|
+
paddingLeft: `calc(var(--ui89-safe-space) * ${props.gapLeft ?? props.gapHorizontal ?? gap})`,
|
|
851
|
+
};
|
|
852
|
+
return React__default.createElement("div", { style: style }, props.children);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function Ui89Indent(props) {
|
|
856
|
+
const gap = props.gap ?? 1;
|
|
857
|
+
return (React__default.createElement(Ui89SpacePadding, { gap: 0, gapLeft: gap }, props.children));
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function Ui89InputCheckBox(props) {
|
|
861
|
+
function toggle() {
|
|
862
|
+
if (props.onChange) {
|
|
863
|
+
props.onChange(!props.value);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return (React__default.createElement("span", { className: "ui89-input-check-box", onClick: toggle, role: "checkbox", "aria-checked": props.value ? "true" : "false" },
|
|
867
|
+
React__default.createElement("span", { className: "ui89-input-check-box__x" }, props.value ? React__default.createElement(React__default.Fragment, null, "X") : React__default.createElement(React__default.Fragment, null, "\u00A0"))));
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
const useResizeObserver = (ref) => {
|
|
871
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
872
|
+
useEffect(() => {
|
|
873
|
+
const observer = new ResizeObserver((entries) => {
|
|
874
|
+
for (let entry of entries) {
|
|
875
|
+
setSize({
|
|
876
|
+
width: entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width,
|
|
877
|
+
height: entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
if (ref.current) {
|
|
882
|
+
observer.observe(ref.current);
|
|
883
|
+
}
|
|
884
|
+
return () => {
|
|
885
|
+
observer.disconnect();
|
|
886
|
+
};
|
|
887
|
+
}, [ref.current]);
|
|
888
|
+
return {
|
|
889
|
+
size,
|
|
890
|
+
};
|
|
329
891
|
};
|
|
330
892
|
|
|
331
893
|
const useScrollYPosition = (ref) => {
|
|
@@ -471,382 +1033,95 @@ function Ui89InputCheckList(props) {
|
|
|
471
1033
|
}
|
|
472
1034
|
const valueSet = useMemo(() => {
|
|
473
1035
|
const set = new Set();
|
|
474
|
-
for (const value of props.value) {
|
|
475
|
-
set.add(getValueKey(value));
|
|
476
|
-
}
|
|
477
|
-
return set;
|
|
478
|
-
}, [props.value]);
|
|
479
|
-
const renderRow = (props2) => {
|
|
480
|
-
const key = getValueKey(props2.row);
|
|
481
|
-
const value = valueSet.has(key);
|
|
482
|
-
const label = props.renderOption !== undefined
|
|
483
|
-
? props.renderOption({ option: props2.row, index: props2.index })
|
|
484
|
-
: String(props2.row);
|
|
485
|
-
function onChange(checked) {
|
|
486
|
-
if (checked) {
|
|
487
|
-
if (props.onSelect !== undefined) {
|
|
488
|
-
props.onSelect(props2.row);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
if (props.onDeselect !== undefined) {
|
|
493
|
-
props.onDeselect(props2.row);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
if (props.onChange !== undefined) {
|
|
497
|
-
if (checked) {
|
|
498
|
-
props.onChange([...props.value, props2.row]);
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
props.onChange(props.value.filter((item) => getValueKey(item) !== key));
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
function toggle() {
|
|
506
|
-
onChange(!value);
|
|
507
|
-
}
|
|
508
|
-
return (React__default.createElement("div", { style: {
|
|
509
|
-
display: "flex",
|
|
510
|
-
alignItems: "center",
|
|
511
|
-
gap: "var(--ui89-safe-space)",
|
|
512
|
-
height: "100%",
|
|
513
|
-
} },
|
|
514
|
-
React__default.createElement(Ui89InputCheckBox, { value: value, onChange: onChange }),
|
|
515
|
-
React__default.createElement("div", { className: "ui89-text-ellipsis", style: { minWidth: 0, cursor: "pointer" }, onClick: toggle }, label)));
|
|
516
|
-
};
|
|
517
|
-
return (React__default.createElement("div", { style: {
|
|
518
|
-
display: "flex",
|
|
519
|
-
flexDirection: "column",
|
|
520
|
-
maxHeight: props.maxHeight,
|
|
521
|
-
} },
|
|
522
|
-
React__default.createElement(Ui89VirtualList, { rows: props.options, renderRow: renderRow, getRowKey: props.getValueKey, rowHeight: props.optionHeight ?? 40, maxHeight: "100%" })));
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
function Ui89InputCheckText(props) {
|
|
526
|
-
function toggle() {
|
|
527
|
-
if (props.onChange) {
|
|
528
|
-
props.onChange(!props.value);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return (React__default.createElement("span", { className: "ui89-input-check-text", onClick: toggle }, props.value ? "[X]" : "[ ]"));
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
function Ui89InputFileUpload(props) {
|
|
535
|
-
const inputRef = useRef(null);
|
|
536
|
-
function implOnChange(e) {
|
|
537
|
-
if (!props.onChange) {
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
if (e.target.files === null) {
|
|
541
|
-
props.onChange(null);
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
if (e.target.files.length === 0) {
|
|
545
|
-
props.onChange(null);
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
props.onChange(e.target.files[0]);
|
|
549
|
-
// Reset the file input's value to allow selecting the same file again.
|
|
550
|
-
e.target.value = "";
|
|
551
|
-
}
|
|
552
|
-
function onClick() {
|
|
553
|
-
if (inputRef.current === null) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
inputRef.current.click();
|
|
557
|
-
}
|
|
558
|
-
return (React__default.createElement("div", null,
|
|
559
|
-
React__default.createElement("input", { ref: inputRef, className: "ui89-typo-special", type: "file", onChange: implOnChange, accept: props.accept, hidden: true }),
|
|
560
|
-
props.value ? (React__default.createElement("div", { className: "ui89-input-file-upload" },
|
|
561
|
-
React__default.createElement(Ui89Button, { onClick: onClick }, "Change"),
|
|
562
|
-
React__default.createElement("span", { className: `ui89-input-file-upload__info ui89-text-single-line ui89-text-single-line--ellipsis-left`, title: props.value.name }, props.value.name))) : (React__default.createElement(Ui89Button, { onClick: onClick }, "Upload"))));
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
let uniqueId = 0;
|
|
566
|
-
function throttledTimeout() {
|
|
567
|
-
const id = String(uniqueId++);
|
|
568
|
-
let callback;
|
|
569
|
-
return {
|
|
570
|
-
call(delay, f) {
|
|
571
|
-
callback = f;
|
|
572
|
-
if (Timeout.pending(id)) {
|
|
573
|
-
Timeout.restart(id);
|
|
574
|
-
}
|
|
575
|
-
else {
|
|
576
|
-
Timeout.set(id, () => callback(), delay);
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
/**
|
|
580
|
-
* If there is a call that has been scheduled, remove it from the queue.
|
|
581
|
-
*/
|
|
582
|
-
abort() {
|
|
583
|
-
Timeout.clear(id, true);
|
|
584
|
-
},
|
|
585
|
-
/**
|
|
586
|
-
* Lets you know whether a call is pending.
|
|
587
|
-
*/
|
|
588
|
-
isPending() {
|
|
589
|
-
return Timeout.pending(id);
|
|
590
|
-
},
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
function useUpdatedRef(value) {
|
|
595
|
-
const valueRef = useRef(value);
|
|
596
|
-
useEffect(() => {
|
|
597
|
-
valueRef.current = value;
|
|
598
|
-
}, [value]);
|
|
599
|
-
return valueRef;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
const LAST_VALUE_CHANGED = Symbol("LAST_VALUE_CHANGED");
|
|
603
|
-
const OVERRIDEN_VALUE_UNDEFINED = Symbol("OVERRIDEN_VALUE_UNDEFINED");
|
|
604
|
-
function useDelayedOnChange(props) {
|
|
605
|
-
const valueRef = useUpdatedRef(props.value);
|
|
606
|
-
const onChangeRef = useUpdatedRef(props.onChange);
|
|
607
|
-
const [intermediateValue, setIntermediateValue] = useState(props.defaultValue || props.value);
|
|
608
|
-
useEffect(() => {
|
|
609
|
-
stateRef.current.setValue(props.value);
|
|
610
|
-
}, [props.value]);
|
|
611
|
-
function callOnChange() {
|
|
612
|
-
let newVal = stateRef.current.value;
|
|
613
|
-
if (props.filter !== undefined) {
|
|
614
|
-
newVal = props.filter(newVal);
|
|
615
|
-
}
|
|
616
|
-
if (newVal !== valueRef.current) {
|
|
617
|
-
onChangeRef.current?.call(null, newVal);
|
|
618
|
-
}
|
|
619
|
-
return newVal;
|
|
620
|
-
}
|
|
621
|
-
class StateUnknown {
|
|
622
|
-
state = "unknown";
|
|
623
|
-
value;
|
|
624
|
-
throttledTimeout;
|
|
625
|
-
constructor() {
|
|
626
|
-
this.throttledTimeout = throttledTimeout();
|
|
627
|
-
}
|
|
628
|
-
setValue(newVal) {
|
|
629
|
-
setIntermediateValue(newVal);
|
|
630
|
-
}
|
|
631
|
-
onChange(newVal) {
|
|
632
|
-
setIntermediateValue(newVal);
|
|
633
|
-
stateRef.current.throttledTimeout.call(300, callOnChange);
|
|
634
|
-
}
|
|
635
|
-
onFocus() {
|
|
636
|
-
let newState = new StateFocus();
|
|
637
|
-
newState.value = stateRef.current.value;
|
|
638
|
-
newState.lastValue = newState.value;
|
|
639
|
-
setState(newState);
|
|
640
|
-
}
|
|
641
|
-
onBlur() { }
|
|
642
|
-
onConfirm() {
|
|
643
|
-
callOnChange();
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
class StateFocus {
|
|
647
|
-
state = "focus";
|
|
648
|
-
value;
|
|
649
|
-
lastValue;
|
|
650
|
-
/**
|
|
651
|
-
* If we receive a new value, we keep track of it here. We set this to
|
|
652
|
-
* OVERRIDEN_VALUE_UNDEFINED if the value is meant to be discarded.
|
|
653
|
-
*/
|
|
654
|
-
overridenValue;
|
|
655
|
-
throttledTimeout;
|
|
656
|
-
constructor() {
|
|
657
|
-
this.overridenValue = OVERRIDEN_VALUE_UNDEFINED;
|
|
658
|
-
this.throttledTimeout = throttledTimeout();
|
|
659
|
-
}
|
|
660
|
-
setValue(newVal) {
|
|
661
|
-
if (stateRef.current.value === stateRef.current.lastValue) {
|
|
662
|
-
// No changes.
|
|
663
|
-
setIntermediateValue(newVal);
|
|
664
|
-
// Making sure we keep updating.
|
|
665
|
-
stateRef.current.lastValue = newVal;
|
|
666
|
-
}
|
|
667
|
-
else {
|
|
668
|
-
// There have been changes. Let's not bother the user.
|
|
669
|
-
stateRef.current.overridenValue = newVal;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
onChange(newVal) {
|
|
673
|
-
// Discard last setValue call
|
|
674
|
-
stateRef.current.overridenValue = OVERRIDEN_VALUE_UNDEFINED;
|
|
675
|
-
stateRef.current.lastValue = LAST_VALUE_CHANGED;
|
|
676
|
-
setIntermediateValue(newVal);
|
|
677
|
-
stateRef.current.throttledTimeout.call(300, callOnChange);
|
|
678
|
-
}
|
|
679
|
-
onFocus() { }
|
|
680
|
-
onBlur() {
|
|
681
|
-
// We need to make sure that we emit immediately. Do not want to leave
|
|
682
|
-
// user waiting.
|
|
683
|
-
// We can cancel this one.
|
|
684
|
-
stateRef.current.throttledTimeout.abort();
|
|
685
|
-
if (stateRef.current.overridenValue !== OVERRIDEN_VALUE_UNDEFINED) {
|
|
686
|
-
stateRef.current.value = stateRef.current.overridenValue;
|
|
687
|
-
}
|
|
688
|
-
let newVal = callOnChange();
|
|
689
|
-
setIntermediateValue(newVal);
|
|
690
|
-
let newState = new StateUnknown();
|
|
691
|
-
newState.value = newVal;
|
|
692
|
-
setState(newState);
|
|
693
|
-
}
|
|
694
|
-
onConfirm() {
|
|
695
|
-
callOnChange();
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
const [state, setState] = useState(() => {
|
|
699
|
-
let newState = new StateUnknown();
|
|
700
|
-
newState.value = intermediateValue;
|
|
701
|
-
return newState;
|
|
702
|
-
});
|
|
703
|
-
const stateRef = useUpdatedRef(state);
|
|
704
|
-
stateRef.current.value = intermediateValue;
|
|
705
|
-
return state;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
const Ui89InputText = React__default.forwardRef(function Ui89InputText({ value, placeholder, autoTrim = true, disabled, onChange, onTyping, onFocus, onBlur, }, ref) {
|
|
709
|
-
const inputRef = useRef(null);
|
|
710
|
-
const delayedState = useDelayedOnChange({
|
|
711
|
-
defaultValue: "",
|
|
712
|
-
value,
|
|
713
|
-
onChange,
|
|
714
|
-
filter(value) {
|
|
715
|
-
if (autoTrim) {
|
|
716
|
-
if (typeof value === "string") {
|
|
717
|
-
value = value.replace(/\s+/g, " ").trim();
|
|
1036
|
+
for (const value of props.value) {
|
|
1037
|
+
set.add(getValueKey(value));
|
|
1038
|
+
}
|
|
1039
|
+
return set;
|
|
1040
|
+
}, [props.value]);
|
|
1041
|
+
const renderRow = (props2) => {
|
|
1042
|
+
const key = getValueKey(props2.row);
|
|
1043
|
+
const value = valueSet.has(key);
|
|
1044
|
+
const label = props.renderOption !== undefined
|
|
1045
|
+
? props.renderOption({ option: props2.row, index: props2.index })
|
|
1046
|
+
: String(props2.row);
|
|
1047
|
+
function onChange(checked) {
|
|
1048
|
+
if (checked) {
|
|
1049
|
+
if (props.onSelect !== undefined) {
|
|
1050
|
+
props.onSelect(props2.row);
|
|
718
1051
|
}
|
|
719
1052
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
useImperativeHandle(ref, () => ({
|
|
724
|
-
focus: () => {
|
|
725
|
-
inputRef.current?.focus();
|
|
726
|
-
},
|
|
727
|
-
}));
|
|
728
|
-
return (React__default.createElement("div", null,
|
|
729
|
-
React__default.createElement("input", { ref: inputRef, className: [
|
|
730
|
-
"ui89-input-box",
|
|
731
|
-
disabled ? "ui89-input-box--disabled" : "",
|
|
732
|
-
].join(" "), type: "text", disabled: disabled, value: delayedState.value, onChange: (e) => delayedState.onChange(e.target.value), onBlur: delayedState.onBlur, onFocus: delayedState.onFocus, onKeyDown: (e) => {
|
|
733
|
-
if (e.key === "Enter") {
|
|
734
|
-
delayedState.onConfirm();
|
|
1053
|
+
else {
|
|
1054
|
+
if (props.onDeselect !== undefined) {
|
|
1055
|
+
props.onDeselect(props2.row);
|
|
735
1056
|
}
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
const [value, setValue] = useState(overrides.currentZIndex);
|
|
746
|
-
useEffect(() => {
|
|
747
|
-
if (open) {
|
|
748
|
-
setValue(overrides.nextZIndex());
|
|
1057
|
+
}
|
|
1058
|
+
if (props.onChange !== undefined) {
|
|
1059
|
+
if (checked) {
|
|
1060
|
+
props.onChange([...props.value, props2.row]);
|
|
1061
|
+
}
|
|
1062
|
+
else {
|
|
1063
|
+
props.onChange(props.value.filter((item) => getValueKey(item) !== key));
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
749
1066
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
1067
|
+
function toggle() {
|
|
1068
|
+
onChange(!value);
|
|
1069
|
+
}
|
|
1070
|
+
return (React__default.createElement("div", { style: {
|
|
1071
|
+
display: "flex",
|
|
1072
|
+
alignItems: "center",
|
|
1073
|
+
gap: "var(--ui89-safe-space)",
|
|
1074
|
+
height: "100%",
|
|
1075
|
+
} },
|
|
1076
|
+
React__default.createElement(Ui89InputCheckBox, { value: value, onChange: onChange }),
|
|
1077
|
+
React__default.createElement("div", { className: "ui89-text-ellipsis", style: { minWidth: 0, cursor: "pointer" }, onClick: toggle }, label)));
|
|
753
1078
|
};
|
|
1079
|
+
return (React__default.createElement("div", { style: {
|
|
1080
|
+
display: "flex",
|
|
1081
|
+
flexDirection: "column",
|
|
1082
|
+
maxHeight: props.maxHeight,
|
|
1083
|
+
} },
|
|
1084
|
+
React__default.createElement(Ui89VirtualList, { rows: props.options, renderRow: renderRow, getRowKey: props.getValueKey, rowHeight: props.optionHeight ?? 40, maxHeight: "100%" })));
|
|
754
1085
|
}
|
|
755
1086
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
Ui89PopoverPropsPlacement["right"] = "right";
|
|
762
|
-
Ui89PopoverPropsPlacement["rightStart"] = "rightStart";
|
|
763
|
-
Ui89PopoverPropsPlacement["rightEnd"] = "rightEnd";
|
|
764
|
-
Ui89PopoverPropsPlacement["bottom"] = "bottom";
|
|
765
|
-
Ui89PopoverPropsPlacement["bottomStart"] = "bottomStart";
|
|
766
|
-
Ui89PopoverPropsPlacement["bottomEnd"] = "bottomEnd";
|
|
767
|
-
Ui89PopoverPropsPlacement["left"] = "left";
|
|
768
|
-
Ui89PopoverPropsPlacement["leftStart"] = "leftStart";
|
|
769
|
-
Ui89PopoverPropsPlacement["leftEnd"] = "leftEnd";
|
|
770
|
-
})(Ui89PopoverPropsPlacement || (Ui89PopoverPropsPlacement = {}));
|
|
771
|
-
function toFloatingUiPlacement(placement) {
|
|
772
|
-
switch (placement) {
|
|
773
|
-
case Ui89PopoverPropsPlacement.top:
|
|
774
|
-
return "top";
|
|
775
|
-
case Ui89PopoverPropsPlacement.topStart:
|
|
776
|
-
return "top-start";
|
|
777
|
-
case Ui89PopoverPropsPlacement.topEnd:
|
|
778
|
-
return "top-end";
|
|
779
|
-
case Ui89PopoverPropsPlacement.right:
|
|
780
|
-
return "right";
|
|
781
|
-
case Ui89PopoverPropsPlacement.rightStart:
|
|
782
|
-
return "right-start";
|
|
783
|
-
case Ui89PopoverPropsPlacement.rightEnd:
|
|
784
|
-
return "right-end";
|
|
785
|
-
case Ui89PopoverPropsPlacement.bottom:
|
|
786
|
-
return "bottom";
|
|
787
|
-
case Ui89PopoverPropsPlacement.bottomStart:
|
|
788
|
-
return "bottom-start";
|
|
789
|
-
case Ui89PopoverPropsPlacement.bottomEnd:
|
|
790
|
-
return "bottom-end";
|
|
791
|
-
case Ui89PopoverPropsPlacement.left:
|
|
792
|
-
return "left";
|
|
793
|
-
case Ui89PopoverPropsPlacement.leftStart:
|
|
794
|
-
return "left-start";
|
|
795
|
-
case Ui89PopoverPropsPlacement.leftEnd:
|
|
796
|
-
return "left-end";
|
|
797
|
-
default:
|
|
798
|
-
throw new Error(`Unknown placement: ${placement}`);
|
|
1087
|
+
function Ui89InputCheckText(props) {
|
|
1088
|
+
function toggle() {
|
|
1089
|
+
if (props.onChange) {
|
|
1090
|
+
props.onChange(!props.value);
|
|
1091
|
+
}
|
|
799
1092
|
}
|
|
1093
|
+
return (React__default.createElement("span", { className: "ui89-input-check-text", onClick: toggle }, props.value ? "[X]" : "[ ]"));
|
|
800
1094
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
832
|
-
click,
|
|
833
|
-
dismiss,
|
|
834
|
-
role,
|
|
835
|
-
]);
|
|
836
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
837
|
-
props.renderContainer({
|
|
838
|
-
setRef: refs.setReference,
|
|
839
|
-
props: getReferenceProps(),
|
|
840
|
-
}),
|
|
841
|
-
props.open && (React__default.createElement(FloatingPortal, null,
|
|
842
|
-
React__default.createElement(FloatingFocusManager, { context: context, modal: false, initialFocus: -1 },
|
|
843
|
-
React__default.createElement(Ui89Scene, null,
|
|
844
|
-
React__default.createElement("div", { ref: refs.setFloating, style: {
|
|
845
|
-
...floatingStyles,
|
|
846
|
-
zIndex: zIndexer.value,
|
|
847
|
-
display: "flex",
|
|
848
|
-
flexDirection: "column",
|
|
849
|
-
} }, props.renderPopover())))))));
|
|
1095
|
+
|
|
1096
|
+
function Ui89InputFileUpload(props) {
|
|
1097
|
+
const inputRef = useRef(null);
|
|
1098
|
+
function implOnChange(e) {
|
|
1099
|
+
if (!props.onChange) {
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
if (e.target.files === null) {
|
|
1103
|
+
props.onChange(null);
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
if (e.target.files.length === 0) {
|
|
1107
|
+
props.onChange(null);
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
props.onChange(e.target.files[0]);
|
|
1111
|
+
// Reset the file input's value to allow selecting the same file again.
|
|
1112
|
+
e.target.value = "";
|
|
1113
|
+
}
|
|
1114
|
+
function onClick() {
|
|
1115
|
+
if (inputRef.current === null) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
inputRef.current.click();
|
|
1119
|
+
}
|
|
1120
|
+
return (React__default.createElement("div", null,
|
|
1121
|
+
React__default.createElement("input", { ref: inputRef, className: "ui89-typo-special", type: "file", onChange: implOnChange, accept: props.accept, hidden: true }),
|
|
1122
|
+
props.value ? (React__default.createElement("div", { className: "ui89-input-file-upload" },
|
|
1123
|
+
React__default.createElement(Ui89Button, { onClick: onClick }, "Change"),
|
|
1124
|
+
React__default.createElement("span", { className: `ui89-input-file-upload__info ui89-text-single-line ui89-text-single-line--ellipsis-left`, title: props.value.name }, props.value.name))) : (React__default.createElement(Ui89Button, { onClick: onClick }, "Upload"))));
|
|
850
1125
|
}
|
|
851
1126
|
|
|
852
1127
|
/**
|
|
@@ -920,7 +1195,7 @@ function Ui89InputSelect(props) {
|
|
|
920
1195
|
searchInput.current?.focus();
|
|
921
1196
|
}
|
|
922
1197
|
return (React__default.createElement("div", { className: "ui89-input-select" },
|
|
923
|
-
React__default.createElement(Ui89Popover, { open: isOpen, onOpenChange: setIsOpen, popoverOverflowMaxWidth: props.menuOverflowMaxWidth, renderContainer: (props2) => (React__default.createElement("div", { ref: props2.setRef, className: [
|
|
1198
|
+
React__default.createElement(Ui89Popover, { open: isOpen, onOpenChange: setIsOpen, popoverOverflowForce: true, popoverOverflowMaxWidth: props.menuOverflowMaxWidth, renderContainer: (props2) => (React__default.createElement("div", { ref: props2.setRef, className: [
|
|
924
1199
|
"ui89-input-box",
|
|
925
1200
|
"ui89-input-box--unselectable",
|
|
926
1201
|
"ui89-input-box--clickable",
|
|
@@ -936,62 +1211,6 @@ function Ui89InputSelect(props) {
|
|
|
936
1211
|
].join(" ") }, "<empty>")))) })));
|
|
937
1212
|
}
|
|
938
1213
|
|
|
939
|
-
function stringRemoveAllWhitespace(str) {
|
|
940
|
-
return str.replace(/\s+/g, "");
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
function isTextNumber(text) {
|
|
944
|
-
return /^\d+(\.\d+)?$/.test(text);
|
|
945
|
-
}
|
|
946
|
-
function displayText(value) {
|
|
947
|
-
if (value === undefined) {
|
|
948
|
-
// No idea how to display this.
|
|
949
|
-
return "";
|
|
950
|
-
}
|
|
951
|
-
else if (isNaN(value)) {
|
|
952
|
-
// No idea what to display.
|
|
953
|
-
return "";
|
|
954
|
-
}
|
|
955
|
-
return value.toString();
|
|
956
|
-
}
|
|
957
|
-
function dotsMakeMoreSense(value) {
|
|
958
|
-
return value.replaceAll(",", ".");
|
|
959
|
-
}
|
|
960
|
-
function Ui89InputTextNumber(props) {
|
|
961
|
-
const wrappedValue = useMemo(() => {
|
|
962
|
-
return displayText(props.value);
|
|
963
|
-
}, [props.value]);
|
|
964
|
-
function implOnChange(value) {
|
|
965
|
-
if (props.onChange === undefined) {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
if (value === "") {
|
|
969
|
-
// Use empty value.
|
|
970
|
-
props.onChange(props.emptyValue);
|
|
971
|
-
return;
|
|
972
|
-
}
|
|
973
|
-
value = stringRemoveAllWhitespace(value);
|
|
974
|
-
value = dotsMakeMoreSense(value);
|
|
975
|
-
if (!isTextNumber(value)) {
|
|
976
|
-
// We end here.
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
const numberValue = Number(value);
|
|
980
|
-
if (props.min !== undefined) {
|
|
981
|
-
if (numberValue <= props.min) {
|
|
982
|
-
value = String(props.min);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
if (props.max !== undefined) {
|
|
986
|
-
if (numberValue >= props.max) {
|
|
987
|
-
value = String(props.max);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
props.onChange(value);
|
|
991
|
-
}
|
|
992
|
-
return (React__default.createElement(Ui89InputText, { value: wrappedValue, onChange: implOnChange, disabled: props.disabled }));
|
|
993
|
-
}
|
|
994
|
-
|
|
995
1214
|
function Ui89InputNumber(props) {
|
|
996
1215
|
const wrappedValue = useMemo(() => {
|
|
997
1216
|
if (props.value !== undefined && props.value !== null) {
|
|
@@ -1018,7 +1237,7 @@ function Ui89InputNumber(props) {
|
|
|
1018
1237
|
}
|
|
1019
1238
|
}
|
|
1020
1239
|
}
|
|
1021
|
-
return (React__default.createElement(Ui89InputTextNumber, { emptyValue: props.emptyValue, value: wrappedValue, onChange: wrappedOnChange, min: props.min, max: props.max, disabled: props.disabled, precision: props.precision }));
|
|
1240
|
+
return (React__default.createElement(Ui89InputTextNumber, { emptyValue: props.emptyValue, value: wrappedValue, onChange: wrappedOnChange, min: props.min, max: props.max, disabled: props.disabled, precision: props.precision, textAlign: props.textAlign }));
|
|
1022
1241
|
}
|
|
1023
1242
|
|
|
1024
1243
|
function Ui89InputPassword({ value, placeholder, disabled, onChange, }) {
|
|
@@ -1092,13 +1311,13 @@ function Ui89ModalDialog({ open, size = "medium", children, topCenter, onRequest
|
|
|
1092
1311
|
const { createPortal } = useUi89();
|
|
1093
1312
|
const dialogClass = useMemo(() => {
|
|
1094
1313
|
return ["ui89-modal-dialog", open ? "ui89-modal-dialog--open" : ""].join(" ");
|
|
1095
|
-
}, [
|
|
1314
|
+
}, [open]);
|
|
1096
1315
|
const dialogBoxClass = useMemo(() => {
|
|
1097
1316
|
return [
|
|
1098
1317
|
"ui89-modal-dialog__box",
|
|
1099
1318
|
`ui89-modal-dialog__box--size-${size}`,
|
|
1100
1319
|
].join(" ");
|
|
1101
|
-
}, [size
|
|
1320
|
+
}, [size]);
|
|
1102
1321
|
function onClickBackdrop() {
|
|
1103
1322
|
if (onRequestClose !== undefined) {
|
|
1104
1323
|
onRequestClose();
|
|
@@ -1106,13 +1325,14 @@ function Ui89ModalDialog({ open, size = "medium", children, topCenter, onRequest
|
|
|
1106
1325
|
}
|
|
1107
1326
|
const vdom = (React__default.createElement("div", { className: dialogClass, role: "dialog", style: { zIndex: zIndexer.value } },
|
|
1108
1327
|
React__default.createElement("div", { className: "ui89-modal-dialog__backdrop", role: "presentation", onClick: onClickBackdrop }),
|
|
1109
|
-
React__default.createElement("div", { className:
|
|
1328
|
+
React__default.createElement("div", { className: "ui89-modal-dialog__content" },
|
|
1110
1329
|
React__default.createElement("div", { className: "ui89-modal-dialog__spacer" }),
|
|
1111
|
-
React__default.createElement(
|
|
1112
|
-
React__default.createElement(
|
|
1113
|
-
React__default.createElement(
|
|
1114
|
-
React__default.createElement(
|
|
1115
|
-
React__default.createElement(
|
|
1330
|
+
React__default.createElement("div", { className: dialogBoxClass },
|
|
1331
|
+
React__default.createElement(HoverShadow, null,
|
|
1332
|
+
React__default.createElement(GridExpandTrick, null,
|
|
1333
|
+
React__default.createElement(Ui89Scene, null,
|
|
1334
|
+
React__default.createElement(Ui89Card, { topCenter: topCenter },
|
|
1335
|
+
React__default.createElement(ScrollContainer, null, children)))))))));
|
|
1116
1336
|
return portalRoot !== null ? createPortal(vdom, portalRoot) : vdom;
|
|
1117
1337
|
}
|
|
1118
1338
|
|