@bit.rhplus/ag-grid 0.0.115 → 0.0.116

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.
@@ -0,0 +1,65 @@
1
+ /* eslint-disable */
2
+ import React, { useState } from 'react';
3
+ import { useGridCellEditor } from 'ag-grid-react';
4
+ import ModuleDropdownList from '@bit.rhplus/ui2.module-dropdown-list';
5
+
6
+ /**
7
+ * ModuleLookupEditor - AG Grid cell editor s ModuleDropdownList
8
+ * Zobrazí Select dropdown + tlačítko pro modální vyhledávání
9
+ * Při výběru položky ukončí editaci a vrátí celý objekt
10
+ */
11
+ const ModuleLookupEditor = React.forwardRef(({
12
+ value,
13
+ onValueChange,
14
+ stopEditing,
15
+ moduleDefinition,
16
+ }, ref) => {
17
+ const [selectedValue, setSelectedValue] = useState(value);
18
+
19
+ // Expose getValue method to AG Grid
20
+ React.useImperativeHandle(ref, () => ({
21
+ getValue: () => selectedValue,
22
+ }));
23
+
24
+ // Zrušit editaci pokud se hodnota nezměnila
25
+ useGridCellEditor({
26
+ isCancelAfterEnd: () => !selectedValue || selectedValue === value,
27
+ });
28
+
29
+ // Extrahovat ID z objektu pro ModuleDropdownList
30
+ const currentId = React.useMemo(() => {
31
+ if (!value) return null;
32
+ if (typeof value === 'object') {
33
+ return value[moduleDefinition?.valueField || 'id'];
34
+ }
35
+ return value;
36
+ }, [value, moduleDefinition]);
37
+
38
+ const handleChange = (id, fullObject) => {
39
+ setSelectedValue(fullObject);
40
+ if (onValueChange) {
41
+ onValueChange(fullObject);
42
+ }
43
+ setTimeout(() => {
44
+ stopEditing();
45
+ }, 0);
46
+ };
47
+
48
+ return (
49
+ <div style={{ width: '100%', minWidth: 200 }}>
50
+ <ModuleDropdownList
51
+ moduleDefinition={moduleDefinition}
52
+ value={currentId}
53
+ onChange={handleChange}
54
+ displayMode="full"
55
+ getContainer={() => document.body}
56
+ style={{ width: '100%' }}
57
+ />
58
+ </div>
59
+ );
60
+ });
61
+
62
+ ModuleLookupEditor.displayName = 'ModuleLookupEditor';
63
+
64
+ export default ModuleLookupEditor;
65
+ /* eslint-enable */
package/Editors/index.jsx CHANGED
@@ -1 +1,2 @@
1
1
  export {default as DatePickerEditor} from './DatePickerEditor';
2
+ export {default as ModuleLookupEditor} from './ModuleLookupEditor';
@@ -0,0 +1,40 @@
1
+ /* eslint-disable */
2
+ import * as React from 'react';
3
+ import { createMemoComparison } from '@bit.rhplus/react-memo';
4
+
5
+ function ModuleLookupRenderer(props) {
6
+ const { value, colDef: { cellRendererParams = {} } = {} } = props;
7
+ const { getDisplayValue } = cellRendererParams;
8
+
9
+ const displayText = React.useMemo(() => {
10
+ if (!value) return '';
11
+ if (getDisplayValue) return getDisplayValue(value);
12
+ return value.code || value.name || '';
13
+ }, [value, getDisplayValue]);
14
+
15
+ if (!displayText) return null;
16
+
17
+ return (
18
+ <span style={{
19
+ overflow: 'hidden',
20
+ textOverflow: 'ellipsis',
21
+ whiteSpace: 'nowrap',
22
+ display: 'block',
23
+ lineHeight: 'inherit',
24
+ }}>
25
+ {displayText}
26
+ </span>
27
+ );
28
+ }
29
+
30
+ ModuleLookupRenderer.displayName = 'ModuleLookupRenderer';
31
+
32
+ const arePropsEqual = createMemoComparison(
33
+ ['value', 'data'],
34
+ ['colDef'],
35
+ false,
36
+ 'ModuleLookupRenderer'
37
+ );
38
+
39
+ export default React.memo(ModuleLookupRenderer, arePropsEqual);
40
+ /* eslint-enable */
@@ -1 +1,2 @@
1
1
  export {default as SelectCellRenderer} from './SelectCellRenderer';
