@mw-kit/mw-ui 1.8.1 → 1.8.3
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.js +46 -16
- package/dist/index.mjs +46 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13464,30 +13464,60 @@ var SelectAllContainer = import_styled_components43.default.div`
|
|
|
13464
13464
|
|
|
13465
13465
|
// src/components/Input/components/Select/hooks/SelectMultiple/components/Header/index.tsx
|
|
13466
13466
|
var import_jsx_runtime324 = require("react/jsx-runtime");
|
|
13467
|
-
var
|
|
13467
|
+
var CheckAll = () => {
|
|
13468
13468
|
const context = useContext3();
|
|
13469
|
-
if (!context.props.search) {
|
|
13470
|
-
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(import_react33.default.Fragment, {});
|
|
13471
|
-
}
|
|
13472
13469
|
const {
|
|
13473
13470
|
checked: [checked, setChecked],
|
|
13474
|
-
searchInput: [searchInput, setSearchInput],
|
|
13475
13471
|
options
|
|
13476
13472
|
} = context;
|
|
13473
|
+
const maxCheck = options.reduce((count, o, idx) => {
|
|
13474
|
+
var _a;
|
|
13475
|
+
if (o.disabled) return count;
|
|
13476
|
+
const rule = (_a = o.rules) == null ? void 0 : _a.some((rule2) => rule2(idx, o.data) !== true);
|
|
13477
|
+
if (rule) return count;
|
|
13478
|
+
return count + 1;
|
|
13479
|
+
}, 0);
|
|
13477
13480
|
const onClick = () => {
|
|
13478
|
-
setChecked(
|
|
13479
|
-
(prev
|
|
13480
|
-
|
|
13481
|
+
setChecked((prev) => {
|
|
13482
|
+
if (prev.length >= maxCheck) return [];
|
|
13483
|
+
const checked2 = options.reduce(
|
|
13484
|
+
(checked3, o, idx) => {
|
|
13485
|
+
var _a;
|
|
13486
|
+
if (o.disabled) return checked3;
|
|
13487
|
+
const rule = (_a = o.rules) == null ? void 0 : _a.some((rule2) => rule2(idx, o.data) !== true);
|
|
13488
|
+
if (rule) return checked3;
|
|
13489
|
+
return [...checked3, { value: o.value, data: o.data }];
|
|
13490
|
+
},
|
|
13491
|
+
[]
|
|
13492
|
+
);
|
|
13493
|
+
return checked2;
|
|
13494
|
+
});
|
|
13481
13495
|
};
|
|
13482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
")"
|
|
13488
|
-
] }),
|
|
13489
|
-
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)(Link_default2, { children: "Selecionar todos", onClick })
|
|
13496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(SelectAllContainer, { children: [
|
|
13497
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsxs)("b", { children: [
|
|
13498
|
+
"Selecionados (",
|
|
13499
|
+
checked.length,
|
|
13500
|
+
")"
|
|
13490
13501
|
] }),
|
|
13502
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
13503
|
+
Link_default2,
|
|
13504
|
+
{
|
|
13505
|
+
children: checked.length >= maxCheck ? "Desmarcar todos" : "Selecionar todos",
|
|
13506
|
+
onClick
|
|
13507
|
+
}
|
|
13508
|
+
)
|
|
13509
|
+
] });
|
|
13510
|
+
};
|
|
13511
|
+
var Header3 = () => {
|
|
13512
|
+
const context = useContext3();
|
|
13513
|
+
if (!context.props.search) {
|
|
13514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(import_react33.default.Fragment, {});
|
|
13515
|
+
}
|
|
13516
|
+
const {
|
|
13517
|
+
searchInput: [searchInput, setSearchInput]
|
|
13518
|
+
} = context;
|
|
13519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(HeaderContainer2, { children: [
|
|
13520
|
+
context.props.selectAll && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(CheckAll, {}),
|
|
13491
13521
|
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
|
|
13492
13522
|
Input_default,
|
|
13493
13523
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -13408,30 +13408,60 @@ var SelectAllContainer = styled40.div`
|
|
|
13408
13408
|
|
|
13409
13409
|
// src/components/Input/components/Select/hooks/SelectMultiple/components/Header/index.tsx
|
|
13410
13410
|
import { jsx as jsx324, jsxs as jsxs159 } from "react/jsx-runtime";
|
|
13411
|
-
var
|
|
13411
|
+
var CheckAll = () => {
|
|
13412
13412
|
const context = useContext3();
|
|
13413
|
-
if (!context.props.search) {
|
|
13414
|
-
return /* @__PURE__ */ jsx324(React30.Fragment, {});
|
|
13415
|
-
}
|
|
13416
13413
|
const {
|
|
13417
13414
|
checked: [checked, setChecked],
|
|
13418
|
-
searchInput: [searchInput, setSearchInput],
|
|
13419
13415
|
options
|
|
13420
13416
|
} = context;
|
|
13417
|
+
const maxCheck = options.reduce((count, o, idx) => {
|
|
13418
|
+
var _a;
|
|
13419
|
+
if (o.disabled) return count;
|
|
13420
|
+
const rule = (_a = o.rules) == null ? void 0 : _a.some((rule2) => rule2(idx, o.data) !== true);
|
|
13421
|
+
if (rule) return count;
|
|
13422
|
+
return count + 1;
|
|
13423
|
+
}, 0);
|
|
13421
13424
|
const onClick = () => {
|
|
13422
|
-
setChecked(
|
|
13423
|
-
(prev
|
|
13424
|
-
|
|
13425
|
+
setChecked((prev) => {
|
|
13426
|
+
if (prev.length >= maxCheck) return [];
|
|
13427
|
+
const checked2 = options.reduce(
|
|
13428
|
+
(checked3, o, idx) => {
|
|
13429
|
+
var _a;
|
|
13430
|
+
if (o.disabled) return checked3;
|
|
13431
|
+
const rule = (_a = o.rules) == null ? void 0 : _a.some((rule2) => rule2(idx, o.data) !== true);
|
|
13432
|
+
if (rule) return checked3;
|
|
13433
|
+
return [...checked3, { value: o.value, data: o.data }];
|
|
13434
|
+
},
|
|
13435
|
+
[]
|
|
13436
|
+
);
|
|
13437
|
+
return checked2;
|
|
13438
|
+
});
|
|
13425
13439
|
};
|
|
13426
|
-
return /* @__PURE__ */ jsxs159(
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
")"
|
|
13432
|
-
] }),
|
|
13433
|
-
/* @__PURE__ */ jsx324(Link_default2, { children: "Selecionar todos", onClick })
|
|
13440
|
+
return /* @__PURE__ */ jsxs159(SelectAllContainer, { children: [
|
|
13441
|
+
/* @__PURE__ */ jsxs159("b", { children: [
|
|
13442
|
+
"Selecionados (",
|
|
13443
|
+
checked.length,
|
|
13444
|
+
")"
|
|
13434
13445
|
] }),
|
|
13446
|
+
/* @__PURE__ */ jsx324(
|
|
13447
|
+
Link_default2,
|
|
13448
|
+
{
|
|
13449
|
+
children: checked.length >= maxCheck ? "Desmarcar todos" : "Selecionar todos",
|
|
13450
|
+
onClick
|
|
13451
|
+
}
|
|
13452
|
+
)
|
|
13453
|
+
] });
|
|
13454
|
+
};
|
|
13455
|
+
var Header3 = () => {
|
|
13456
|
+
const context = useContext3();
|
|
13457
|
+
if (!context.props.search) {
|
|
13458
|
+
return /* @__PURE__ */ jsx324(React30.Fragment, {});
|
|
13459
|
+
}
|
|
13460
|
+
const {
|
|
13461
|
+
searchInput: [searchInput, setSearchInput]
|
|
13462
|
+
} = context;
|
|
13463
|
+
return /* @__PURE__ */ jsxs159(HeaderContainer2, { children: [
|
|
13464
|
+
context.props.selectAll && /* @__PURE__ */ jsx324(CheckAll, {}),
|
|
13435
13465
|
/* @__PURE__ */ jsx324(
|
|
13436
13466
|
Input_default,
|
|
13437
13467
|
{
|