iguazio.dashboard-react-controls 3.2.2 → 3.2.4
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/components/FormChipCell/FormChip/FormChip.d.ts +3 -1
- package/dist/components/FormChipCell/FormChip/FormChip.d.ts.map +1 -1
- package/dist/components/FormChipCell/FormChip/FormChip.mjs +30 -27
- package/dist/components/FormChipCell/FormChip/FormChip.mjs.map +1 -1
- package/dist/components/FormChipCell/FormChipCell.d.ts +7 -2
- package/dist/components/FormChipCell/FormChipCell.d.ts.map +1 -1
- package/dist/components/FormChipCell/FormChipCell.mjs +131 -124
- package/dist/components/FormChipCell/FormChipCell.mjs.map +1 -1
- package/dist/components/FormChipCell/FormChipCellView.d.ts +8 -1
- package/dist/components/FormChipCell/FormChipCellView.d.ts.map +1 -1
- package/dist/components/FormChipCell/FormChipCellView.mjs +105 -96
- package/dist/components/FormChipCell/FormChipCellView.mjs.map +1 -1
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.d.ts +3 -1
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.d.ts.map +1 -1
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs +189 -183
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs.map +1 -1
- package/dist/components/ReadOnlyChips/ReadOnlyChips.d.ts +22 -0
- package/dist/components/ReadOnlyChips/ReadOnlyChips.d.ts.map +1 -0
- package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs +41 -0
- package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs.map +1 -0
- package/dist/components/TableCell/TableCell.d.ts.map +1 -1
- package/dist/components/TableCell/TableCell.mjs +39 -32
- package/dist/components/TableCell/TableCell.mjs.map +1 -1
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +52 -54
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/useChipCell.hook.d.ts.map +1 -1
- package/dist/hooks/useChipCell.hook.mjs +52 -49
- package/dist/hooks/useChipCell.hook.mjs.map +1 -1
- package/dist/images/add.svg.mjs +3 -2
- package/dist/images/add.svg.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.mjs +53 -49
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/components/Chip/Chip.d.ts +0 -3
- package/dist/components/Chip/Chip.d.ts.map +0 -1
- package/dist/components/Chip/Chip.mjs +0 -153
- package/dist/components/Chip/Chip.mjs.map +0 -1
- package/dist/components/Chip/Chip.stories.d.ts +0 -26
- package/dist/components/Chip/Chip.stories.d.ts.map +0 -1
- package/dist/components/ChipCell/ChipCell.d.ts +0 -3
- package/dist/components/ChipCell/ChipCell.d.ts.map +0 -1
- package/dist/components/ChipCell/ChipCell.mjs +0 -212
- package/dist/components/ChipCell/ChipCell.mjs.map +0 -1
- package/dist/components/ChipCell/ChipTooltip/ChipTooltip.d.ts +0 -15
- package/dist/components/ChipCell/ChipTooltip/ChipTooltip.d.ts.map +0 -1
- package/dist/components/ChipCell/ChipTooltip/ChipTooltip.mjs +0 -36
- package/dist/components/ChipCell/ChipTooltip/ChipTooltip.mjs.map +0 -1
- package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.d.ts +0 -35
- package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.d.ts.map +0 -1
- package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs +0 -73
- package/dist/components/ChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs.map +0 -1
- package/dist/components/ChipForm/ChipForm.mjs +0 -184
- package/dist/components/ChipForm/ChipForm.mjs.map +0 -1
- package/dist/images/add.svg2.mjs +0 -6
- package/dist/images/add.svg2.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default FormChip;
|
|
2
|
-
declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSizeIsRecalculated, chipOptions, editConfig, handleEditChip, handleRemoveChip, handleToEditMode, isEditable, keyName, meta, setChipsSizes, setEditConfig, validationRules, valueName }: {
|
|
2
|
+
declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSizeIsRecalculated, chipOptions, editConfig, handleEditChip, handleRemoveChip, handleToEditMode, isDeletable, isEditable, keyName, meta, setChipsSizes, setEditConfig, validationRules, valueName }: {
|
|
3
3
|
chip: any;
|
|
4
4
|
chipIndex: any;
|
|
5
5
|
chipSizeIsRecalculated: any;
|
|
@@ -16,6 +16,7 @@ declare function FormChip({ chip, chipIndex, chipSizeIsRecalculated, setChipSize
|
|
|
16
16
|
handleEditChip: any;
|
|
17
17
|
handleRemoveChip: any;
|
|
18
18
|
handleToEditMode: any;
|
|
19
|
+
isDeletable?: boolean;
|
|
19
20
|
isEditable?: boolean;
|
|
20
21
|
keyName?: string;
|
|
21
22
|
meta: any;
|
|
@@ -36,6 +37,7 @@ declare namespace FormChip {
|
|
|
36
37
|
export let handleEditChip: any;
|
|
37
38
|
export let handleRemoveChip: any;
|
|
38
39
|
export let handleToEditMode: any;
|
|
40
|
+
export let isDeletable: any;
|
|
39
41
|
export let isEditable: any;
|
|
40
42
|
export let keyName: any;
|
|
41
43
|
export let meta: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChip.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"names":[],"mappings":";AAyBA
|
|
1
|
+
{"version":3,"file":"FormChip.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"names":[],"mappings":";AAyBA;;;;;;;;;;;;;;;;;;;;;;;;;0BA6DC;;;;;;;;;;;;;;;;;;;;;;;6BAjE4B,gBAAgB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import F, { useLayoutEffect as T, forwardRef as k } from "react";
|
|
3
3
|
import e from "prop-types";
|
|
4
|
-
import
|
|
5
|
-
import { CHIP_OPTIONS as
|
|
4
|
+
import w from "../NewChipForm/NewChipForm.mjs";
|
|
5
|
+
import { CHIP_OPTIONS as O } from "../../../types.mjs";
|
|
6
6
|
/* empty css */
|
|
7
7
|
let i = ({
|
|
8
8
|
chip: f,
|
|
9
9
|
chipIndex: r,
|
|
10
|
-
chipSizeIsRecalculated:
|
|
10
|
+
chipSizeIsRecalculated: s,
|
|
11
11
|
setChipSizeIsRecalculated: c,
|
|
12
12
|
chipOptions: m = {
|
|
13
13
|
background: "purple",
|
|
@@ -21,25 +21,26 @@ let i = ({
|
|
|
21
21
|
handleEditChip: b,
|
|
22
22
|
handleRemoveChip: h,
|
|
23
23
|
handleToEditMode: C,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
isDeletable: q = !1,
|
|
25
|
+
isEditable: g = !1,
|
|
26
|
+
keyName: a = "",
|
|
27
|
+
meta: y,
|
|
27
28
|
setChipsSizes: t,
|
|
28
|
-
setEditConfig:
|
|
29
|
-
validationRules:
|
|
30
|
-
valueName:
|
|
31
|
-
},
|
|
32
|
-
const u =
|
|
33
|
-
return
|
|
34
|
-
u.current && t &&
|
|
35
|
-
var o,
|
|
29
|
+
setEditConfig: j,
|
|
30
|
+
validationRules: E = {},
|
|
31
|
+
valueName: N = ""
|
|
32
|
+
}, v) => {
|
|
33
|
+
const u = F.useRef();
|
|
34
|
+
return T(() => {
|
|
35
|
+
u.current && t && s && t((d) => {
|
|
36
|
+
var o, n, l;
|
|
36
37
|
return {
|
|
37
38
|
...d,
|
|
38
|
-
[r]: ((l = (
|
|
39
|
+
[r]: ((l = (n = (o = u.current) == null ? void 0 : o.getBoundingClientRect) == null ? void 0 : n.call(o)) == null ? void 0 : l.width) ?? 50
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
|
-
}, [r,
|
|
42
|
-
|
|
42
|
+
}, [r, s, t]), /* @__PURE__ */ p("div", { onClick: (d) => C(d, r, a), ref: u, children: /* @__PURE__ */ p(
|
|
43
|
+
w,
|
|
43
44
|
{
|
|
44
45
|
chip: f,
|
|
45
46
|
chipIndex: r,
|
|
@@ -47,30 +48,32 @@ let i = ({
|
|
|
47
48
|
className: "input-label-key",
|
|
48
49
|
editConfig: R,
|
|
49
50
|
handleRemoveChip: h,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
isDeletable: q,
|
|
52
|
+
isEditable: g,
|
|
53
|
+
keyName: a,
|
|
54
|
+
meta: y,
|
|
53
55
|
onChange: b,
|
|
54
|
-
ref:
|
|
56
|
+
ref: v,
|
|
55
57
|
setChipSizeIsRecalculated: c,
|
|
56
|
-
setEditConfig:
|
|
57
|
-
validationRules:
|
|
58
|
-
valueName:
|
|
58
|
+
setEditConfig: j,
|
|
59
|
+
validationRules: E,
|
|
60
|
+
valueName: N
|
|
59
61
|
}
|
|
60
62
|
) });
|
|
61
63
|
};
|
|
62
|
-
i =
|
|
64
|
+
i = k(i);
|
|
63
65
|
i.displayName = "FormChip";
|
|
64
66
|
i.propTypes = {
|
|
65
67
|
chip: e.object.isRequired,
|
|
66
68
|
chipSizeIsRecalculated: e.bool.isRequired,
|
|
67
69
|
setChipSizeIsRecalculated: e.func.isRequired,
|
|
68
70
|
chipIndex: e.number.isRequired,
|
|
69
|
-
chipOptions:
|
|
71
|
+
chipOptions: O,
|
|
70
72
|
editConfig: e.object.isRequired,
|
|
71
73
|
handleEditChip: e.func.isRequired,
|
|
72
74
|
handleRemoveChip: e.func.isRequired,
|
|
73
75
|
handleToEditMode: e.func.isRequired,
|
|
76
|
+
isDeletable: e.bool,
|
|
74
77
|
isEditable: e.bool,
|
|
75
78
|
keyName: e.string,
|
|
76
79
|
meta: e.object.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAC;AAAA,EACnB,WAAAC,IAAY;AACd,GACAC,MACG;AACG,QAAAC,IAAUC,EAAM,OAAO;AAC7B,SAAAC,EAAgB,MAAM;AAChB,IAAAF,EAAQ,WAAWL,
|
|
1
|
+
{"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isDeletable","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAC;AAAA,EACnB,WAAAC,IAAY;AACd,GACAC,MACG;AACG,QAAAC,IAAUC,EAAM,OAAO;AAC7B,SAAAC,EAAgB,MAAM;AAChB,IAAAF,EAAQ,WAAWL,KAAiBX,KACtCW,EAAc,CAAUQ,MAAA;;AAAA;AAAA,QACtB,GAAGA;AAAA,QACH,CAACpB,CAAS,KAAGqB,KAAAC,KAAAC,IAAAN,EAAQ,YAAR,gBAAAM,EAAiB,0BAAjB,gBAAAD,EAAA,KAAAC,OAAA,gBAAAF,EAA4C,UAAS;AAAA,MAAA;AAAA,KAClE;AAAA,EAEH,GAAA,CAACrB,GAAWC,GAAwBW,CAAa,CAAC,GAGnD,gBAAAY,EAAC,OAAI,EAAA,SAAS,CAASC,MAAAlB,EAAiBkB,GAAOzB,GAAWU,CAAO,GAAG,KAAKO,GACvE,UAAA,gBAAAO;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,MAAA3B;AAAA,MACA,WAAAC;AAAA,MACA,aAAAG;AAAA,MACA,WAAU;AAAA,MACV,YAAAC;AAAA,MACA,kBAAAE;AAAA,MACA,aAAAE;AAAA,MACA,YAAAC;AAAA,MACA,SAAAC;AAAA,MACA,MAAAC;AAAA,MACA,UAAUN;AAAA,MACV,KAAAW;AAAA,MACA,2BAAAd;AAAA,MACA,eAAAW;AAAA,MACA,iBAAAC;AAAA,MACA,WAAAC;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEAjB,IAAW6B,EAAW7B,CAAQ;AAE9BA,EAAS,cAAc;AAEvBA,EAAS,YAAY;AAAA,EACnB,MAAM8B,EAAU,OAAO;AAAA,EACvB,wBAAwBA,EAAU,KAAK;AAAA,EACvC,2BAA2BA,EAAU,KAAK;AAAA,EAC1C,WAAWA,EAAU,OAAO;AAAA,EAC5B,aAAaC;AAAA,EACb,YAAYD,EAAU,OAAO;AAAA,EAC7B,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,SAASA,EAAU;AAAA,EACnB,MAAMA,EAAU,OAAO;AAAA,EACvB,eAAeA,EAAU,KAAK;AAAA,EAC9B,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU;AACvB;AAEA,MAAAE,IAAehC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default FormChipCell;
|
|
2
|
-
declare function FormChipCell({ chipOptions, className, delimiter, formState, initialValues, isEditable, label, name, onClick, onExitEditModeCallback, shortChips, validationRules, validator, visibleChipsMaxLength, withInitialParentWidth }: {
|
|
2
|
+
declare function FormChipCell({ chipOptions, className, children, delimiter, formState, initialValues, isDeletable, isEditable, label, name, onClick, onExitEditModeCallback, shortChips, validationRules, validator, visibleChipsMaxLength, withInitialParentWidth }: {
|
|
3
3
|
chipOptions?: {
|
|
4
4
|
background: string;
|
|
5
5
|
boldValue: boolean;
|
|
@@ -9,9 +9,11 @@ declare function FormChipCell({ chipOptions, className, delimiter, formState, in
|
|
|
9
9
|
font: string;
|
|
10
10
|
};
|
|
11
11
|
className?: string;
|
|
12
|
+
children: any;
|
|
12
13
|
delimiter?: any;
|
|
13
14
|
formState: any;
|
|
14
15
|
initialValues: any;
|
|
16
|
+
isDeletable?: boolean;
|
|
15
17
|
isEditable?: boolean;
|
|
16
18
|
label?: any;
|
|
17
19
|
name: any;
|
|
@@ -26,10 +28,12 @@ declare function FormChipCell({ chipOptions, className, delimiter, formState, in
|
|
|
26
28
|
declare namespace FormChipCell {
|
|
27
29
|
namespace propTypes {
|
|
28
30
|
export { CHIP_OPTIONS as chipOptions };
|
|
31
|
+
export let children: any;
|
|
29
32
|
export let className: any;
|
|
30
33
|
export let delimiter: any;
|
|
31
34
|
export let formState: any;
|
|
32
35
|
export let initialValues: any;
|
|
36
|
+
export let isDeletable: any;
|
|
33
37
|
export let isEditable: any;
|
|
34
38
|
export let label: any;
|
|
35
39
|
export let name: any;
|
|
@@ -38,9 +42,10 @@ declare namespace FormChipCell {
|
|
|
38
42
|
export let shortChips: any;
|
|
39
43
|
export let validationRules: any;
|
|
40
44
|
export let validator: any;
|
|
41
|
-
export
|
|
45
|
+
export { VISIBLE_CHIPS_MAX_LENGTH as visibleChipsMaxLength };
|
|
42
46
|
export let withInitialParentWidth: any;
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
import { CHIP_OPTIONS } from '../../types';
|
|
50
|
+
import { VISIBLE_CHIPS_MAX_LENGTH } from '../../types';
|
|
46
51
|
//# sourceMappingURL=FormChipCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChipCell.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormChipCell/FormChipCell.jsx"],"names":[],"mappings":";AAiCA
|
|
1
|
+
{"version":3,"file":"FormChipCell.d.ts","sourceRoot":"","sources":["../../../src/lib/components/FormChipCell/FormChipCell.jsx"],"names":[],"mappings":";AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;gBA+WC;;;;;;;;;;;;;;;;;;;;;;6BAzXsD,aAAa;yCAAb,aAAa"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { CHIP_OPTIONS as
|
|
8
|
-
import { CLICK as
|
|
9
|
-
import { areArraysEqual as
|
|
10
|
-
import { checkPatternsValidity as
|
|
11
|
-
import { generateChipsList as
|
|
12
|
-
import { uniquenessError as
|
|
1
|
+
import { jsxs as he, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import ae, { useState as j, useMemo as de, useCallback as y } from "react";
|
|
3
|
+
import fe, { get as F, set as k, isEmpty as D, isNil as me } from "lodash";
|
|
4
|
+
import Ce from "classnames";
|
|
5
|
+
import u from "prop-types";
|
|
6
|
+
import Ie from "./FormChipCellView.mjs";
|
|
7
|
+
import { VISIBLE_CHIPS_MAX_LENGTH as ge, CHIP_OPTIONS as ye } from "../../types.mjs";
|
|
8
|
+
import { CLICK as Fe, TAB as B, TAB_SHIFT as O } from "../../constants.mjs";
|
|
9
|
+
import { areArraysEqual as Ne } from "../../utils/common.util.mjs";
|
|
10
|
+
import { checkPatternsValidity as Ve } from "../../utils/validation.util.mjs";
|
|
11
|
+
import { generateChipsList as we } from "../../utils/generateChipsList.util.mjs";
|
|
12
|
+
import { uniquenessError as U } from "./formChipCell.util.mjs";
|
|
13
13
|
import "../../hooks/index.mjs";
|
|
14
14
|
/* empty css */
|
|
15
|
-
import { useChipCell as
|
|
16
|
-
let
|
|
17
|
-
chipOptions:
|
|
15
|
+
import { useChipCell as Re } from "../../hooks/useChipCell.hook.mjs";
|
|
16
|
+
let V = ({
|
|
17
|
+
chipOptions: b = {
|
|
18
18
|
background: "purple",
|
|
19
19
|
boldValue: !1,
|
|
20
20
|
borderRadius: "primary",
|
|
@@ -22,63 +22,65 @@ let w = ({
|
|
|
22
22
|
density: "dense",
|
|
23
23
|
font: "purple"
|
|
24
24
|
},
|
|
25
|
-
className:
|
|
26
|
-
|
|
25
|
+
className: z = "",
|
|
26
|
+
children: W,
|
|
27
|
+
delimiter: T = null,
|
|
27
28
|
formState: n,
|
|
28
29
|
initialValues: q,
|
|
30
|
+
isDeletable: X = !1,
|
|
29
31
|
isEditable: m = !1,
|
|
30
|
-
label:
|
|
31
|
-
name:
|
|
32
|
-
onClick:
|
|
32
|
+
label: w = null,
|
|
33
|
+
name: r,
|
|
34
|
+
onClick: R = () => {
|
|
33
35
|
},
|
|
34
36
|
onExitEditModeCallback: d = null,
|
|
35
|
-
shortChips:
|
|
37
|
+
shortChips: $ = !1,
|
|
36
38
|
validationRules: P = {},
|
|
37
|
-
validator:
|
|
38
|
-
visibleChipsMaxLength:
|
|
39
|
-
withInitialParentWidth:
|
|
39
|
+
validator: K = null,
|
|
40
|
+
visibleChipsMaxLength: C = null,
|
|
41
|
+
withInitialParentWidth: A = !1
|
|
40
42
|
}) => {
|
|
41
|
-
const
|
|
42
|
-
chipsCellRef:
|
|
43
|
-
chipsWrapperRef:
|
|
44
|
-
handleShowElements:
|
|
45
|
-
hiddenChipsCounterRef:
|
|
46
|
-
hiddenChipsPopUpRef:
|
|
47
|
-
setChipsSizes:
|
|
48
|
-
setShowHiddenChips:
|
|
49
|
-
showChips:
|
|
50
|
-
showHiddenChips:
|
|
51
|
-
visibleChipsCount:
|
|
52
|
-
} =
|
|
43
|
+
const G = Ce("chips", z), [L, Y] = j(!1), {
|
|
44
|
+
chipsCellRef: J,
|
|
45
|
+
chipsWrapperRef: Q,
|
|
46
|
+
handleShowElements: Z,
|
|
47
|
+
hiddenChipsCounterRef: S,
|
|
48
|
+
hiddenChipsPopUpRef: E,
|
|
49
|
+
setChipsSizes: M,
|
|
50
|
+
setShowHiddenChips: x,
|
|
51
|
+
showChips: ee,
|
|
52
|
+
showHiddenChips: _,
|
|
53
|
+
visibleChipsCount: H
|
|
54
|
+
} = Re(m, C, A), [p, I] = j({
|
|
53
55
|
chipIndex: null,
|
|
54
56
|
isEdit: !1,
|
|
55
57
|
isKeyFocused: !1,
|
|
56
58
|
isValueFocused: !1,
|
|
57
59
|
isNewChip: !1
|
|
58
60
|
});
|
|
59
|
-
let
|
|
60
|
-
visibleChips: F(n.values,
|
|
61
|
+
let ie = de(() => m || C === "all" ? {
|
|
62
|
+
visibleChips: F(n.values, r),
|
|
61
63
|
hiddenChips: []
|
|
62
|
-
} :
|
|
63
|
-
F(n.values,
|
|
64
|
-
|
|
65
|
-
), [
|
|
64
|
+
} : we(
|
|
65
|
+
F(n.values, r),
|
|
66
|
+
C || H
|
|
67
|
+
), [C, m, H, n.values, r]);
|
|
66
68
|
const N = y(
|
|
67
69
|
(e) => {
|
|
68
|
-
|
|
70
|
+
Ne(F(q, r), e, ["id"]) && k(n.initialValues, r, e), n.form.mutators.setFieldState(r, { modified: !0 }), n.form.mutators.setFieldState(r, { touched: !0 });
|
|
69
71
|
},
|
|
70
|
-
[q,
|
|
71
|
-
),
|
|
72
|
+
[q, r, n]
|
|
73
|
+
), se = y(
|
|
72
74
|
(e, i) => {
|
|
73
75
|
var t;
|
|
74
|
-
const
|
|
75
|
-
!p.isEdit && !p.chipIndex && n.form.mutators.push(
|
|
76
|
-
id:
|
|
76
|
+
const o = ((t = i.value) == null ? void 0 : t.length) || 0;
|
|
77
|
+
!p.isEdit && !p.chipIndex && n.form.mutators.push(r, {
|
|
78
|
+
id: o + /* @__PURE__ */ new Date(),
|
|
77
79
|
key: "",
|
|
78
80
|
value: "",
|
|
79
|
-
delimiter:
|
|
80
|
-
}),
|
|
81
|
-
chipIndex:
|
|
81
|
+
delimiter: T
|
|
82
|
+
}), _ && x(!1), I({
|
|
83
|
+
chipIndex: o,
|
|
82
84
|
isEdit: !0,
|
|
83
85
|
isKeyFocused: !0,
|
|
84
86
|
isValueFocused: !1,
|
|
@@ -88,29 +90,29 @@ let w = ({
|
|
|
88
90
|
[
|
|
89
91
|
p.isEdit,
|
|
90
92
|
p.chipIndex,
|
|
91
|
-
v,
|
|
92
|
-
n.form.mutators,
|
|
93
|
-
o,
|
|
94
93
|
_,
|
|
95
|
-
|
|
94
|
+
n.form.mutators,
|
|
95
|
+
r,
|
|
96
|
+
T,
|
|
97
|
+
x
|
|
96
98
|
]
|
|
97
99
|
), g = y(
|
|
98
|
-
(e, i,
|
|
100
|
+
(e, i, o, t = !1) => {
|
|
99
101
|
N(
|
|
100
|
-
|
|
101
|
-
), i.length === 1 ? n.form.change(
|
|
102
|
+
fe.chain(n).get(["values", r]).filter((s, l) => l !== o).value()
|
|
103
|
+
), i.length === 1 ? n.form.change(r, []) : i.remove(o), d && d(), e && !t && e.stopPropagation();
|
|
102
104
|
},
|
|
103
|
-
[N, n,
|
|
104
|
-
),
|
|
105
|
-
(e, i,
|
|
105
|
+
[N, n, r, d]
|
|
106
|
+
), le = y(
|
|
107
|
+
(e, i, o, t) => {
|
|
106
108
|
const { key: s, value: l } = i.value[p.chipIndex], h = !!(s != null && s.trim() && (l != null && l.trim()));
|
|
107
|
-
|
|
109
|
+
o === Fe ? (h || g(e, i, p.chipIndex, t), I({
|
|
108
110
|
chipIndex: null,
|
|
109
111
|
isEdit: !1,
|
|
110
112
|
isKeyFocused: !1,
|
|
111
113
|
isValueFocused: !1,
|
|
112
114
|
isNewChip: !1
|
|
113
|
-
}), h && d && d()) :
|
|
115
|
+
}), h && d && d()) : o === B ? (h || g(e, i, p.chipIndex), I((a) => {
|
|
114
116
|
const c = a.chipIndex + 1 > i.value.length - 1;
|
|
115
117
|
return h && c && d && d(), {
|
|
116
118
|
chipIndex: c ? null : a.chipIndex + 1,
|
|
@@ -119,7 +121,7 @@ let w = ({
|
|
|
119
121
|
isValueFocused: !1,
|
|
120
122
|
isNewChip: !1
|
|
121
123
|
};
|
|
122
|
-
})) :
|
|
124
|
+
})) : o === O && (h || g(e, i, p.chipIndex), I((a) => {
|
|
123
125
|
const c = a.chipIndex === 0;
|
|
124
126
|
return h && c && d && d(), {
|
|
125
127
|
chipIndex: c ? null : a.chipIndex - 1,
|
|
@@ -128,37 +130,37 @@ let w = ({
|
|
|
128
130
|
isValueFocused: !c,
|
|
129
131
|
isNewChip: !1
|
|
130
132
|
};
|
|
131
|
-
})), N(F(n.values,
|
|
133
|
+
})), N(F(n.values, r)), (p.chipIndex > 0 && p.chipIndex < i.value.length - 1 || i.value.length > 1 && p.chipIndex === 0 && o !== O || i.value.length > 1 && p.chipIndex === i.value.length - 1 && o !== B) && e && e.preventDefault();
|
|
132
134
|
},
|
|
133
135
|
[
|
|
134
136
|
p.chipIndex,
|
|
135
137
|
N,
|
|
136
138
|
n.values,
|
|
137
|
-
|
|
139
|
+
r,
|
|
138
140
|
d,
|
|
139
141
|
g
|
|
140
142
|
]
|
|
141
|
-
),
|
|
142
|
-
(e, i,
|
|
143
|
+
), te = y(
|
|
144
|
+
(e, i, o) => {
|
|
143
145
|
if (m) {
|
|
144
146
|
const { clientX: t, clientY: s } = e;
|
|
145
147
|
let l = !1;
|
|
146
148
|
const h = (a, c, f) => {
|
|
147
149
|
if (f) {
|
|
148
150
|
const {
|
|
149
|
-
top:
|
|
150
|
-
left:
|
|
151
|
-
right:
|
|
152
|
-
bottom:
|
|
151
|
+
top: ue,
|
|
152
|
+
left: ne,
|
|
153
|
+
right: pe,
|
|
154
|
+
bottom: ce
|
|
153
155
|
} = f.getBoundingClientRect();
|
|
154
|
-
return !(a >
|
|
156
|
+
return !(a > pe || a < ne || c > ce || c < ue);
|
|
155
157
|
}
|
|
156
158
|
};
|
|
157
159
|
e.stopPropagation(), e.target.nodeName !== "INPUT" ? e.target.firstElementChild && (l = h(
|
|
158
160
|
t,
|
|
159
161
|
s,
|
|
160
162
|
e.target.firstElementChild
|
|
161
|
-
)) : l = e.target.name ===
|
|
163
|
+
)) : l = e.target.name === o, I((a) => ({
|
|
162
164
|
...a,
|
|
163
165
|
chipIndex: i,
|
|
164
166
|
isEdit: !0,
|
|
@@ -166,79 +168,84 @@ let w = ({
|
|
|
166
168
|
isValueFocused: !l
|
|
167
169
|
}));
|
|
168
170
|
}
|
|
169
|
-
|
|
171
|
+
R && R();
|
|
170
172
|
},
|
|
171
|
-
[m,
|
|
172
|
-
),
|
|
173
|
+
[m, R]
|
|
174
|
+
), re = (e) => {
|
|
173
175
|
if (!e) return null;
|
|
174
176
|
let i = [];
|
|
175
|
-
const
|
|
177
|
+
const o = (t, s) => !e.some(({ key: l }, h) => t === l && h !== s);
|
|
176
178
|
return D(P) || (i = e.map((t) => {
|
|
177
|
-
const [s, l] =
|
|
179
|
+
const [s, l] = oe(t);
|
|
178
180
|
return s && l ? { key: s, value: l } : s ? { key: s } : l ? { value: l } : null;
|
|
179
181
|
})), e.forEach((t, s) => {
|
|
180
|
-
|
|
181
|
-
}), D(i) &&
|
|
182
|
-
},
|
|
182
|
+
o(t.key, s) || (F(i, [s, "key"], !1) ? i.at(s).key.push(U) : k(i, [s, "key"], [U]));
|
|
183
|
+
}), D(i) && K && (i = K(e)), i.every((t) => me(t)) ? null : i;
|
|
184
|
+
}, oe = ({ key: e, value: i, disabled: o }) => {
|
|
183
185
|
const t = (s, l) => {
|
|
184
|
-
const [h, a] =
|
|
186
|
+
const [h, a] = Ve(
|
|
185
187
|
P[l].filter((f) => f.pattern),
|
|
186
188
|
s
|
|
187
189
|
);
|
|
188
190
|
return a ? null : h.filter((f) => !f.isValid).map((f) => ({ name: f.name, label: f.label }));
|
|
189
191
|
};
|
|
190
|
-
return
|
|
192
|
+
return o ? [null, null] : [t(e, "key"), t(i, "value")];
|
|
191
193
|
};
|
|
192
|
-
return /* @__PURE__ */
|
|
193
|
-
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
194
|
+
return /* @__PURE__ */ he("div", { className: G, "data-testid": `${r}-chips`, children: [
|
|
195
|
+
w && /* @__PURE__ */ v("div", { className: "chips__label", children: w }),
|
|
196
|
+
/* @__PURE__ */ v("div", { className: w ? "chips__wrapper" : "", children: /* @__PURE__ */ v(
|
|
197
|
+
Ie,
|
|
196
198
|
{
|
|
197
|
-
chipOptions:
|
|
198
|
-
chipSizeIsRecalculated:
|
|
199
|
-
chips:
|
|
199
|
+
chipOptions: b,
|
|
200
|
+
chipSizeIsRecalculated: L,
|
|
201
|
+
chips: ie,
|
|
200
202
|
editConfig: p,
|
|
201
203
|
formState: n,
|
|
202
|
-
handleAddNewChip:
|
|
203
|
-
handleEditChip:
|
|
204
|
+
handleAddNewChip: se,
|
|
205
|
+
handleEditChip: le,
|
|
204
206
|
handleRemoveChip: g,
|
|
205
|
-
handleShowElements:
|
|
206
|
-
handleToEditMode:
|
|
207
|
+
handleShowElements: Z,
|
|
208
|
+
handleToEditMode: te,
|
|
209
|
+
isDeletable: X,
|
|
207
210
|
isEditable: m,
|
|
208
|
-
name:
|
|
209
|
-
ref: { chipsCellRef:
|
|
210
|
-
setChipSizeIsRecalculated:
|
|
211
|
-
setChipsSizes:
|
|
212
|
-
setEditConfig:
|
|
213
|
-
shortChips:
|
|
214
|
-
showChips:
|
|
215
|
-
showHiddenChips:
|
|
216
|
-
validateFields:
|
|
217
|
-
validationRules: P
|
|
211
|
+
name: r,
|
|
212
|
+
ref: { chipsCellRef: J, chipsWrapperRef: Q, hiddenChipsCounterRef: S, hiddenChipsPopUpRef: E },
|
|
213
|
+
setChipSizeIsRecalculated: Y,
|
|
214
|
+
setChipsSizes: M,
|
|
215
|
+
setEditConfig: I,
|
|
216
|
+
shortChips: $,
|
|
217
|
+
showChips: ee,
|
|
218
|
+
showHiddenChips: _,
|
|
219
|
+
validateFields: re,
|
|
220
|
+
validationRules: P,
|
|
221
|
+
visibleChipsMaxLength: C,
|
|
222
|
+
children: W
|
|
218
223
|
}
|
|
219
224
|
) })
|
|
220
225
|
] });
|
|
221
226
|
};
|
|
222
|
-
|
|
223
|
-
chipOptions:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
227
|
+
V.propTypes = {
|
|
228
|
+
chipOptions: ye,
|
|
229
|
+
children: u.node,
|
|
230
|
+
className: u.string,
|
|
231
|
+
delimiter: u.oneOfType([u.string, u.element]),
|
|
232
|
+
formState: u.object.isRequired,
|
|
233
|
+
initialValues: u.object.isRequired,
|
|
234
|
+
isDeletable: u.bool,
|
|
235
|
+
isEditable: u.bool,
|
|
236
|
+
label: u.string,
|
|
237
|
+
name: u.string.isRequired,
|
|
238
|
+
onClick: u.func,
|
|
239
|
+
onExitEditModeCallback: u.func,
|
|
240
|
+
shortChips: u.bool,
|
|
241
|
+
validationRules: u.object,
|
|
242
|
+
validator: u.func,
|
|
243
|
+
visibleChipsMaxLength: ge,
|
|
244
|
+
withInitialParentWidth: u.bool
|
|
238
245
|
};
|
|
239
|
-
|
|
240
|
-
const
|
|
246
|
+
V = ae.memo(V);
|
|
247
|
+
const ze = V;
|
|
241
248
|
export {
|
|
242
|
-
|
|
249
|
+
ze as default
|
|
243
250
|
};
|
|
244
251
|
//# sourceMappingURL=FormChipCell.mjs.map
|