@addsign/moje-agenda-shared-lib 2.0.7 → 2.0.8
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/ui/Combobox.d.ts +1 -0
- package/dist/components/ui/Combobox.js +3 -11
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/utils/getFullName.js +1 -1
- package/dist/utils/getFullName.js.map +1 -1
- package/lib/components/ui/Combobox.tsx +3 -10
- package/lib/utils/getFullName.tsx +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ interface ComboboxProps {
|
|
|
9
9
|
clearable?: boolean;
|
|
10
10
|
options?: IOptionItem[];
|
|
11
11
|
allowAddNew?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
15
|
export default Combobox;
|
|
@@ -36,7 +36,8 @@ const Combobox = React.forwardRef(
|
|
|
36
36
|
placeholderSearch = "Vyhledejte položku",
|
|
37
37
|
clearable = false,
|
|
38
38
|
options: propOptions = [],
|
|
39
|
-
allowAddNew = false
|
|
39
|
+
allowAddNew = false,
|
|
40
|
+
disabled = false
|
|
40
41
|
}, ref) => {
|
|
41
42
|
var _a, _b;
|
|
42
43
|
const [open, setOpen] = React.useState(false);
|
|
@@ -44,21 +45,11 @@ const Combobox = React.forwardRef(
|
|
|
44
45
|
const [inputValue, setInputValue] = React.useState("");
|
|
45
46
|
const [frameworks, setFrameworks] = React.useState(propOptions);
|
|
46
47
|
React.useEffect(() => {
|
|
47
|
-
console.log(
|
|
48
|
-
"%clibcomponentsCombobox.tsx:51 propValue",
|
|
49
|
-
"color: #007acc;",
|
|
50
|
-
propValue
|
|
51
|
-
);
|
|
52
48
|
if (propValue !== void 0) {
|
|
53
49
|
setValue(propValue);
|
|
54
50
|
}
|
|
55
51
|
}, [propValue]);
|
|
56
52
|
React.useEffect(() => {
|
|
57
|
-
console.log(
|
|
58
|
-
"%clibcomponentsCombobox.tsx:60 setFrameworks",
|
|
59
|
-
"color: #007acc;",
|
|
60
|
-
setFrameworks
|
|
61
|
-
);
|
|
62
53
|
setFrameworks(propOptions);
|
|
63
54
|
}, [propOptions]);
|
|
64
55
|
const handleSelect = (currentValue) => {
|
|
@@ -96,6 +87,7 @@ const Combobox = React.forwardRef(
|
|
|
96
87
|
variant: "outline",
|
|
97
88
|
role: "combobox",
|
|
98
89
|
"aria-expanded": open,
|
|
90
|
+
disabled,
|
|
99
91
|
className: cn("w-full justify-between", className),
|
|
100
92
|
title: value ? (_a = frameworks.find((framework) => framework.value === value)) == null ? void 0 : _a.label : placeholder,
|
|
101
93
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js","../../../node_modules/lucide-react/dist/esm/icons/plus.js","../../../lib/components/ui/Combobox.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ChevronsUpDown = createLucideIcon(\"ChevronsUpDown\", [\n [\"path\", { d: \"m7 15 5 5 5-5\", key: \"1hf1tw\" }],\n [\"path\", { d: \"m7 9 5-5 5 5\", key: \"sgt6xg\" }]\n]);\n\nexport { ChevronsUpDown as default };\n//# sourceMappingURL=chevrons-up-down.js.map\n","/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Plus = createLucideIcon(\"Plus\", [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }]\n]);\n\nexport { Plus as default };\n//# sourceMappingURL=plus.js.map\n","\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Check, ChevronsUpDown, Plus, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from \"./command\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { IOptionItem } from \"../../types\";\r\n\r\ninterface ComboboxProps {\r\n value?: string;\r\n onChange?: (value: string | undefined) => void;\r\n className?: string;\r\n placeholder?: string;\r\n placeholderSearch?: string;\r\n clearable?: boolean;\r\n options?: IOptionItem[];\r\n allowAddNew?: boolean;\r\n}\r\n\r\nconst Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(\r\n (\r\n {\r\n value: propValue,\r\n onChange: propOnChange,\r\n className,\r\n placeholder,\r\n placeholderSearch = \"Vyhledejte položku\",\r\n clearable = false,\r\n options: propOptions = [],\r\n allowAddNew = false,\r\n },\r\n ref\r\n ) => {\r\n const [open, setOpen] = React.useState(false);\r\n const [value, setValue] = React.useState(propValue || \"\");\r\n const [inputValue, setInputValue] = React.useState(\"\");\r\n const [frameworks, setFrameworks] =\r\n React.useState<IOptionItem[]>(propOptions);\r\n\r\n React.useEffect(() => {\r\n console.log(\r\n \"%clibcomponentsCombobox.tsx:51 propValue\",\r\n \"color: #007acc;\",\r\n propValue\r\n );\r\n if (propValue !== undefined) {\r\n setValue(propValue);\r\n }\r\n }, [propValue]);\r\n\r\n React.useEffect(() => {\r\n console.log(\r\n \"%clibcomponentsCombobox.tsx:60 setFrameworks\",\r\n \"color: #007acc;\",\r\n setFrameworks\r\n );\r\n setFrameworks(propOptions);\r\n }, [propOptions]);\r\n\r\n const handleSelect = (currentValue: string) => {\r\n if (currentValue === \"add-custom\") {\r\n if (\r\n inputValue &&\r\n !frameworks.some((f) => f.value === inputValue.toLowerCase())\r\n ) {\r\n const newFramework = {\r\n value: inputValue.toLowerCase(),\r\n label: inputValue,\r\n };\r\n\r\n setFrameworks([...frameworks, newFramework]);\r\n updateValue(newFramework.value);\r\n }\r\n } else {\r\n updateValue(currentValue === value ? \"\" : currentValue);\r\n }\r\n setOpen(false);\r\n };\r\n\r\n const updateValue = (newValue: string) => {\r\n setValue(newValue);\r\n propOnChange?.(newValue || undefined);\r\n };\r\n\r\n const handleClear = (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n updateValue(\"\");\r\n setInputValue(\"\");\r\n setOpen(false);\r\n };\r\n\r\n value;\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <div className=\"relative w-full\">\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n type=\"button\"\r\n variant=\"outline\"\r\n role=\"combobox\"\r\n aria-expanded={open}\r\n className={cn(\"w-full justify-between\", className)}\r\n title={\r\n value\r\n ? frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n : placeholder\r\n }\r\n >\r\n <span className=\"flex-1 text-left truncate mr-2 font-normal\">\r\n {value ? (\r\n frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n ) : (\r\n <span className=\"text-muted-foreground font-normal\">\r\n {placeholder}\r\n </span>\r\n )}\r\n </span>\r\n\r\n <ChevronsUpDown className=\"h-4 w-4 shrink-0 opacity-50 ml-6\" />\r\n </Button>\r\n </PopoverTrigger>\r\n {clearable && value && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"absolute right-6 top-0 h-full px-1 py-2 hover:bg-transparent\"\r\n onClick={handleClear}\r\n >\r\n <X className=\"h-4 w-4 shrink-0 opacity-50 hover:opacity-100\" />\r\n </Button>\r\n )}\r\n </div>\r\n <PopoverContent className=\"min-w-[200px] w-[var(--radix-popover-trigger-width)] p-0\">\r\n <Command>\r\n <CommandInput\r\n placeholder={placeholderSearch}\r\n className=\"h-9\"\r\n value={inputValue}\r\n onValueChange={setInputValue}\r\n />\r\n <CommandList>\r\n <CommandEmpty>\r\n {allowAddNew && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start\"\r\n onClick={() => handleSelect(\"add-custom\")}\r\n >\r\n <Plus className=\"mr-2 h-4 w-4\" />\r\n Přidat \"{inputValue}\"\r\n </Button>\r\n )}\r\n </CommandEmpty>\r\n\r\n <CommandGroup>\r\n {frameworks.map((framework) => (\r\n <CommandItem\r\n key={framework.value}\r\n value={framework.label as string}\r\n onSelect={() => handleSelect(framework.value as string)}\r\n >\r\n {framework.label}\r\n <Check\r\n className={cn(\r\n \"ml-auto h-4 w-4\",\r\n value === framework.value ? \"opacity-100\" : \"opacity-0\"\r\n )}\r\n />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n }\r\n);\r\n\r\nCombobox.displayName = \"Combobox\";\r\n\r\nexport default Combobox;\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,iBAAiB,iBAAiB,kBAAkB;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,iBAAiB,KAAK,SAAQ,CAAE;AAAA,EAC9C,CAAC,QAAQ,EAAE,GAAG,gBAAgB,KAAK,SAAQ,CAAE;AAC/C,CAAC;ACZD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,OAAO,iBAAiB,QAAQ;AAAA,EACpC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,CAAC;ACiBD,MAAM,WAAW,MAAM;AAAA,EACrB,CACE;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,SAAS,cAAc,CAAC;AAAA,IACxB,cAAc;AAAA,KAEhB,QACG;;AACH,UAAM,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AAE;AAAA,gBACxB;AAAA,gBAAW;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA,GAG1B;AAAA,UAEC,oBAAA,cAAA,EACE,UAAW,WAAA,IAAI,CAAC,cACf;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,OAAO,UAAU;AAAA,cACjB,UAAU,MAAM,aAAa,UAAU,KAAe;AAAA,cAErD,UAAA;AAAA,gBAAU,UAAA;AAAA,gBACX;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAW;AAAA,sBACT;AAAA,sBACA,UAAU,UAAU,QAAQ,gBAAgB;AAAA,oBAC9C;AAAA,kBAAA;AAAA,gBACF;AAAA,cAAA;AAAA,YAAA;AAAA,YAVK,UAAU;AAAA,UAYlB,CAAA,GACH;AAAA,QAAA,GACF;AAAA,MAAA,EAAA,CACF,EACF,CAAA;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"Combobox.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js","../../../node_modules/lucide-react/dist/esm/icons/plus.js","../../../lib/components/ui/Combobox.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst ChevronsUpDown = createLucideIcon(\"ChevronsUpDown\", [\n [\"path\", { d: \"m7 15 5 5 5-5\", key: \"1hf1tw\" }],\n [\"path\", { d: \"m7 9 5-5 5 5\", key: \"sgt6xg\" }]\n]);\n\nexport { ChevronsUpDown as default };\n//# sourceMappingURL=chevrons-up-down.js.map\n","/**\n * @license lucide-react v0.456.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst Plus = createLucideIcon(\"Plus\", [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }]\n]);\n\nexport { Plus as default };\n//# sourceMappingURL=plus.js.map\n","\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Check, ChevronsUpDown, Plus, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"../../utils/utils\";\r\nimport { Button } from \"./button\";\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from \"./command\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { IOptionItem } from \"../../types\";\r\n\r\ninterface ComboboxProps {\r\n value?: string;\r\n onChange?: (value: string | undefined) => void;\r\n className?: string;\r\n placeholder?: string;\r\n placeholderSearch?: string;\r\n clearable?: boolean;\r\n options?: IOptionItem[];\r\n allowAddNew?: boolean;\r\n disabled?: boolean;\r\n}\r\n\r\nconst Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(\r\n (\r\n {\r\n value: propValue,\r\n onChange: propOnChange,\r\n className,\r\n placeholder,\r\n placeholderSearch = \"Vyhledejte položku\",\r\n clearable = false,\r\n options: propOptions = [],\r\n allowAddNew = false,\r\n disabled = false,\r\n },\r\n ref\r\n ) => {\r\n const [open, setOpen] = React.useState(false);\r\n const [value, setValue] = React.useState(propValue || \"\");\r\n const [inputValue, setInputValue] = React.useState(\"\");\r\n const [frameworks, setFrameworks] =\r\n React.useState<IOptionItem[]>(propOptions);\r\n\r\n React.useEffect(() => {\r\n if (propValue !== undefined) {\r\n setValue(propValue);\r\n }\r\n }, [propValue]);\r\n\r\n React.useEffect(() => {\r\n setFrameworks(propOptions);\r\n }, [propOptions]);\r\n\r\n const handleSelect = (currentValue: string) => {\r\n if (currentValue === \"add-custom\") {\r\n if (\r\n inputValue &&\r\n !frameworks.some((f) => f.value === inputValue.toLowerCase())\r\n ) {\r\n const newFramework = {\r\n value: inputValue.toLowerCase(),\r\n label: inputValue,\r\n };\r\n\r\n setFrameworks([...frameworks, newFramework]);\r\n updateValue(newFramework.value);\r\n }\r\n } else {\r\n updateValue(currentValue === value ? \"\" : currentValue);\r\n }\r\n setOpen(false);\r\n };\r\n\r\n const updateValue = (newValue: string) => {\r\n setValue(newValue);\r\n propOnChange?.(newValue || undefined);\r\n };\r\n\r\n const handleClear = (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n updateValue(\"\");\r\n setInputValue(\"\");\r\n setOpen(false);\r\n };\r\n\r\n value;\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <div className=\"relative w-full\">\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n type=\"button\"\r\n variant=\"outline\"\r\n role=\"combobox\"\r\n aria-expanded={open}\r\n disabled={disabled}\r\n className={cn(\"w-full justify-between\", className)}\r\n title={\r\n value\r\n ? frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n : placeholder\r\n }\r\n >\r\n <span className=\"flex-1 text-left truncate mr-2 font-normal\">\r\n {value ? (\r\n frameworks.find((framework) => framework.value === value)\r\n ?.label\r\n ) : (\r\n <span className=\"text-muted-foreground font-normal\">\r\n {placeholder}\r\n </span>\r\n )}\r\n </span>\r\n\r\n <ChevronsUpDown className=\"h-4 w-4 shrink-0 opacity-50 ml-6\" />\r\n </Button>\r\n </PopoverTrigger>\r\n {clearable && value && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"absolute right-6 top-0 h-full px-1 py-2 hover:bg-transparent\"\r\n onClick={handleClear}\r\n >\r\n <X className=\"h-4 w-4 shrink-0 opacity-50 hover:opacity-100\" />\r\n </Button>\r\n )}\r\n </div>\r\n <PopoverContent className=\"min-w-[200px] w-[var(--radix-popover-trigger-width)] p-0\">\r\n <Command>\r\n <CommandInput\r\n placeholder={placeholderSearch}\r\n className=\"h-9\"\r\n value={inputValue}\r\n onValueChange={setInputValue}\r\n />\r\n <CommandList>\r\n <CommandEmpty>\r\n {allowAddNew && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start\"\r\n onClick={() => handleSelect(\"add-custom\")}\r\n >\r\n <Plus className=\"mr-2 h-4 w-4\" />\r\n Přidat \"{inputValue}\"\r\n </Button>\r\n )}\r\n </CommandEmpty>\r\n\r\n <CommandGroup>\r\n {frameworks.map((framework) => (\r\n <CommandItem\r\n key={framework.value}\r\n value={framework.label as string}\r\n onSelect={() => handleSelect(framework.value as string)}\r\n >\r\n {framework.label}\r\n <Check\r\n className={cn(\r\n \"ml-auto h-4 w-4\",\r\n value === framework.value ? \"opacity-100\" : \"opacity-0\"\r\n )}\r\n />\r\n </CommandItem>\r\n ))}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n }\r\n);\r\n\r\nCombobox.displayName = \"Combobox\";\r\n\r\nexport default Combobox;\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,iBAAiB,iBAAiB,kBAAkB;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,iBAAiB,KAAK,SAAQ,CAAE;AAAA,EAC9C,CAAC,QAAQ,EAAE,GAAG,gBAAgB,KAAK,SAAQ,CAAE;AAC/C,CAAC;ACZD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,OAAO,iBAAiB,QAAQ;AAAA,EACpC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,CAAC;ACkBD,MAAM,WAAW,MAAM;AAAA,EACrB,CACE;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,SAAS,cAAc,CAAC;AAAA,IACxB,cAAc;AAAA,IACd,WAAW;AAAA,K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UAEC,oBAAA,cAAA,EACE,UAAW,WAAA,IAAI,CAAC,cACf;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,OAAO,UAAU;AAAA,cACjB,UAAU,MAAM,aAAa,UAAU,KAAe;AAAA,cAErD,UAAA;AAAA,gBAAU,UAAA;AAAA,gBACX;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAW;AAAA,sBACT;AAAA,sBACA,UAAU,UAAU,QAAQ,gBAAgB;AAAA,oBAC9C;AAAA,kBAAA;AAAA,gBACF;AAAA,cAAA;AAAA,YAAA;AAAA,YAVK,UAAU;AAAA,UAYlB,CAAA,GACH;AAAA,QAAA,GACF;AAAA,MAAA,EAAA,CACF,EACF,CAAA;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","x_google_ignoreList":[0,1]}
|
|
@@ -18,7 +18,7 @@ const getFullName = (employee, showEmplNumb = false, highlighManagers = true) =>
|
|
|
18
18
|
return fullName;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
const getFullNameList = (employee, showEmplNumb = false, highlighManagers =
|
|
21
|
+
const getFullNameList = (employee, showEmplNumb = false, highlighManagers = false) => {
|
|
22
22
|
if (!employee) {
|
|
23
23
|
return "Neobsazené systemizované místo";
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFullName.js","sources":["../../lib/utils/getFullName.tsx"],"sourcesContent":["// userDataFetcher.ts\r\n\r\nimport { IEmployee, IPositionEmployee } from \"../types\";\r\n\r\nconst getFullName = (\r\n employee: IEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean = true\r\n) => {\r\n if (!employee) {\r\n return \"Neobsazené systemizované místo\";\r\n }\r\n const fullName =\r\n (employee?.degreeBefore ? employee?.degreeBefore + \" \" : \"\") +\r\n (employee?.firstName || \"\") +\r\n \" \" +\r\n (employee?.lastName || \"\") +\r\n (employee?.degreeAfter ? \" \" + employee?.degreeAfter : \"\") +\r\n (showEmplNumb ? \" (\" + employee?.employeeId + \")\" : \"\");\r\n\r\n if (highlighManagers) {\r\n if (employee?.manager == \"1\") {\r\n return <span className=\"font-bold\"> {fullName} </span>;\r\n } else {\r\n return fullName;\r\n }\r\n } else {\r\n return fullName;\r\n }\r\n};\r\nconst getFullNameList = (\r\n employee: IEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean =
|
|
1
|
+
{"version":3,"file":"getFullName.js","sources":["../../lib/utils/getFullName.tsx"],"sourcesContent":["// userDataFetcher.ts\r\n\r\nimport { IEmployee, IPositionEmployee } from \"../types\";\r\n\r\nconst getFullName = (\r\n employee: IEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean = true\r\n) => {\r\n if (!employee) {\r\n return \"Neobsazené systemizované místo\";\r\n }\r\n const fullName =\r\n (employee?.degreeBefore ? employee?.degreeBefore + \" \" : \"\") +\r\n (employee?.firstName || \"\") +\r\n \" \" +\r\n (employee?.lastName || \"\") +\r\n (employee?.degreeAfter ? \" \" + employee?.degreeAfter : \"\") +\r\n (showEmplNumb ? \" (\" + employee?.employeeId + \")\" : \"\");\r\n\r\n if (highlighManagers) {\r\n if (employee?.manager == \"1\") {\r\n return <span className=\"font-bold\"> {fullName} </span>;\r\n } else {\r\n return fullName;\r\n }\r\n } else {\r\n return fullName;\r\n }\r\n};\r\nconst getFullNameList = (\r\n employee: IEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean = false\r\n) => {\r\n if (!employee) {\r\n return \"Neobsazené systemizované místo\";\r\n }\r\n const fullName =\r\n (employee?.lastName || \"\") +\r\n \" \" +\r\n (employee?.firstName || \"\") +\r\n (employee?.degreeBefore ? \" \" + employee?.degreeBefore : \"\") +\r\n (employee?.degreeAfter ? \" \" + employee?.degreeAfter : \"\") +\r\n (showEmplNumb ? \" (\" + employee?.employeeId + \")\" : \"\");\r\n\r\n if (highlighManagers) {\r\n if (employee?.manager == \"1\") {\r\n return <span className=\"font-bold\"> {fullName} </span>;\r\n } else {\r\n return fullName;\r\n }\r\n } else {\r\n return fullName;\r\n }\r\n};\r\n\r\nconst getFullNamePositionWithEmployee = (\r\n position: IPositionEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean = true\r\n) => {\r\n if (!position.employee)\r\n return \"Neobsazená pozice (\" + position.positionNumber + \")\";\r\n return getFullName(position.employee, showEmplNumb, highlighManagers);\r\n};\r\nconst getFullNameListPositionWithEmployee = (\r\n position: IPositionEmployee,\r\n showEmplNumb: boolean = false,\r\n highlighManagers: boolean = true\r\n) => {\r\n if (!position.employee)\r\n return \"Neobsazená pozice (\" + position.positionNumber + \")\";\r\n return getFullNameList(position.employee, showEmplNumb, highlighManagers);\r\n};\r\nexport {};\r\n\r\nexport {\r\n getFullName,\r\n getFullNameList,\r\n getFullNamePositionWithEmployee,\r\n getFullNameListPositionWithEmployee,\r\n};\r\n"],"names":[],"mappings":";AAIA,MAAM,cAAc,CAClB,UACA,eAAwB,OACxB,mBAA4B,SACzB;AACH,MAAI,CAAC,UAAU;AACN,WAAA;AAAA,EACT;AACM,QAAA,aACH,qCAAU,iBAAe,qCAAU,gBAAe,MAAM,QACxD,qCAAU,cAAa,MACxB,QACC,qCAAU,aAAY,QACtB,qCAAU,eAAc,OAAM,qCAAU,eAAc,OACtD,eAAe,QAAO,qCAAU,cAAa,MAAM;AAEtD,MAAI,kBAAkB;AAChB,SAAA,qCAAU,YAAW,KAAK;AACrB,aAAA,qBAAC,QAAK,EAAA,WAAU,aAAY,UAAA;AAAA,QAAA;AAAA,QAAE;AAAA,QAAS;AAAA,MAAC,EAAA,CAAA;AAAA,IAAA,OAC1C;AACE,aAAA;AAAA,IACT;AAAA,EAAA,OACK;AACE,WAAA;AAAA,EACT;AACF;AACA,MAAM,kBAAkB,CACtB,UACA,eAAwB,OACxB,mBAA4B,UACzB;AACH,MAAI,CAAC,UAAU;AACN,WAAA;AAAA,EACT;AACM,QAAA,aACH,qCAAU,aAAY,MACvB,QACC,qCAAU,cAAa,QACvB,qCAAU,gBAAe,OAAM,qCAAU,gBAAe,QACxD,qCAAU,eAAc,OAAM,qCAAU,eAAc,OACtD,eAAe,QAAO,qCAAU,cAAa,MAAM;AAEtD,MAAI,kBAAkB;AAChB,SAAA,qCAAU,YAAW,KAAK;AACrB,aAAA,qBAAC,QAAK,EAAA,WAAU,aAAY,UAAA;AAAA,QAAA;AAAA,QAAE;AAAA,QAAS;AAAA,MAAC,EAAA,CAAA;AAAA,IAAA,OAC1C;AACE,aAAA;AAAA,IACT;AAAA,EAAA,OACK;AACE,WAAA;AAAA,EACT;AACF;AAEA,MAAM,kCAAkC,CACtC,UACA,eAAwB,OACxB,mBAA4B,SACzB;AACH,MAAI,CAAC,SAAS;AACL,WAAA,wBAAwB,SAAS,iBAAiB;AAC3D,SAAO,YAAY,SAAS,UAAU,cAAc,gBAAgB;AACtE;AACA,MAAM,sCAAsC,CAC1C,UACA,eAAwB,OACxB,mBAA4B,SACzB;AACH,MAAI,CAAC,SAAS;AACL,WAAA,wBAAwB,SAAS,iBAAiB;AAC3D,SAAO,gBAAgB,SAAS,UAAU,cAAc,gBAAgB;AAC1E;"}
|
|
@@ -25,6 +25,7 @@ interface ComboboxProps {
|
|
|
25
25
|
clearable?: boolean;
|
|
26
26
|
options?: IOptionItem[];
|
|
27
27
|
allowAddNew?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
@@ -38,6 +39,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
|
38
39
|
clearable = false,
|
|
39
40
|
options: propOptions = [],
|
|
40
41
|
allowAddNew = false,
|
|
42
|
+
disabled = false,
|
|
41
43
|
},
|
|
42
44
|
ref
|
|
43
45
|
) => {
|
|
@@ -48,22 +50,12 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
|
48
50
|
React.useState<IOptionItem[]>(propOptions);
|
|
49
51
|
|
|
50
52
|
React.useEffect(() => {
|
|
51
|
-
console.log(
|
|
52
|
-
"%clibcomponentsCombobox.tsx:51 propValue",
|
|
53
|
-
"color: #007acc;",
|
|
54
|
-
propValue
|
|
55
|
-
);
|
|
56
53
|
if (propValue !== undefined) {
|
|
57
54
|
setValue(propValue);
|
|
58
55
|
}
|
|
59
56
|
}, [propValue]);
|
|
60
57
|
|
|
61
58
|
React.useEffect(() => {
|
|
62
|
-
console.log(
|
|
63
|
-
"%clibcomponentsCombobox.tsx:60 setFrameworks",
|
|
64
|
-
"color: #007acc;",
|
|
65
|
-
setFrameworks
|
|
66
|
-
);
|
|
67
59
|
setFrameworks(propOptions);
|
|
68
60
|
}, [propOptions]);
|
|
69
61
|
|
|
@@ -110,6 +102,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
|
110
102
|
variant="outline"
|
|
111
103
|
role="combobox"
|
|
112
104
|
aria-expanded={open}
|
|
105
|
+
disabled={disabled}
|
|
113
106
|
className={cn("w-full justify-between", className)}
|
|
114
107
|
title={
|
|
115
108
|
value
|