@apia/components 4.0.50 → 4.0.58
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/LICENSE.md +6 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +117 -92
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
package/LICENSE.md
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -333,6 +333,7 @@ declare class TabsController<TabType extends TTab = TTab> {
|
|
|
333
333
|
*/
|
|
334
334
|
append(tab: TabType, behavior?: TAppendBehavior): void;
|
|
335
335
|
closeAll(closeFixedTabsAsWell?: boolean, force?: boolean): Promise<void>;
|
|
336
|
+
openAll(): Promise<void>;
|
|
336
337
|
closeOpenTab(force?: boolean): void;
|
|
337
338
|
closeToRight(targetId: string, force?: boolean): Promise<void>;
|
|
338
339
|
closeToLeft(targetId: string, force?: boolean): Promise<void>;
|
|
@@ -1911,13 +1912,14 @@ declare const FileCard: React$1.ForwardRefExoticComponent<{
|
|
|
1911
1912
|
};
|
|
1912
1913
|
} & React$1.RefAttributes<unknown>>;
|
|
1913
1914
|
|
|
1914
|
-
declare const Dropzone: ({ sx, className, messageError, progress, defaultLabel, draggingLabel, onClick, onChange, handleInfoButton, }: {
|
|
1915
|
+
declare const Dropzone: ({ sx, className, messageError, progress, defaultLabel, draggingLabel, onClick, onChange, handleInfoButton, infoButtonProps, }: {
|
|
1915
1916
|
sx?: ThemeUIStyleObject;
|
|
1916
1917
|
className?: string;
|
|
1917
1918
|
messageError?: string;
|
|
1918
1919
|
progress?: number;
|
|
1919
1920
|
defaultLabel?: string;
|
|
1920
1921
|
draggingLabel?: string;
|
|
1922
|
+
infoButtonProps?: any;
|
|
1921
1923
|
onClick?: (e: MouseEvent$1) => void;
|
|
1922
1924
|
onChange?: (e: File[]) => any;
|
|
1923
1925
|
handleInfoButton?: (e: MouseEvent$1) => void;
|
package/dist/index.js
CHANGED
|
@@ -1892,8 +1892,8 @@ const Confirm = ({
|
|
|
1892
1892
|
if (!showsCancelButton && showsConfirmButton) {
|
|
1893
1893
|
confirmText = confirmText || getLabel("btnClose").text;
|
|
1894
1894
|
} else if (showsConfirmButton) {
|
|
1895
|
-
confirmText = getLabel("btnCon").text;
|
|
1896
|
-
cancelText = getLabel("btnCan").text;
|
|
1895
|
+
confirmText = confirmText || getLabel("btnCon").text;
|
|
1896
|
+
cancelText = cancelText || getLabel("btnCan").text;
|
|
1897
1897
|
}
|
|
1898
1898
|
return /* @__PURE__ */ jsxs(
|
|
1899
1899
|
Box,
|
|
@@ -4134,7 +4134,7 @@ const getMaskForDateFormat = () => {
|
|
|
4134
4134
|
return "99/99/9999";
|
|
4135
4135
|
};
|
|
4136
4136
|
class DateInputController {
|
|
4137
|
-
constructor(
|
|
4137
|
+
constructor() {
|
|
4138
4138
|
__publicField$c(this, "props", {});
|
|
4139
4139
|
__publicField$c(this, "state", {});
|
|
4140
4140
|
__publicField$c(this, "_ref", null);
|
|
@@ -4142,22 +4142,26 @@ class DateInputController {
|
|
|
4142
4142
|
__publicField$c(this, "inputValue", "");
|
|
4143
4143
|
__publicField$c(this, "value", null);
|
|
4144
4144
|
__publicField$c(this, "previousValue", "");
|
|
4145
|
-
this.props.id = uniqueId$4(
|
|
4145
|
+
this.props.id = uniqueId$4("date-input");
|
|
4146
4146
|
makeAutoObservable(this);
|
|
4147
4147
|
}
|
|
4148
4148
|
clear() {
|
|
4149
|
-
this.
|
|
4150
|
-
|
|
4149
|
+
if (!this.state.disabled) {
|
|
4150
|
+
this.setValueFromString("");
|
|
4151
|
+
this.focus();
|
|
4152
|
+
}
|
|
4151
4153
|
}
|
|
4152
4154
|
focus() {
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
input
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4155
|
+
if (!this.state.disabled) {
|
|
4156
|
+
const input = this._ref?.querySelector("input");
|
|
4157
|
+
if (input) {
|
|
4158
|
+
input.focus();
|
|
4159
|
+
setTimeout(() => {
|
|
4160
|
+
window.requestAnimationFrame(() => {
|
|
4161
|
+
input.setSelectionRange(0, input.value.length);
|
|
4162
|
+
});
|
|
4163
|
+
}, 0);
|
|
4164
|
+
}
|
|
4161
4165
|
}
|
|
4162
4166
|
}
|
|
4163
4167
|
ref(el) {
|
|
@@ -4172,13 +4176,15 @@ class DateInputController {
|
|
|
4172
4176
|
);
|
|
4173
4177
|
}
|
|
4174
4178
|
onBlur(ev) {
|
|
4175
|
-
if (!this.
|
|
4176
|
-
if (this.
|
|
4177
|
-
this.
|
|
4178
|
-
|
|
4179
|
-
|
|
4179
|
+
if (!this.state.disabled) {
|
|
4180
|
+
if (!this.isInsidePicker(ev.relatedTarget)) {
|
|
4181
|
+
if (this.error) {
|
|
4182
|
+
this.inputValue = "";
|
|
4183
|
+
this.value = null;
|
|
4184
|
+
this.error = false;
|
|
4185
|
+
}
|
|
4186
|
+
this.props.onBlur?.(this.inputValue, ev);
|
|
4180
4187
|
}
|
|
4181
|
-
this.props.onBlur?.(this.inputValue, ev);
|
|
4182
4188
|
}
|
|
4183
4189
|
}
|
|
4184
4190
|
onInputChange(ev) {
|
|
@@ -4188,76 +4194,82 @@ class DateInputController {
|
|
|
4188
4194
|
this.setValue(value);
|
|
4189
4195
|
}
|
|
4190
4196
|
openCalendar(ev) {
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4197
|
+
if (!this.state.disabled) {
|
|
4198
|
+
const tooltip = ApiaUtil.instance.tooltips.open({
|
|
4199
|
+
attachToElement() {
|
|
4200
|
+
return ev.target.closest("button");
|
|
4201
|
+
},
|
|
4202
|
+
attachToElementAnchorPoint: "center",
|
|
4203
|
+
closeOnClick: false,
|
|
4204
|
+
closeOnClickOut: true,
|
|
4205
|
+
closeOnEscape: true,
|
|
4206
|
+
closeOnMouseLeaveTooltip: false,
|
|
4207
|
+
closeOnMouseLeaveAttachedElement: false,
|
|
4208
|
+
closeOnScrollOut: true,
|
|
4209
|
+
children: /* @__PURE__ */ jsx("div", { id: this.calendarElementId, children: /* @__PURE__ */ jsx(
|
|
4210
|
+
CalModal,
|
|
4211
|
+
{
|
|
4212
|
+
calValue: this.value || /* @__PURE__ */ new Date(),
|
|
4213
|
+
locale: DEFAULT_LOCALE,
|
|
4214
|
+
handleClickDay: (date) => {
|
|
4215
|
+
tooltip.close();
|
|
4216
|
+
this.onCalendarSelect(date);
|
|
4217
|
+
this.focus();
|
|
4218
|
+
}
|
|
4211
4219
|
}
|
|
4220
|
+
) }),
|
|
4221
|
+
initialFocusGetter(el) {
|
|
4222
|
+
return el.querySelector(`.react-calendar__tile--active`);
|
|
4223
|
+
},
|
|
4224
|
+
minSize: { width: 350, height: 310 },
|
|
4225
|
+
onClose: () => {
|
|
4226
|
+
window.requestAnimationFrame(() => {
|
|
4227
|
+
if (!this.isInsidePicker(document.activeElement)) {
|
|
4228
|
+
this.props.onBlur?.(this.inputValue);
|
|
4229
|
+
}
|
|
4230
|
+
});
|
|
4212
4231
|
}
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
return el.querySelector(`.react-calendar__tile--active`);
|
|
4216
|
-
},
|
|
4217
|
-
minSize: { width: 350, height: 310 },
|
|
4218
|
-
onClose: () => {
|
|
4219
|
-
window.requestAnimationFrame(() => {
|
|
4220
|
-
if (!this.isInsidePicker(document.activeElement)) {
|
|
4221
|
-
this.props.onBlur?.(this.inputValue);
|
|
4222
|
-
}
|
|
4223
|
-
});
|
|
4224
|
-
}
|
|
4225
|
-
});
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4226
4234
|
}
|
|
4227
4235
|
setValueFromString(str, fire = true) {
|
|
4228
|
-
if (
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4236
|
+
if (!this.state.disabled) {
|
|
4237
|
+
if (str === "" || str.replaceAll("_", "9") === getMaskForDateFormat()) {
|
|
4238
|
+
this.inputValue = "";
|
|
4239
|
+
this.setValue(null, fire);
|
|
4240
|
+
} else if (str !== this.inputValue) {
|
|
4241
|
+
const hasPlaceHolder = str.match(/_/);
|
|
4242
|
+
if (!hasPlaceHolder) {
|
|
4243
|
+
const value = dayjs(str, dateFormat);
|
|
4244
|
+
const formattedDate = value.format(dateFormat);
|
|
4245
|
+
if (value.isValid() && formattedDate === str) {
|
|
4246
|
+
this.setValue(value.toDate(), fire);
|
|
4247
|
+
} else {
|
|
4248
|
+
this.inputValue = str;
|
|
4249
|
+
this.props.onError?.(getLabel("msgInvalidDate").text);
|
|
4250
|
+
this.error = true;
|
|
4251
|
+
}
|
|
4238
4252
|
} else {
|
|
4239
4253
|
this.inputValue = str;
|
|
4240
|
-
this.props.onError?.(getLabel("msgInvalidDate").text);
|
|
4241
|
-
this.error = true;
|
|
4242
4254
|
}
|
|
4243
|
-
} else {
|
|
4244
|
-
this.inputValue = str;
|
|
4245
4255
|
}
|
|
4246
4256
|
}
|
|
4247
4257
|
}
|
|
4248
4258
|
async setValue(date, fire = true) {
|
|
4249
|
-
this.
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4259
|
+
if (!this.state.disabled) {
|
|
4260
|
+
this.error = false;
|
|
4261
|
+
if (date !== this.value) {
|
|
4262
|
+
const dateValue = dayjs(date);
|
|
4263
|
+
const newValue = dateValue.isValid() ? dateValue.format(dateFormat) : "";
|
|
4264
|
+
const res = fire ? await this.props.onChange?.(newValue) : null;
|
|
4265
|
+
this.inputValue = newValue || "";
|
|
4266
|
+
if (typeof res !== "string") {
|
|
4267
|
+
this.value = date;
|
|
4268
|
+
} else {
|
|
4269
|
+
this.error = true;
|
|
4270
|
+
this.value = null;
|
|
4271
|
+
this.props.onError?.(res);
|
|
4272
|
+
}
|
|
4261
4273
|
}
|
|
4262
4274
|
}
|
|
4263
4275
|
}
|
|
@@ -4290,10 +4302,7 @@ const DateInput = observer(
|
|
|
4290
4302
|
value: outerValue,
|
|
4291
4303
|
props
|
|
4292
4304
|
}) => {
|
|
4293
|
-
const controller = useMemo(
|
|
4294
|
-
() => new DateInputController(outerId),
|
|
4295
|
-
[outerId]
|
|
4296
|
-
);
|
|
4305
|
+
const controller = useMemo(() => new DateInputController(), []);
|
|
4297
4306
|
controller.render({
|
|
4298
4307
|
className,
|
|
4299
4308
|
disabled,
|
|
@@ -4317,7 +4326,7 @@ const DateInput = observer(
|
|
|
4317
4326
|
children: /* @__PURE__ */ jsx(
|
|
4318
4327
|
IconInput,
|
|
4319
4328
|
{
|
|
4320
|
-
additionalButtons: controller.inputValue && getMaskForDateFormat().replaceAll("9", DEFAULT_MASK_PLACEHOLDER) !== controller.inputValue ? /* @__PURE__ */ jsx(
|
|
4329
|
+
additionalButtons: controller.inputValue && getMaskForDateFormat().replaceAll("9", DEFAULT_MASK_PLACEHOLDER) !== controller.inputValue && !disabled ? /* @__PURE__ */ jsx(
|
|
4321
4330
|
Close,
|
|
4322
4331
|
{
|
|
4323
4332
|
as: "button",
|
|
@@ -4335,8 +4344,6 @@ const DateInput = observer(
|
|
|
4335
4344
|
disabled,
|
|
4336
4345
|
onChange: controller.onInputChange.bind(controller),
|
|
4337
4346
|
value: controller.inputValue,
|
|
4338
|
-
id: outerId,
|
|
4339
|
-
name: outerId,
|
|
4340
4347
|
...props
|
|
4341
4348
|
},
|
|
4342
4349
|
mask: getMaskForDateFormat(),
|
|
@@ -7650,7 +7657,8 @@ const Dropzone = ({
|
|
|
7650
7657
|
draggingLabel = getLabel("lblDroping").text,
|
|
7651
7658
|
onClick,
|
|
7652
7659
|
onChange,
|
|
7653
|
-
handleInfoButton
|
|
7660
|
+
handleInfoButton,
|
|
7661
|
+
infoButtonProps
|
|
7654
7662
|
}) => {
|
|
7655
7663
|
const innerSx = messageError ? { borderLeft: "2px solid", borderColor: "danger" } : {};
|
|
7656
7664
|
const fileInputRef = useRef(null);
|
|
@@ -7724,6 +7732,7 @@ const Dropzone = ({
|
|
|
7724
7732
|
handleInfoButton && /* @__PURE__ */ jsx(
|
|
7725
7733
|
IconButton,
|
|
7726
7734
|
{
|
|
7735
|
+
...infoButtonProps,
|
|
7727
7736
|
className: "info",
|
|
7728
7737
|
iconSize: "Sm",
|
|
7729
7738
|
icon: "Info",
|
|
@@ -9147,10 +9156,15 @@ const DefaultTabsLabelRenderer = observer(
|
|
|
9147
9156
|
);
|
|
9148
9157
|
const handleMouseDown = React__default.useCallback(
|
|
9149
9158
|
(ev) => {
|
|
9159
|
+
if (ev.shiftKey && ev.button === 0) {
|
|
9160
|
+
tab.controller.openAll();
|
|
9161
|
+
return;
|
|
9162
|
+
}
|
|
9150
9163
|
if (ev.button === 1) {
|
|
9151
9164
|
tab.close();
|
|
9152
|
-
} else if (ev.button === 0)
|
|
9165
|
+
} else if (ev.button === 0) {
|
|
9153
9166
|
tab.open();
|
|
9167
|
+
}
|
|
9154
9168
|
},
|
|
9155
9169
|
[tab]
|
|
9156
9170
|
);
|
|
@@ -9510,6 +9524,13 @@ class TabsController {
|
|
|
9510
9524
|
}
|
|
9511
9525
|
}
|
|
9512
9526
|
}
|
|
9527
|
+
async openAll() {
|
|
9528
|
+
for (const tab of this.tabsList) {
|
|
9529
|
+
if (!tab.state.isFixed) {
|
|
9530
|
+
tab.open(false);
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9513
9534
|
closeOpenTab(force) {
|
|
9514
9535
|
const openTab = this.activeTab;
|
|
9515
9536
|
openTab?.close(force);
|
|
@@ -10321,7 +10342,7 @@ class Parameter {
|
|
|
10321
10342
|
this.state.values = this.getValues().filter((x) => !!x && x !== value);
|
|
10322
10343
|
}
|
|
10323
10344
|
asPayloadElement() {
|
|
10324
|
-
return this.state.type === "label" ? null : toJS(this.state.values);
|
|
10345
|
+
return this.state.type === "label" ? null : toJS(this.state.values.filter((x) => !!x));
|
|
10325
10346
|
}
|
|
10326
10347
|
includes(value) {
|
|
10327
10348
|
return this.state.values.includes(value);
|
|
@@ -10371,7 +10392,8 @@ const ParameterRender = observer(
|
|
|
10371
10392
|
onChange: (ev) => {
|
|
10372
10393
|
parameter.setValue(ev.target.value, index);
|
|
10373
10394
|
},
|
|
10374
|
-
value: parameter.state.values[index] ?? ""
|
|
10395
|
+
value: parameter.state.values[index] ?? "",
|
|
10396
|
+
className: parameter.state.validationError ? "requiredFilter__Border" : ""
|
|
10375
10397
|
}
|
|
10376
10398
|
),
|
|
10377
10399
|
error
|
|
@@ -10407,7 +10429,8 @@ const ParameterRender = observer(
|
|
|
10407
10429
|
index
|
|
10408
10430
|
);
|
|
10409
10431
|
},
|
|
10410
|
-
value: parameter.state.values.join("")
|
|
10432
|
+
value: parameter.state.values.join(""),
|
|
10433
|
+
className: parameter.state.validationError ? "requiredFilter__Border" : ""
|
|
10411
10434
|
}
|
|
10412
10435
|
),
|
|
10413
10436
|
error
|
|
@@ -10430,7 +10453,8 @@ const ParameterRender = observer(
|
|
|
10430
10453
|
onChange: (ev) => {
|
|
10431
10454
|
parameter.setValue(String(ev.target.checked), index);
|
|
10432
10455
|
},
|
|
10433
|
-
checked: parameter.state.values[index] === "true"
|
|
10456
|
+
checked: parameter.state.values[index] === "true",
|
|
10457
|
+
className: parameter.state.validationError ? "requiredFilter__Border" : ""
|
|
10434
10458
|
}
|
|
10435
10459
|
),
|
|
10436
10460
|
error
|
|
@@ -10454,6 +10478,7 @@ const ParameterRender = observer(
|
|
|
10454
10478
|
parameter.setValue(ev.target.value, index);
|
|
10455
10479
|
},
|
|
10456
10480
|
value: parameter.state.values[index],
|
|
10481
|
+
className: parameter.state.validationError ? "requiredFilter__Border" : "",
|
|
10457
10482
|
children: arrayOrArray(parameter.state.possibleValues).map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.text }))
|
|
10458
10483
|
}
|
|
10459
10484
|
),
|