2
+ export {default as ModuleLookupRenderer} from './ModuleLookupRenderer';
@@ -0,0 +1,8 @@
1
+ export default ModuleLookupEditor;
2
+ /**
3
+ * ModuleLookupEditor - AG Grid cell editor s ModuleDropdownList
4
+ * Zobrazí Select dropdown + tlačítko pro modální vyhledávání
5
+ * Při výběru položky ukončí editaci a vrátí celý objekt
6
+ */
7
+ declare const ModuleLookupEditor: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
+ import React from 'react';
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* eslint-disable */
3
+ import React, { useState } from 'react';
4
+ import { useGridCellEditor } from 'ag-grid-react';
5
+ import ModuleDropdownList from '@bit.rhplus/ui2.module-dropdown-list';
6
+ /**
7
+ * ModuleLookupEditor - AG Grid cell editor s ModuleDropdownList
8
+ * Zobrazí Select dropdown + tlačítko pro modální vyhledávání
9
+ * Při výběru položky ukončí editaci a vrátí celý objekt
10
+ */
11
+ const ModuleLookupEditor = React.forwardRef(({ value, onValueChange, stopEditing, moduleDefinition, }, ref) => {
12
+ const [selectedValue, setSelectedValue] = useState(value);
13
+ // Expose getValue method to AG Grid
14
+ React.useImperativeHandle(ref, () => ({
15
+ getValue: () => selectedValue,
16
+ }));
17
+ // Zrušit editaci pokud se hodnota nezměnila
18
+ useGridCellEditor({
19
+ isCancelAfterEnd: () => !selectedValue || selectedValue === value,
20
+ });
21
+ // Extrahovat ID z objektu pro ModuleDropdownList
22
+ const currentId = React.useMemo(() => {
23
+ if (!value)
24
+ return null;
25
+ if (typeof value === 'object') {
26
+ return value[moduleDefinition?.valueField || 'id'];
27
+ }
28
+ return value;
29
+ }, [value, moduleDefinition]);
30
+ const handleChange = (id, fullObject) => {
31
+ setSelectedValue(fullObject);
32
+ if (onValueChange) {
33
+ onValueChange(fullObject);
34
+ }
35
+ setTimeout(() => {
36
+ stopEditing();
37
+ }, 0);
38
+ };
39
+ return (_jsx("div", { style: { width: '100%', minWidth: 200 }, children: _jsx(ModuleDropdownList, { moduleDefinition: moduleDefinition, value: currentId, onChange: handleChange, displayMode: "full", getContainer: () => document.body, style: { width: '100%' } }) }));
40
+ });
41
+ ModuleLookupEditor.displayName = 'ModuleLookupEditor';
42
+ export default ModuleLookupEditor;
43
+ //# sourceMappingURL=ModuleLookupEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModuleLookupEditor.js","sourceRoot":"","sources":["../../Editors/ModuleL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AAU,CAAC,GAAG,EAAE;YACd,WAAW,EAAE,CAAC;QAChB,CAAC,EAAE,CAAC,CAAC,CAAC;IACR,CAAC,CAAC;IAEF,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,YAC1C,KAAC,kBAAkB,IACjB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,MAAM,EAClB,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EACjC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GACxB,GACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,kBAAkB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { default as DatePickerEditor } from './DatePickerEditor';
2
+ export { default as ModuleLookupEditor } from './ModuleLookupEditor';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Editors/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Editors/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: React.NamedExoticComponent<any>;
2
+ export default _default;
3
+ import * as React from 'react';
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /* eslint-disable */
3
+ import * as React from 'react';
4
+ import { createMemoComparison } from '@bit.rhplus/react-memo';
5
+ function ModuleLookupRenderer(props) {
6
+ const { value, colDef: { cellRendererParams = {} } = {} } = props;
7
+ const { getDisplayValue } = cellRendererParams;
8
+ const displayText = React.useMemo(() => {
9
+ if (!value)
10
+ return '';
11
+ if (getDisplayValue)
12
+ return getDisplayValue(value);
13
+ return value.code || value.name || '';
14
+ }, [value, getDisplayValue]);
15
+ if (!displayText)
16
+ return null;
17
+ return (_jsx("span", { style: {
18
+ overflow: 'hidden',
19
+ textOverflow: 'ellipsis',
20
+ whiteSpace: 'nowrap',
21
+ display: 'block',
22
+ lineHeight: 'inherit',
23
+ }, children: displayText }));
24
+ }
25
+ ModuleLookupRenderer.displayName = 'ModuleLookupRenderer';
26
+ const arePropsEqual = createMemoComparison(['value', 'data'], ['colDef'], false, 'ModuleLookupRenderer');
27
+ export default React.memo(ModuleLookupRenderer, arePropsEqual);
28
+ //# sourceMappingURL=ModuleLookupRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModuleLookupRenderer.js","sourceRoot":"","sources":["../../Renderers/ModuleLookupRenderer.jsx"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,SAAS,oBAAoB,CAAC,KAAK;IACjC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAClE,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;IAE/C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QACtB,IAAI,eAAe;YAAE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;IACxC,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;IAE7B,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAE9B,OAAO,CACL,eAAM,KAAK,EAAE;YACX,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,SAAS;SACtB,YACE,WAAW,GACP,CACR,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,MAAM,aAAa,GAAG,oBAAoB,CACxC,CAAC,OAAO,EAAE,MAAM,CAAC,EACjB,CAAC,QAAQ,CAAC,EACV,KAAK,EACL,sBAAsB,CACvB,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { default as SelectCellRenderer } from './SelectCellRenderer';
2
+ export { default as ModuleLookupRenderer } from './ModuleLookupRenderer';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Renderers/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Renderers/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bit.rhplus/ag-grid",
3
- "version": "0.0.115",
3
+ "version": "0.0.116",
4
4
  "homepage": "https://bit.cloud/remote-scope/ag-grid",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "remote-scope",
8
8
  "name": "ag-grid",
9
- "version": "0.0.115"
9
+ "version": "0.0.116"
10
10
  },
11
11
  "dependencies": {
12
12
  "moment": "^2.30.1",
@@ -21,10 +21,10 @@
21
21
  "styled-components": "^6.1.19",
22
22
  "lucide-react": "^0.503.0",
23
23
  "linq": "^4.0.3",
24
- "@bit.rhplus/ui.grid": "0.0.133",
24
+ "@bit.rhplus/ui.grid": "0.0.134",
25
25
  "@bit.rhplus/react-memo": "0.0.7",
26
26
  "@bit.rhplus/linq": "0.0.10",
27
- "@bit.rhplus/ui2.module-dropdown-list": "0.1.109",
27
+ "@bit.rhplus/ui2.module-dropdown-list": "0.1.110",
28
28
  "@bit.rhplus/data": "0.0.87",
29
29
  "@bit.rhplus/ui.avatar": "0.0.18"
30
30
  },