@orangesix/react 1.1.1 → 1.2.2
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/api/index.cjs.js +1 -1
- package/api/index.cjs.js.map +1 -1
- package/api/index.d.ts +100 -3
- package/api/index.esm.js +1 -1
- package/api/index.esm.js.map +1 -1
- package/autocomplete/index.cjs.js.map +1 -1
- package/autocomplete/index.d.ts +17 -1
- package/autocomplete/index.esm.js.map +1 -1
- package/editor/index.cjs.js +1 -1
- package/editor/index.cjs.js.map +1 -1
- package/editor/index.d.ts +17 -1
- package/editor/index.esm.js +1 -1
- package/editor/index.esm.js.map +1 -1
- package/input/index.cjs.js +2 -0
- package/input/index.cjs.js.map +1 -0
- package/input/index.d.ts +210 -0
- package/input/index.esm.js +2 -0
- package/input/index.esm.js.map +1 -0
- package/input/package.json +5 -0
- package/inputfilter/index.cjs.js.map +1 -1
- package/inputfilter/index.d.ts +17 -1
- package/inputfilter/index.esm.js.map +1 -1
- package/loading/_loading.scss +10 -0
- package/loading/index.cjs.js +2 -0
- package/loading/index.cjs.js.map +1 -0
- package/loading/index.d.ts +172 -0
- package/loading/index.esm.js +2 -0
- package/loading/index.esm.js.map +1 -0
- package/loading/package.json +5 -0
- package/modal/index.cjs.js +2 -0
- package/modal/index.cjs.js.map +1 -0
- package/modal/index.d.ts +68 -0
- package/modal/index.esm.js +2 -0
- package/modal/index.esm.js.map +1 -0
- package/modal/package.json +5 -0
- package/package.json +15 -4
- package/picklist/index.cjs.js +2 -0
- package/picklist/index.cjs.js.map +1 -0
- package/picklist/index.d.ts +73 -0
- package/picklist/index.esm.js +2 -0
- package/picklist/index.esm.js.map +1 -0
- package/picklist/package.json +5 -0
- package/radio/index.cjs.js +2 -0
- package/radio/index.cjs.js.map +1 -0
- package/radio/index.d.ts +188 -0
- package/radio/index.esm.js +2 -0
- package/radio/index.esm.js.map +1 -0
- package/radio/package.json +5 -0
- package/select/index.cjs.js +2 -0
- package/select/index.cjs.js.map +1 -0
- package/select/index.d.ts +195 -0
- package/select/index.esm.js +2 -0
- package/select/index.esm.js.map +1 -0
- package/select/package.json +5 -0
- package/style/scss/_variables.scss +4 -0
- package/style/scss/bootstrap.scss +1 -0
- package/style/scss/components/button/_button.scss +494 -494
- package/style/scss/components/data/_datatable.scss +1 -0
- package/style/scss/components/data/_picklist.scss +61 -61
- package/style/scss/components/input/_iconfield.scss +5 -4
- package/style/scss/components/input/_inputswitch.scss +80 -70
- package/style/scss/core/_mixins.scss +195 -195
- package/style/scss/core/_reset.scss +75 -74
- package/switch/index.cjs.js +2 -0
- package/switch/index.cjs.js.map +1 -0
- package/switch/index.d.ts +169 -0
- package/switch/index.esm.js +2 -0
- package/switch/index.esm.js.map +1 -0
- package/switch/package.json +5 -0
- package/table/index.cjs.js +1 -1
- package/table/index.cjs.js.map +1 -1
- package/table/index.d.ts +14 -1
- package/table/index.esm.js +1 -1
- package/table/index.esm.js.map +1 -1
- package/tabview/index.d.ts +17 -1
- package/textarea/index.cjs.js +2 -0
- package/textarea/index.cjs.js.map +1 -0
- package/textarea/index.d.ts +165 -0
- package/textarea/index.esm.js +2 -0
- package/textarea/index.esm.js.map +1 -0
- package/textarea/package.json +5 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Realiza o mapeamento dos valores da propriedades css `align-items`
|
|
5
|
+
*/
|
|
6
|
+
type AlignItemsProps =
|
|
7
|
+
| "align-items-start"
|
|
8
|
+
| "align-items-end"
|
|
9
|
+
| "align-items-center"
|
|
10
|
+
| "align-items-baseline"
|
|
11
|
+
| "align-items-stretch"
|
|
12
|
+
| "align-items-sm-start"
|
|
13
|
+
| "align-items-sm-end"
|
|
14
|
+
| "align-items-sm-center"
|
|
15
|
+
| "align-items-sm-baseline"
|
|
16
|
+
| "align-items-sm-stretch"
|
|
17
|
+
| "align-items-md-start"
|
|
18
|
+
| "align-items-md-end"
|
|
19
|
+
| "align-items-md-center"
|
|
20
|
+
| "align-items-md-baseline"
|
|
21
|
+
| "align-items-md-stretch"
|
|
22
|
+
| "align-items-lg-start"
|
|
23
|
+
| "align-items-lg-end"
|
|
24
|
+
| "align-items-lg-center"
|
|
25
|
+
| "align-items-lg-baseline"
|
|
26
|
+
| "align-items-lg-stretch"
|
|
27
|
+
| "align-items-xl-start"
|
|
28
|
+
| "align-items-xl-end"
|
|
29
|
+
| "align-items-xl-center"
|
|
30
|
+
| "align-items-xl-baseline"
|
|
31
|
+
| "align-items-xl-stretch"
|
|
32
|
+
| "align-items-xxl-start"
|
|
33
|
+
| "align-items-xxl-end"
|
|
34
|
+
| "align-items-xxl-center"
|
|
35
|
+
| "align-items-xxl-baseline"
|
|
36
|
+
| "align-items-xxl-stretch";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Realiza o mapeamento dos valores da propriedades css `justify-content`
|
|
40
|
+
*/
|
|
41
|
+
type JustifyContentProps =
|
|
42
|
+
| "justify-content-start"
|
|
43
|
+
| "justify-content-end"
|
|
44
|
+
| "justify-content-center"
|
|
45
|
+
| "justify-content-between"
|
|
46
|
+
| "justify-content-around"
|
|
47
|
+
| "justify-content-evenly"
|
|
48
|
+
| "justify-content-sm-start"
|
|
49
|
+
| "justify-content-sm-end"
|
|
50
|
+
| "justify-content-sm-center"
|
|
51
|
+
| "justify-content-sm-between"
|
|
52
|
+
| "justify-content-sm-around"
|
|
53
|
+
| "justify-content-sm-evenly"
|
|
54
|
+
| "justify-content-md-start"
|
|
55
|
+
| "justify-content-md-end"
|
|
56
|
+
| "justify-content-md-center"
|
|
57
|
+
| "justify-content-md-between"
|
|
58
|
+
| "justify-content-md-around"
|
|
59
|
+
| "justify-content-md-evenly"
|
|
60
|
+
| "justify-content-lg-start"
|
|
61
|
+
| "justify-content-lg-end"
|
|
62
|
+
| "justify-content-lg-center"
|
|
63
|
+
| "justify-content-lg-between"
|
|
64
|
+
| "justify-content-lg-around"
|
|
65
|
+
| "justify-content-lg-evenly"
|
|
66
|
+
| "justify-content-xl-start"
|
|
67
|
+
| "justify-content-xl-end"
|
|
68
|
+
| "justify-content-xl-center"
|
|
69
|
+
| "justify-content-xl-between"
|
|
70
|
+
| "justify-content-xl-around"
|
|
71
|
+
| "justify-content-xl-evenly"
|
|
72
|
+
| "justify-content-xxl-start"
|
|
73
|
+
| "justify-content-xxl-end"
|
|
74
|
+
| "justify-content-xxl-center"
|
|
75
|
+
| "justify-content-xxl-between"
|
|
76
|
+
| "justify-content-xxl-around"
|
|
77
|
+
| "justify-content-xxl-evenly";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Define as tipagens `default` de todos os componentes do pacote
|
|
81
|
+
*/
|
|
82
|
+
interface ApiComponentProps {
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Propriedade para identificar o id do elemento
|
|
86
|
+
*/
|
|
87
|
+
id?: string
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adiciona no atributo `class` do componente o valor atribuido nessa propriedade
|
|
91
|
+
*/
|
|
92
|
+
className?: string
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Define o tamanho da box do componente de acordo com o valores abaixo
|
|
96
|
+
*/
|
|
97
|
+
size?: "5" | "10" | "12-5" | "15" | "17-5" | "20" | "22-5" | "25" | "30" | "33" | "35" | "40" | "45" | "50" | "55" | "60" | "65" | "70" | "75" | "80" | "85" | "90" | "95" | "100"
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Define as propriedades css do component `style`
|
|
101
|
+
*/
|
|
102
|
+
css?: CSSProperties
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Define as cores padrão as UI de componentes
|
|
107
|
+
*/
|
|
108
|
+
type ApiColorProps =
|
|
109
|
+
"primary" |
|
|
110
|
+
"secondary" |
|
|
111
|
+
"success" |
|
|
112
|
+
"danger" |
|
|
113
|
+
"light" |
|
|
114
|
+
"gray" |
|
|
115
|
+
"warning" |
|
|
116
|
+
"info" |
|
|
117
|
+
"dark" |
|
|
118
|
+
"white";
|
|
119
|
+
|
|
120
|
+
interface LoadingProps extends Omit<ApiComponentProps, "size" | "id"> {
|
|
121
|
+
/**
|
|
122
|
+
* Define se o loading vai se exibido
|
|
123
|
+
*/
|
|
124
|
+
visible: boolean
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A propriedade `align` determina o alinhamento do conteúdo base na propriedade `direction`.
|
|
128
|
+
* Essa propriedade ajusta os estilos CSS `align-items`, permitindo um controle preciso do layout.
|
|
129
|
+
*/
|
|
130
|
+
align?: AlignItemsProps | AlignItemsProps[]
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A propriedade `justify` determina o alinhamento do conteúdo base na propriedade `direction`.
|
|
134
|
+
* Essa propriedade ajusta os estilos CSS `justify-content`, permitindo um controle preciso do layout.
|
|
135
|
+
*/
|
|
136
|
+
justify?: JustifyContentProps | JustifyContentProps[]
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Define a opacidade do fundo da box de carregamento
|
|
140
|
+
*/
|
|
141
|
+
opacity?: string
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Define o tipo do loading
|
|
145
|
+
*/
|
|
146
|
+
type?: "border" | "grow"
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Define a mensagem do load
|
|
150
|
+
*/
|
|
151
|
+
text?: string
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Define as cores padrão do component
|
|
155
|
+
*/
|
|
156
|
+
color?: ApiColorProps
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Personaliza a propriedade zindex do componente de loading
|
|
160
|
+
*/
|
|
161
|
+
zindex?: number
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Componente - `Loading`
|
|
166
|
+
*
|
|
167
|
+
* Um componente versátil que pode ser utilizado para exibir informação de carregando.
|
|
168
|
+
* Permite personalizar o estilo e o conteúdo através de propriedades.
|
|
169
|
+
*/
|
|
170
|
+
declare const Loading: ({ opacity, ...props }: LoadingProps) => false | React.JSX.Element;
|
|
171
|
+
|
|
172
|
+
export { Loading };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"react";import{classNames as t}from"primereact/utils";const i=({opacity:i="0.5",...a})=>{const r={justify:void 0===a.justify?"justify-content-center":Array.isArray(a.justify)?a.justify?.join(" "):a.justify,align:void 0===a.align?"align-items-center":Array.isArray(a.align)?a.align?.join(" "):a.align},s={className:t([r.align,r.justify,a.className,"box-loading",`text-${a.color??"white"}`]),style:{zIndex:a.zindex??1,background:"rgba(0,0,0, "+i+")",...a.css??{}}};return a.visible&&e.createElement("div",{...s},e.createElement("div",{className:`spinner-${a.type??"border"}`},e.createElement("span",{className:"visually-hidden"},"Loading...")),a.text??e.createElement("p",{className:"mt-1"},a.text))};export{i as Loading};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/loading/loading.tsx"],"sourcesContent":["import { LoadingProps } from \"./types\";\r\nimport React, { HTMLAttributes } from \"react\";\r\nimport { classNames } from \"primereact/utils\";\r\n\r\n/**\r\n * Componente - `Loading`\r\n *\r\n * Um componente versátil que pode ser utilizado para exibir informação de carregando.\r\n * Permite personalizar o estilo e o conteúdo através de propriedades.\r\n */\r\nexport const Loading = ({ opacity = \"0.5\", ...props }: LoadingProps) => {\r\n const css = {\r\n justify: props.justify === undefined ? \"justify-content-center\" : Array.isArray(props.justify) ? props.justify?.join(\" \") : props.justify,\r\n align: props.align === undefined ? \"align-items-center\" : Array.isArray(props.align) ? props.align?.join(\" \") : props.align,\r\n };\r\n const attr: HTMLAttributes<\"div\"> = {\r\n className: classNames([\r\n css.align,\r\n css.justify,\r\n props.className,\r\n \"box-loading\",\r\n `text-${props.color ?? \"white\"}`,\r\n ]),\r\n style: {\r\n zIndex: props.zindex ?? 1,\r\n background: \"rgba(0,0,0, \" + opacity + \")\", ...props.css ?? {}\r\n }\r\n };\r\n\r\n /*\r\n |------------------------------------------\r\n | render() - Renderização do componente\r\n |------------------------------------------\r\n */\r\n return props.visible && (\r\n <div {...attr as any}>\r\n <div className={`spinner-${props.type ?? \"border\"}`}>\r\n <span className=\"visually-hidden\">Loading...</span>\r\n </div>\r\n {props.text ?? <p className=\"mt-1\">{props.text}</p>}\r\n </div>\r\n );\r\n};"],"names":["Loading","opacity","props","css","justify","undefined","Array","isArray","join","align","attr","className","classNames","color","style","zIndex","zindex","background","visible","React","createElement","type","text"],"mappings":"mEAUO,MAAMA,EAAU,EAAGC,UAAU,SAAUC,MAC1C,MAAMC,EAAM,CACRC,aAA2BC,IAAlBH,EAAME,QAAwB,yBAA2BE,MAAMC,QAAQL,EAAME,SAAWF,EAAME,SAASI,KAAK,KAAON,EAAME,QAClIK,WAAuBJ,IAAhBH,EAAMO,MAAsB,qBAAuBH,MAAMC,QAAQL,EAAMO,OAASP,EAAMO,OAAOD,KAAK,KAAON,EAAMO,OAEpHC,EAA8B,CAChCC,UAAWC,EAAW,CAClBT,EAAIM,MACJN,EAAIC,QACJF,EAAMS,UACN,cACA,QAAQT,EAAMW,OAAS,YAE3BC,MAAO,CACHC,OAAQb,EAAMc,QAAU,EACxBC,WAAY,eAAiBhB,EAAU,OAAQC,EAAMC,KAAO,CAAA,IASpE,OAAOD,EAAMgB,SACTC,0BAAST,GACLS,EAAKC,cAAA,MAAA,CAAAT,UAAW,WAAWT,EAAMmB,MAAQ,YACrCF,EAAAC,cAAA,OAAA,CAAMT,UAAU,mBAAiB,eAEpCT,EAAMoB,MAAQH,EAAAC,cAAA,IAAA,CAAGT,UAAU,QAAQT,EAAMoB,MAEjD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),i=require("primereact/dialog");function a(i){const a=void 0!==i.icon?e.createElement("h5",{className:"fw-semibold"},e.createElement("i",{className:"me-1 "+(i.iconPrefix??"bi bi-")+i.icon}),i.header):i.header;return{appendTo:"self",visible:i.visible,onHide(){i.onVisible(!i.visible)},modal:void 0===i.background||i.background,dismissableMask:void 0===i.backdrop||!i.backdrop,maximizable:i.maximizable,draggable:i.draggable,closable:void 0===i.closable||i.closable,baseZIndex:i.zIndex??1e3,position:i.position,header:a,footer:i.footer,showHeader:!(!1===i.header)}}exports.Modal=function(o){let s=o.sizes?"small"===o.sizes?"300px":"medium"===o.sizes?"500px":"large"===o.sizes?"800px":"80%":void 0;const[r,l]=e.useState(o.maximized??!1);return e.createElement(i.Dialog,{style:r?{}:{width:s},...a(o),breakpoints:{"768px":"80%","576px":"90%"},maximized:r,onMaximize:()=>l(!r)},o.children)};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/modal/core/core.tsx","../../src/modal/modal.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { ModalProps } from \"../types\";\r\nimport { DialogProps } from \"primereact/dialog\";\r\n\r\n/**\r\n * `Core`\r\n * Define as propriedades base para funcionamento da Modal\r\n */\r\nexport function modalCore(\r\n props: ModalProps\r\n): DialogProps {\r\n const title = props.icon !== undefined\r\n ? <h5 className=\"fw-semibold\">\r\n <i className={\"me-1 \" + (props.iconPrefix ?? \"bi bi-\") + props.icon}/>{props.header}</h5>\r\n : props.header;\r\n\r\n return {\r\n appendTo: \"self\",\r\n visible: props.visible,\r\n onHide() {\r\n props.onVisible(!props.visible);\r\n },\r\n modal: props.background === undefined || props.background,\r\n dismissableMask: props.backdrop === undefined || !props.backdrop,\r\n\r\n maximizable: props.maximizable,\r\n draggable: props.draggable,\r\n closable: props.closable === undefined || props.closable,\r\n baseZIndex: props.zIndex ?? 1000,\r\n\r\n position: props.position,\r\n header: title,\r\n footer: props.footer,\r\n showHeader: !(props.header === false),\r\n };\r\n}","import React, { useState } from \"react\";\r\nimport { ModalProps } from \"./types\";\r\nimport { modalCore } from \"./core/core\";\r\nimport { Dialog } from \"primereact/dialog\";\r\n\r\n/**\r\n * Componente - `Modal`\r\n *\r\n * Um componente versátil que é utilizado exibir dados em forma de janela suspensa.\r\n */\r\nexport function Modal(props: ModalProps) {\r\n let sizes = !props.sizes ? undefined\r\n : props.sizes === \"small\" ? \"300px\"\r\n : props.sizes === \"medium\" ? \"500px\"\r\n : props.sizes === \"large\" ? \"800px\" : \"80%\";\r\n const [maximized, setMaximized] = useState(props.maximized ?? false);\r\n\r\n /*\r\n |------------------------------------------\r\n | render() - Renderização do componente\r\n |------------------------------------------\r\n */\r\n return (\r\n <Dialog style={!maximized ? { width: sizes } : {}}\r\n {...modalCore(props)}\r\n breakpoints={{\r\n \"768px\": \"80%\",\r\n \"576px\": \"90%\",\r\n }}\r\n maximized={maximized}\r\n onMaximize={() => setMaximized(!maximized)}>\r\n {props.children}\r\n </Dialog>\r\n );\r\n}"],"names":["modalCore","props","title","undefined","icon","React","createElement","className","iconPrefix","header","appendTo","visible","onHide","onVisible","modal","background","dismissableMask","backdrop","maximizable","draggable","closable","baseZIndex","zIndex","position","footer","showHeader","sizes","maximized","setMaximized","useState","Dialog","style","width","breakpoints","onMaximize","children"],"mappings":"mEAQM,SAAUA,EACZC,GAEA,MAAMC,OAAuBC,IAAfF,EAAMG,KACdC,EAAAC,cAAA,KAAA,CAAIC,UAAU,eACZF,EAAAC,cAAA,IAAA,CAAGC,UAAW,SAAWN,EAAMO,YAAc,UAAYP,EAAMG,OAAQH,EAAMQ,QAC/ER,EAAMQ,OAEZ,MAAO,CACHC,SAAU,OACVC,QAASV,EAAMU,QACf,MAAAC,GACIX,EAAMY,WAAWZ,EAAMU,QAC1B,EACDG,WAA4BX,IAArBF,EAAMc,YAA4Bd,EAAMc,WAC/CC,qBAAoCb,IAAnBF,EAAMgB,WAA2BhB,EAAMgB,SAExDC,YAAajB,EAAMiB,YACnBC,UAAWlB,EAAMkB,UACjBC,cAA6BjB,IAAnBF,EAAMmB,UAA0BnB,EAAMmB,SAChDC,WAAYpB,EAAMqB,QAAU,IAE5BC,SAAUtB,EAAMsB,SAChBd,OAAQP,EACRsB,OAAQvB,EAAMuB,OACdC,cAA+B,IAAjBxB,EAAMQ,QAE5B,eCzBM,SAAgBR,GAClB,IAAIyB,EAASzB,EAAMyB,MACG,UAAhBzB,EAAMyB,MAAoB,QACN,WAAhBzB,EAAMyB,MAAqB,QACP,UAAhBzB,EAAMyB,MAAoB,QAAU,WAHvBvB,EAI3B,MAAOwB,EAAWC,GAAgBC,EAAQA,SAAC5B,EAAM0B,YAAa,GAO9D,OACItB,EAACC,cAAAwB,EAAAA,OAAO,CAAAC,MAAQJ,EAA+B,CAAA,EAAnB,CAAEK,MAAON,MACzB1B,EAAUC,GACdgC,YAAa,CACT,QAAS,MACT,QAAS,OAEbN,UAAWA,EACXO,WAAY,IAAMN,GAAcD,IACnC1B,EAAMkC,SAGnB"}
|
package/modal/index.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DialogProps } from 'primereact/dialog';
|
|
3
|
+
|
|
4
|
+
interface ModalProps extends Pick<DialogProps, "maximizable" | "maximized" | "draggable" | "closable" | "position"> {
|
|
5
|
+
/**
|
|
6
|
+
* Conteúdo que será exibido dentro da modal
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Define o state da modal aberta ou fechada
|
|
12
|
+
*/
|
|
13
|
+
visible: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Define se vai ser exibido o fundo da modal
|
|
17
|
+
*/
|
|
18
|
+
background?: boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Define se a modal vai ser fechada clicando no fundo
|
|
22
|
+
*/
|
|
23
|
+
backdrop?: boolean
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Define o cabeçalho da modal
|
|
27
|
+
*/
|
|
28
|
+
header?: React.ReactNode | string | false;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Define o rodapé da modal
|
|
32
|
+
*/
|
|
33
|
+
footer?: React.ReactNode | string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Define o tamanho da modal
|
|
37
|
+
*/
|
|
38
|
+
sizes?: "small" | "medium" | "large" | "extra-large";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Define o icone do campo
|
|
42
|
+
*/
|
|
43
|
+
icon?: string
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Define o prefixo dos icones do pacote
|
|
47
|
+
*/
|
|
48
|
+
iconPrefix?: "bi bi-" | "pi pi-"
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Define a propriedade css `zindex` da modal
|
|
52
|
+
*/
|
|
53
|
+
zIndex?: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Metodo responsável por atualizar state do modal
|
|
57
|
+
*/
|
|
58
|
+
onVisible(value: boolean): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Componente - `Modal`
|
|
63
|
+
*
|
|
64
|
+
* Um componente versátil que é utilizado exibir dados em forma de janela suspensa.
|
|
65
|
+
*/
|
|
66
|
+
declare function Modal(props: ModalProps): React.JSX.Element;
|
|
67
|
+
|
|
68
|
+
export { Modal };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as i}from"react";import{Dialog as a}from"primereact/dialog";function o(i){const a=void 0!==i.icon?e.createElement("h5",{className:"fw-semibold"},e.createElement("i",{className:"me-1 "+(i.iconPrefix??"bi bi-")+i.icon}),i.header):i.header;return{appendTo:"self",visible:i.visible,onHide(){i.onVisible(!i.visible)},modal:void 0===i.background||i.background,dismissableMask:void 0===i.backdrop||!i.backdrop,maximizable:i.maximizable,draggable:i.draggable,closable:void 0===i.closable||i.closable,baseZIndex:i.zIndex??1e3,position:i.position,header:a,footer:i.footer,showHeader:!(!1===i.header)}}function s(s){let r=s.sizes?"small"===s.sizes?"300px":"medium"===s.sizes?"500px":"large"===s.sizes?"800px":"80%":void 0;const[l,d]=i(s.maximized??!1);return e.createElement(a,{style:l?{}:{width:r},...o(s),breakpoints:{"768px":"80%","576px":"90%"},maximized:l,onMaximize:()=>d(!l)},s.children)}export{s as Modal};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/modal/core/core.tsx","../../src/modal/modal.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { ModalProps } from \"../types\";\r\nimport { DialogProps } from \"primereact/dialog\";\r\n\r\n/**\r\n * `Core`\r\n * Define as propriedades base para funcionamento da Modal\r\n */\r\nexport function modalCore(\r\n props: ModalProps\r\n): DialogProps {\r\n const title = props.icon !== undefined\r\n ? <h5 className=\"fw-semibold\">\r\n <i className={\"me-1 \" + (props.iconPrefix ?? \"bi bi-\") + props.icon}/>{props.header}</h5>\r\n : props.header;\r\n\r\n return {\r\n appendTo: \"self\",\r\n visible: props.visible,\r\n onHide() {\r\n props.onVisible(!props.visible);\r\n },\r\n modal: props.background === undefined || props.background,\r\n dismissableMask: props.backdrop === undefined || !props.backdrop,\r\n\r\n maximizable: props.maximizable,\r\n draggable: props.draggable,\r\n closable: props.closable === undefined || props.closable,\r\n baseZIndex: props.zIndex ?? 1000,\r\n\r\n position: props.position,\r\n header: title,\r\n footer: props.footer,\r\n showHeader: !(props.header === false),\r\n };\r\n}","import React, { useState } from \"react\";\r\nimport { ModalProps } from \"./types\";\r\nimport { modalCore } from \"./core/core\";\r\nimport { Dialog } from \"primereact/dialog\";\r\n\r\n/**\r\n * Componente - `Modal`\r\n *\r\n * Um componente versátil que é utilizado exibir dados em forma de janela suspensa.\r\n */\r\nexport function Modal(props: ModalProps) {\r\n let sizes = !props.sizes ? undefined\r\n : props.sizes === \"small\" ? \"300px\"\r\n : props.sizes === \"medium\" ? \"500px\"\r\n : props.sizes === \"large\" ? \"800px\" : \"80%\";\r\n const [maximized, setMaximized] = useState(props.maximized ?? false);\r\n\r\n /*\r\n |------------------------------------------\r\n | render() - Renderização do componente\r\n |------------------------------------------\r\n */\r\n return (\r\n <Dialog style={!maximized ? { width: sizes } : {}}\r\n {...modalCore(props)}\r\n breakpoints={{\r\n \"768px\": \"80%\",\r\n \"576px\": \"90%\",\r\n }}\r\n maximized={maximized}\r\n onMaximize={() => setMaximized(!maximized)}>\r\n {props.children}\r\n </Dialog>\r\n );\r\n}"],"names":["modalCore","props","title","undefined","icon","React","createElement","className","iconPrefix","header","appendTo","visible","onHide","onVisible","modal","background","dismissableMask","backdrop","maximizable","draggable","closable","baseZIndex","zIndex","position","footer","showHeader","Modal","sizes","maximized","setMaximized","useState","Dialog","style","width","breakpoints","onMaximize","children"],"mappings":"+EAQM,SAAUA,EACZC,GAEA,MAAMC,OAAuBC,IAAfF,EAAMG,KACdC,EAAAC,cAAA,KAAA,CAAIC,UAAU,eACZF,EAAAC,cAAA,IAAA,CAAGC,UAAW,SAAWN,EAAMO,YAAc,UAAYP,EAAMG,OAAQH,EAAMQ,QAC/ER,EAAMQ,OAEZ,MAAO,CACHC,SAAU,OACVC,QAASV,EAAMU,QACf,MAAAC,GACIX,EAAMY,WAAWZ,EAAMU,QAC1B,EACDG,WAA4BX,IAArBF,EAAMc,YAA4Bd,EAAMc,WAC/CC,qBAAoCb,IAAnBF,EAAMgB,WAA2BhB,EAAMgB,SAExDC,YAAajB,EAAMiB,YACnBC,UAAWlB,EAAMkB,UACjBC,cAA6BjB,IAAnBF,EAAMmB,UAA0BnB,EAAMmB,SAChDC,WAAYpB,EAAMqB,QAAU,IAE5BC,SAAUtB,EAAMsB,SAChBd,OAAQP,EACRsB,OAAQvB,EAAMuB,OACdC,cAA+B,IAAjBxB,EAAMQ,QAE5B,CCzBM,SAAUiB,EAAMzB,GAClB,IAAI0B,EAAS1B,EAAM0B,MACG,UAAhB1B,EAAM0B,MAAoB,QACN,WAAhB1B,EAAM0B,MAAqB,QACP,UAAhB1B,EAAM0B,MAAoB,QAAU,WAHvBxB,EAI3B,MAAOyB,EAAWC,GAAgBC,EAAS7B,EAAM2B,YAAa,GAO9D,OACIvB,EAACC,cAAAyB,EAAO,CAAAC,MAAQJ,EAA+B,CAAA,EAAnB,CAAEK,MAAON,MACzB3B,EAAUC,GACdiC,YAAa,CACT,QAAS,MACT,QAAS,OAEbN,UAAWA,EACXO,WAAY,IAAMN,GAAcD,IACnC3B,EAAMmC,SAGnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangesix/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Luiz Fernando Bernardes de Paula",
|
|
6
6
|
"description": "Biblioteca de components React UI pronto para uso.",
|
|
@@ -23,15 +23,26 @@
|
|
|
23
23
|
"@tiptap/react": "^2.11.5",
|
|
24
24
|
"@tiptap/starter-kit": "^2.11.5",
|
|
25
25
|
"@webdatarocks/react-webdatarocks": "^1.4.15",
|
|
26
|
-
"axios": "^1.
|
|
26
|
+
"axios": "^1.8.3",
|
|
27
27
|
"bootstrap": "^5.3.3",
|
|
28
28
|
"bootstrap-icons": "^1.11.3",
|
|
29
29
|
"jquery": "^3.7.1",
|
|
30
30
|
"node-snackbar": "^0.1.16",
|
|
31
31
|
"primeicons": "^7.0.0",
|
|
32
|
-
"primereact": "^10.9.
|
|
32
|
+
"primereact": "^10.9.3",
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0",
|
|
35
|
+
"react-hook-form": "^7.54.2",
|
|
36
|
+
"sweetalert2": "^11.17.2"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"axios": "^1.7.9",
|
|
40
|
+
"bootstrap": "^5.3.3",
|
|
41
|
+
"bootstrap-icons": "^1.11.3",
|
|
42
|
+
"jquery": "^3.7.1",
|
|
33
43
|
"react": "^19.0.0",
|
|
34
44
|
"react-dom": "^19.0.0",
|
|
35
|
-
"
|
|
45
|
+
"primeicons": "^7.0.0",
|
|
46
|
+
"primereact": "^10.9.2"
|
|
36
47
|
}
|
|
37
48
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("primereact/utils"),a=require("primereact/checkbox"),i=require("primereact/picklist");const r=({children:a,...i})=>{const r={size:`box-size-${i.size??"100"}`,direction:`box-direction-${i.direction??"row"}`,justify:void 0===i.justify?"":Array.isArray(i.justify)?i.justify?.join(" "):i.justify,align:void 0===i.align?"":Array.isArray(i.align)?i.align?.join(" "):i.align},s={className:t.classNames(["box",i.className??"",r.size,r.direction,r.justify,r.align]),style:i.css,id:i.id};return e.createElement("div",{...s},a)};function s(t){return e.createElement("div",{className:"w-100 d-flex px-2 align-items-center"},e.createElement(a.Checkbox,{checked:t.selected??!1,className:"me-2",defaultChecked:t.selected}),e.createElement("p",{className:"m-0"},t.label))}function c(e){return{dataKey:e.dataKey??"id",showSourceControls:!1,showTargetControls:!1,sourceHeader:e.sourceHeader,targetHeader:e.targetHeader,itemTemplate:s,filter:e.filter??void 0,filterBy:e.filter?e.filterBy??"label":void 0,sourceFilterPlaceholder:"Pesquisa pelo nome",targetFilterPlaceholder:"Pesquisa pelo nome"}}exports.PickList=function(t){const[a,s]=e.useState([]),[l,o]=e.useState([]);return e.useEffect((()=>{s(t.data.filter((e=>void 0===e.active||!e.active))),o(t.data.filter((e=>e.active)))}),[t.data]),e.createElement(r,{className:t.className,css:t.css,size:t.size??"100"},e.createElement(i.PickList,{className:"w-100",source:a,target:l,onChange:e=>{let a=e.target.map((e=>(delete e.selected,{...e,active:!0}))),i=e.source.map((e=>(delete e.selected,{...e,active:!1})));o(a),s(i),t.onChange([...i,...a])},onSourceSelectionChange:e=>s(a.map((t=>({...t,selected:e.value?.some((e=>e.id===t.id))})))),onTargetSelectionChange:e=>o(l.map((t=>({...t,selected:e.value?.some((e=>e.id===t.id))})))),...c(t)}))};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/box/box.tsx","../../src/picklist/core/core.tsx","../../src/picklist/picklist.tsx"],"sourcesContent":["import { BoxProps } from \"./types\";\r\nimport React, { HTMLAttributes } from \"react\";\r\nimport { classNames } from \"primereact/utils\";\r\n\r\n/**\r\n * Componente - `Box`\r\n *\r\n * Um componente versátil que pode ser utilizado para criar seções ou caixas em uma página.\r\n * Permite personalizar o estilo e o conteúdo através de propriedades.\r\n *\r\n * Exemplo de uso:\r\n * ```tsx\r\n * <Box align=\"align-items-center\"\r\n * justify=\"justify-content-end\"\r\n * size=\"25\">\r\n * ...conteúdo HTML\r\n * </Box>\r\n * ```\r\n */\r\nexport const Box = ({ children, ...props }: BoxProps) => {\r\n const css = {\r\n size: `box-size-${(props.size ?? \"100\")}`,\r\n direction: `box-direction-${props.direction ?? \"row\"}`,\r\n justify: props.justify === undefined ? \"\" : Array.isArray(props.justify) ? props.justify?.join(\" \") : props.justify,\r\n align: props.align === undefined ? \"\" : Array.isArray(props.align) ? props.align?.join(\" \") : props.align\r\n };\r\n\r\n const attr: HTMLAttributes<\"div\"> & Omit<BoxProps, \"children\"> = {\r\n className: classNames([\r\n \"box\",\r\n props.className ?? \"\",\r\n css.size,\r\n css.direction,\r\n css.justify,\r\n css.align\r\n ]),\r\n style: props.css,\r\n id: props.id\r\n };\r\n\r\n return (\r\n <div {...attr as any}>{children}</div>\r\n );\r\n};","import React from \"react\";\r\nimport { Checkbox } from \"primereact/checkbox\";\r\nimport { PickListDataProps, PickListProps } from \"../types\";\r\nimport { PickListProps as PickListPrimeProps } from \"primereact/picklist\";\r\n\r\n/**\r\n * `Template`\r\n * Define o template padrão dos item do PickList\r\n */\r\nfunction pickListItemTemplate(\r\n item: PickListDataProps & { selected?: boolean }\r\n) {\r\n return (\r\n <div className=\"w-100 d-flex px-2 align-items-center\">\r\n <Checkbox checked={item.selected ?? false}\r\n className=\"me-2\"\r\n defaultChecked={item.selected}/>\r\n <p className=\"m-0\">{item.label}</p>\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * `Core`\r\n * Define as propriedades base para funcionamento do picklist\r\n */\r\nexport function pickListCore(\r\n props: PickListProps\r\n): PickListPrimeProps {\r\n return {\r\n dataKey: props.dataKey ?? \"id\",\r\n showSourceControls: false,\r\n showTargetControls: false,\r\n sourceHeader: props.sourceHeader,\r\n targetHeader: props.targetHeader,\r\n itemTemplate: pickListItemTemplate,\r\n\r\n filter: props.filter ?? undefined,\r\n filterBy: props.filter ? (props.filterBy ?? \"label\") : undefined,\r\n sourceFilterPlaceholder: \"Pesquisa pelo nome\",\r\n targetFilterPlaceholder: \"Pesquisa pelo nome\",\r\n };\r\n}","import { Box } from \"../box\";\r\nimport { PickListProps } from \"./types\";\r\nimport { pickListCore } from \"./core/core\";\r\nimport React, { useState, useEffect } from \"react\";\r\nimport { PickList as PickListPrime } from \"primereact/picklist\";\r\n\r\n/**\r\n * Componente - `PickList`\r\n *\r\n * Um componente versátil que é utilizado para reordenar itens entre listas diferentes.\r\n */\r\nexport function PickList(props: PickListProps) {\r\n const [source, setSource] = useState<any>([]);\r\n const [target, setTarget] = useState<any>([]);\r\n\r\n useEffect(() => {\r\n setSource(props.data.filter(item => item.active === undefined || !item.active));\r\n setTarget(props.data.filter(item => item.active));\r\n }, [props.data]);\r\n\r\n /*\r\n |------------------------------------------\r\n | render() - Renderização do componente\r\n |------------------------------------------\r\n */\r\n return (\r\n <Box className={props.className}\r\n css={props.css}\r\n size={props.size ?? \"100\"}>\r\n <PickListPrime className=\"w-100\"\r\n source={source}\r\n target={target}\r\n onChange={event => {\r\n let target = event.target.map((item: any) => {\r\n delete item.selected;\r\n return { ...item, active: true };\r\n });\r\n let source = event.source.map((item: any) => {\r\n delete item.selected;\r\n return { ...item, active: false };\r\n });\r\n setTarget(target);\r\n setSource(source);\r\n props.onChange([...source, ...target]);\r\n }}\r\n onSourceSelectionChange={event => setSource(source.map((item: any) => {\r\n return { ...item, selected: event.value?.some((obj: any) => obj.id === item.id) };\r\n }))}\r\n onTargetSelectionChange={event => setTarget(target.map((item: any) => {\r\n return { ...item, selected: event.value?.some((obj: any) => obj.id === item.id) };\r\n }))}\r\n {...pickListCore(props)}/>\r\n </Box>\r\n );\r\n}"],"names":["Box","children","props","css","size","direction","justify","undefined","Array","isArray","join","align","attr","className","classNames","style","id","React","createElement","pickListItemTemplate","item","Checkbox","checked","selected","defaultChecked","label","pickListCore","dataKey","showSourceControls","showTargetControls","sourceHeader","targetHeader","itemTemplate","filter","filterBy","sourceFilterPlaceholder","targetFilterPlaceholder","source","setSource","useState","target","setTarget","useEffect","data","active","PickListPrime","onChange","event","map","onSourceSelectionChange","value","some","obj","onTargetSelectionChange"],"mappings":"oIAmBO,MAAMA,EAAM,EAAGC,cAAaC,MAC/B,MAAMC,EAAM,CACRC,KAAM,YAAaF,EAAME,MAAQ,QACjCC,UAAW,iBAAiBH,EAAMG,WAAa,QAC/CC,aAA2BC,IAAlBL,EAAMI,QAAwB,GAAKE,MAAMC,QAAQP,EAAMI,SAAWJ,EAAMI,SAASI,KAAK,KAAOR,EAAMI,QAC5GK,WAAuBJ,IAAhBL,EAAMS,MAAsB,GAAKH,MAAMC,QAAQP,EAAMS,OAAST,EAAMS,OAAOD,KAAK,KAAOR,EAAMS,OAGlGC,EAA2D,CAC7DC,UAAWC,EAAAA,WAAW,CAClB,MACAZ,EAAMW,WAAa,GACnBV,EAAIC,KACJD,EAAIE,UACJF,EAAIG,QACJH,EAAIQ,QAERI,MAAOb,EAAMC,IACba,GAAId,EAAMc,IAGd,OACIC,EAASC,cAAA,MAAA,IAAAN,GAAcX,EAAe,EChC9C,SAASkB,EACLC,GAEA,OACIH,EAAAC,cAAA,MAAA,CAAKL,UAAU,wCACXI,EAAAC,cAACG,EAAAA,SAAS,CAAAC,QAASF,EAAKG,WAAY,EAC1BV,UAAU,OACVW,eAAgBJ,EAAKG,WAC/BN,EAAGC,cAAA,IAAA,CAAAL,UAAU,OAAOO,EAAKK,OAGrC,CAMM,SAAUC,EACZxB,GAEA,MAAO,CACHyB,QAASzB,EAAMyB,SAAW,KAC1BC,oBAAoB,EACpBC,oBAAoB,EACpBC,aAAc5B,EAAM4B,aACpBC,aAAc7B,EAAM6B,aACpBC,aAAcb,EAEdc,OAAQ/B,EAAM+B,aAAU1B,EACxB2B,SAAUhC,EAAM+B,OAAU/B,EAAMgC,UAAY,aAAW3B,EACvD4B,wBAAyB,qBACzBC,wBAAyB,qBAEjC,kBC/BM,SAAmBlC,GACrB,MAAOmC,EAAQC,GAAaC,EAAAA,SAAc,KACnCC,EAAQC,GAAaF,EAAAA,SAAc,IAY1C,OAVAG,EAAAA,WAAU,KACNJ,EAAUpC,EAAMyC,KAAKV,QAAOb,QAAwBb,IAAhBa,EAAKwB,SAAyBxB,EAAKwB,UACvEH,EAAUvC,EAAMyC,KAAKV,QAAOb,GAAQA,EAAKwB,SAAQ,GAClD,CAAC1C,EAAMyC,OAQN1B,gBAACjB,EAAG,CAACa,UAAWX,EAAMW,UACjBV,IAAKD,EAAMC,IACXC,KAAMF,EAAME,MAAQ,OACrBa,EAAAC,cAAC2B,WAAc,CAAAhC,UAAU,QACVwB,OAAQA,EACRG,OAAQA,EACRM,SAAUC,IACN,IAAIP,EAASO,EAAMP,OAAOQ,KAAK5B,WACpBA,EAAKG,SACL,IAAKH,EAAMwB,QAAQ,MAE1BP,EAASU,EAAMV,OAAOW,KAAK5B,WACpBA,EAAKG,SACL,IAAKH,EAAMwB,QAAQ,MAE9BH,EAAUD,GACVF,EAAUD,GACVnC,EAAM4C,SAAS,IAAIT,KAAWG,GAAQ,EAE1CS,wBAAyBF,GAAST,EAAUD,EAAOW,KAAK5B,IAC7C,IAAKA,EAAMG,SAAUwB,EAAMG,OAAOC,MAAMC,GAAaA,EAAIpC,KAAOI,EAAKJ,UAEhFqC,wBAAyBN,GAASN,EAAUD,EAAOQ,KAAK5B,IAC7C,IAAKA,EAAMG,SAAUwB,EAAMG,OAAOC,MAAMC,GAAaA,EAAIpC,KAAOI,EAAKJ,aAE5EU,EAAaxB,KAG5C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { PickListProps as PickListProps$1 } from 'primereact/picklist';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Define as tipagens `default` de todos os componentes do pacote
|
|
6
|
+
*/
|
|
7
|
+
interface ApiComponentProps {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Propriedade para identificar o id do elemento
|
|
11
|
+
*/
|
|
12
|
+
id?: string
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Adiciona no atributo `class` do componente o valor atribuido nessa propriedade
|
|
16
|
+
*/
|
|
17
|
+
className?: string
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Define o tamanho da box do componente de acordo com o valores abaixo
|
|
21
|
+
*/
|
|
22
|
+
size?: "5" | "10" | "12-5" | "15" | "17-5" | "20" | "22-5" | "25" | "30" | "33" | "35" | "40" | "45" | "50" | "55" | "60" | "65" | "70" | "75" | "80" | "85" | "90" | "95" | "100"
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Define as propriedades css do component `style`
|
|
26
|
+
*/
|
|
27
|
+
css?: CSSProperties
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface PickListDataProps {
|
|
31
|
+
/**
|
|
32
|
+
* Indificador do objeto
|
|
33
|
+
*/
|
|
34
|
+
id: any;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Label do objeto
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Define se objeto está ativo ou inativo
|
|
43
|
+
*/
|
|
44
|
+
active?: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PickListProps extends ApiComponentProps, Pick<PickListProps$1, "sourceHeader" | "targetHeader" | "filter" | "filterBy"> {
|
|
48
|
+
/**
|
|
49
|
+
* Define o array de objeto que será manipulado pelo componente
|
|
50
|
+
*/
|
|
51
|
+
data: PickListDataProps[]
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Define a chave de indentificação do objeto de dados
|
|
55
|
+
*/
|
|
56
|
+
dataKey?: string
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Callback executado quando o valor do PickList é alterado
|
|
60
|
+
*/
|
|
61
|
+
onChange(value: PickListDataProps[]): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Componente - `PickList`
|
|
66
|
+
*
|
|
67
|
+
* Um componente versátil que é utilizado para reordenar itens entre listas diferentes.
|
|
68
|
+
*/
|
|
69
|
+
declare function PickList(props: PickListProps): React.JSX.Element;
|
|
70
|
+
|
|
71
|
+
type IPickListDataProps = PickListDataProps;
|
|
72
|
+
|
|
73
|
+
export { type IPickListDataProps, PickList };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as t,useEffect as a}from"react";import{classNames as i}from"primereact/utils";import{Checkbox as r}from"primereact/checkbox";import{PickList as s}from"primereact/picklist";const c=({children:t,...a})=>{const r={size:`box-size-${a.size??"100"}`,direction:`box-direction-${a.direction??"row"}`,justify:void 0===a.justify?"":Array.isArray(a.justify)?a.justify?.join(" "):a.justify,align:void 0===a.align?"":Array.isArray(a.align)?a.align?.join(" "):a.align},s={className:i(["box",a.className??"",r.size,r.direction,r.justify,r.align]),style:a.css,id:a.id};return e.createElement("div",{...s},t)};function l(t){return e.createElement("div",{className:"w-100 d-flex px-2 align-items-center"},e.createElement(r,{checked:t.selected??!1,className:"me-2",defaultChecked:t.selected}),e.createElement("p",{className:"m-0"},t.label))}function o(e){return{dataKey:e.dataKey??"id",showSourceControls:!1,showTargetControls:!1,sourceHeader:e.sourceHeader,targetHeader:e.targetHeader,itemTemplate:l,filter:e.filter??void 0,filterBy:e.filter?e.filterBy??"label":void 0,sourceFilterPlaceholder:"Pesquisa pelo nome",targetFilterPlaceholder:"Pesquisa pelo nome"}}function n(i){const[r,l]=t([]),[n,d]=t([]);return a((()=>{l(i.data.filter((e=>void 0===e.active||!e.active))),d(i.data.filter((e=>e.active)))}),[i.data]),e.createElement(c,{className:i.className,css:i.css,size:i.size??"100"},e.createElement(s,{className:"w-100",source:r,target:n,onChange:e=>{let t=e.target.map((e=>(delete e.selected,{...e,active:!0}))),a=e.source.map((e=>(delete e.selected,{...e,active:!1})));d(t),l(a),i.onChange([...a,...t])},onSourceSelectionChange:e=>l(r.map((t=>({...t,selected:e.value?.some((e=>e.id===t.id))})))),onTargetSelectionChange:e=>d(n.map((t=>({...t,selected:e.value?.some((e=>e.id===t.id))})))),...o(i)}))}export{n as PickList};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/box/box.tsx","../../src/picklist/core/core.tsx","../../src/picklist/picklist.tsx"],"sourcesContent":["import { BoxProps } from \"./types\";\r\nimport React, { HTMLAttributes } from \"react\";\r\nimport { classNames } from \"primereact/utils\";\r\n\r\n/**\r\n * Componente - `Box`\r\n *\r\n * Um componente versátil que pode ser utilizado para criar seções ou caixas em uma página.\r\n * Permite personalizar o estilo e o conteúdo através de propriedades.\r\n *\r\n * Exemplo de uso:\r\n * ```tsx\r\n * <Box align=\"align-items-center\"\r\n * justify=\"justify-content-end\"\r\n * size=\"25\">\r\n * ...conteúdo HTML\r\n * </Box>\r\n * ```\r\n */\r\nexport const Box = ({ children, ...props }: BoxProps) => {\r\n const css = {\r\n size: `box-size-${(props.size ?? \"100\")}`,\r\n direction: `box-direction-${props.direction ?? \"row\"}`,\r\n justify: props.justify === undefined ? \"\" : Array.isArray(props.justify) ? props.justify?.join(\" \") : props.justify,\r\n align: props.align === undefined ? \"\" : Array.isArray(props.align) ? props.align?.join(\" \") : props.align\r\n };\r\n\r\n const attr: HTMLAttributes<\"div\"> & Omit<BoxProps, \"children\"> = {\r\n className: classNames([\r\n \"box\",\r\n props.className ?? \"\",\r\n css.size,\r\n css.direction,\r\n css.justify,\r\n css.align\r\n ]),\r\n style: props.css,\r\n id: props.id\r\n };\r\n\r\n return (\r\n <div {...attr as any}>{children}</div>\r\n );\r\n};","import React from \"react\";\r\nimport { Checkbox } from \"primereact/checkbox\";\r\nimport { PickListDataProps, PickListProps } from \"../types\";\r\nimport { PickListProps as PickListPrimeProps } from \"primereact/picklist\";\r\n\r\n/**\r\n * `Template`\r\n * Define o template padrão dos item do PickList\r\n */\r\nfunction pickListItemTemplate(\r\n item: PickListDataProps & { selected?: boolean }\r\n) {\r\n return (\r\n <div className=\"w-100 d-flex px-2 align-items-center\">\r\n <Checkbox checked={item.selected ?? false}\r\n className=\"me-2\"\r\n defaultChecked={item.selected}/>\r\n <p className=\"m-0\">{item.label}</p>\r\n </div>\r\n );\r\n}\r\n\r\n/**\r\n * `Core`\r\n * Define as propriedades base para funcionamento do picklist\r\n */\r\nexport function pickListCore(\r\n props: PickListProps\r\n): PickListPrimeProps {\r\n return {\r\n dataKey: props.dataKey ?? \"id\",\r\n showSourceControls: false,\r\n showTargetControls: false,\r\n sourceHeader: props.sourceHeader,\r\n targetHeader: props.targetHeader,\r\n itemTemplate: pickListItemTemplate,\r\n\r\n filter: props.filter ?? undefined,\r\n filterBy: props.filter ? (props.filterBy ?? \"label\") : undefined,\r\n sourceFilterPlaceholder: \"Pesquisa pelo nome\",\r\n targetFilterPlaceholder: \"Pesquisa pelo nome\",\r\n };\r\n}","import { Box } from \"../box\";\r\nimport { PickListProps } from \"./types\";\r\nimport { pickListCore } from \"./core/core\";\r\nimport React, { useState, useEffect } from \"react\";\r\nimport { PickList as PickListPrime } from \"primereact/picklist\";\r\n\r\n/**\r\n * Componente - `PickList`\r\n *\r\n * Um componente versátil que é utilizado para reordenar itens entre listas diferentes.\r\n */\r\nexport function PickList(props: PickListProps) {\r\n const [source, setSource] = useState<any>([]);\r\n const [target, setTarget] = useState<any>([]);\r\n\r\n useEffect(() => {\r\n setSource(props.data.filter(item => item.active === undefined || !item.active));\r\n setTarget(props.data.filter(item => item.active));\r\n }, [props.data]);\r\n\r\n /*\r\n |------------------------------------------\r\n | render() - Renderização do componente\r\n |------------------------------------------\r\n */\r\n return (\r\n <Box className={props.className}\r\n css={props.css}\r\n size={props.size ?? \"100\"}>\r\n <PickListPrime className=\"w-100\"\r\n source={source}\r\n target={target}\r\n onChange={event => {\r\n let target = event.target.map((item: any) => {\r\n delete item.selected;\r\n return { ...item, active: true };\r\n });\r\n let source = event.source.map((item: any) => {\r\n delete item.selected;\r\n return { ...item, active: false };\r\n });\r\n setTarget(target);\r\n setSource(source);\r\n props.onChange([...source, ...target]);\r\n }}\r\n onSourceSelectionChange={event => setSource(source.map((item: any) => {\r\n return { ...item, selected: event.value?.some((obj: any) => obj.id === item.id) };\r\n }))}\r\n onTargetSelectionChange={event => setTarget(target.map((item: any) => {\r\n return { ...item, selected: event.value?.some((obj: any) => obj.id === item.id) };\r\n }))}\r\n {...pickListCore(props)}/>\r\n </Box>\r\n );\r\n}"],"names":["Box","children","props","css","size","direction","justify","undefined","Array","isArray","join","align","attr","className","classNames","style","id","React","createElement","pickListItemTemplate","item","Checkbox","checked","selected","defaultChecked","label","pickListCore","dataKey","showSourceControls","showTargetControls","sourceHeader","targetHeader","itemTemplate","filter","filterBy","sourceFilterPlaceholder","targetFilterPlaceholder","PickList","source","setSource","useState","target","setTarget","useEffect","data","active","PickListPrime","onChange","event","map","onSourceSelectionChange","value","some","obj","onTargetSelectionChange"],"mappings":"+LAmBO,MAAMA,EAAM,EAAGC,cAAaC,MAC/B,MAAMC,EAAM,CACRC,KAAM,YAAaF,EAAME,MAAQ,QACjCC,UAAW,iBAAiBH,EAAMG,WAAa,QAC/CC,aAA2BC,IAAlBL,EAAMI,QAAwB,GAAKE,MAAMC,QAAQP,EAAMI,SAAWJ,EAAMI,SAASI,KAAK,KAAOR,EAAMI,QAC5GK,WAAuBJ,IAAhBL,EAAMS,MAAsB,GAAKH,MAAMC,QAAQP,EAAMS,OAAST,EAAMS,OAAOD,KAAK,KAAOR,EAAMS,OAGlGC,EAA2D,CAC7DC,UAAWC,EAAW,CAClB,MACAZ,EAAMW,WAAa,GACnBV,EAAIC,KACJD,EAAIE,UACJF,EAAIG,QACJH,EAAIQ,QAERI,MAAOb,EAAMC,IACba,GAAId,EAAMc,IAGd,OACIC,EAASC,cAAA,MAAA,IAAAN,GAAcX,EAAe,EChC9C,SAASkB,EACLC,GAEA,OACIH,EAAAC,cAAA,MAAA,CAAKL,UAAU,wCACXI,EAAAC,cAACG,EAAS,CAAAC,QAASF,EAAKG,WAAY,EAC1BV,UAAU,OACVW,eAAgBJ,EAAKG,WAC/BN,EAAGC,cAAA,IAAA,CAAAL,UAAU,OAAOO,EAAKK,OAGrC,CAMM,SAAUC,EACZxB,GAEA,MAAO,CACHyB,QAASzB,EAAMyB,SAAW,KAC1BC,oBAAoB,EACpBC,oBAAoB,EACpBC,aAAc5B,EAAM4B,aACpBC,aAAc7B,EAAM6B,aACpBC,aAAcb,EAEdc,OAAQ/B,EAAM+B,aAAU1B,EACxB2B,SAAUhC,EAAM+B,OAAU/B,EAAMgC,UAAY,aAAW3B,EACvD4B,wBAAyB,qBACzBC,wBAAyB,qBAEjC,CC/BM,SAAUC,EAASnC,GACrB,MAAOoC,EAAQC,GAAaC,EAAc,KACnCC,EAAQC,GAAaF,EAAc,IAY1C,OAVAG,GAAU,KACNJ,EAAUrC,EAAM0C,KAAKX,QAAOb,QAAwBb,IAAhBa,EAAKyB,SAAyBzB,EAAKyB,UACvEH,EAAUxC,EAAM0C,KAAKX,QAAOb,GAAQA,EAAKyB,SAAQ,GAClD,CAAC3C,EAAM0C,OAQN3B,gBAACjB,EAAG,CAACa,UAAWX,EAAMW,UACjBV,IAAKD,EAAMC,IACXC,KAAMF,EAAME,MAAQ,OACrBa,EAAAC,cAAC4B,EAAc,CAAAjC,UAAU,QACVyB,OAAQA,EACRG,OAAQA,EACRM,SAAUC,IACN,IAAIP,EAASO,EAAMP,OAAOQ,KAAK7B,WACpBA,EAAKG,SACL,IAAKH,EAAMyB,QAAQ,MAE1BP,EAASU,EAAMV,OAAOW,KAAK7B,WACpBA,EAAKG,SACL,IAAKH,EAAMyB,QAAQ,MAE9BH,EAAUD,GACVF,EAAUD,GACVpC,EAAM6C,SAAS,IAAIT,KAAWG,GAAQ,EAE1CS,wBAAyBF,GAAST,EAAUD,EAAOW,KAAK7B,IAC7C,IAAKA,EAAMG,SAAUyB,EAAMG,OAAOC,MAAMC,GAAaA,EAAIrC,KAAOI,EAAKJ,UAEhFsC,wBAAyBN,GAASN,EAAUD,EAAOQ,KAAK7B,IAC7C,IAAKA,EAAMG,SAAUyB,EAAMG,OAAOC,MAAMC,GAAaA,EAAIrC,KAAOI,EAAKJ,aAE5EU,EAAaxB,KAG5C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("primereact/utils");const r=({children:r,...a})=>{const n={size:`box-size-${a.size??"100"}`,direction:`box-direction-${a.direction??"row"}`,justify:void 0===a.justify?"":Array.isArray(a.justify)?a.justify?.join(" "):a.justify,align:void 0===a.align?"":Array.isArray(a.align)?a.align?.join(" "):a.align},s={className:t.classNames(["box",a.className??"",n.size,n.direction,n.justify,n.align]),style:a.css,id:a.id};return e.createElement("div",{...s},r)},a=({iconPrefix:t="bi bi-",...r})=>r.label&&e.createElement("p",{className:"form-label"},r.icon&&e.createElement("i",{className:t+r.icon+" me-1"}),r.label,r.required&&e.createElement("span",{className:"text-danger"},"*")),n=({errors:t,name:r,...a})=>a.mode&&"Controlled"!==a.mode?e.createElement("div",{className:t[r??""]?"invalid-feedback is-invalid":"","data-name":r??"",id:"j_feedback",style:{display:t[r??""]?"block":"none"}},t[r??""]?t[r??""].message:""):e.createElement("div",{"data-name":r,id:"j_feedback"});function s(e){return{ref:e.ref,id:e.id,name:e.name,required:e.required,disabled:e.disabled,placeholder:e.placeholder,className:e.className,style:{width:"100%"},keyfilter:e.keyfilter}}var l=e=>null==e;var i=e=>!l(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),o=e=>i(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,c=e=>{const t=e.constructor&&e.constructor.prototype;return i(t)&&t.hasOwnProperty("isPrototypeOf")},u="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function d(e){let t;const r=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(u&&(e instanceof Blob||a)||!r&&!i(e))return e;if(t=r?[]:{},r||c(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=d(e[r]));else t=e}return t}var m=e=>Array.isArray(e)?e.filter(Boolean):[],f=e=>void 0===e,b=(e,t,r)=>{if(!t||!i(e))return r;const a=m(t.split(/[,[\].]+?/)).reduce(((e,t)=>l(e)?e:e[t]),e);return f(a)||a===e?f(e[t])?r:e[t]:a},y=e=>"boolean"==typeof e,g=(e,t,r)=>{let a=-1;const n=(e=>/^\w*$/.test(e))(t)?[t]:m(t.replace(/["|']|\]/g,"").split(/\.|\[/));const s=n.length,l=s-1;for(;++a<s;){const t=n[a];let s=r;if(a!==l){const r=e[t];s=i(r)||Array.isArray(r)?r:isNaN(+n[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}return e};const p="blur",v="change",h="all",_=e.createContext(null),x=()=>e.useContext(_);var E=(e,t,r,a=!0)=>{const n={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(n,s,{get:()=>{const n=s;return t._proxyFormState[n]!==h&&(t._proxyFormState[n]=!a||h),r&&(r[n]=!0),e[n]}});return n},j=(e,t,r,a)=>{r(e);const{name:n,...s}=e;return i(l=s)&&!Object.keys(l).length||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find((e=>!0===t[e]));var l},N=(e,t,r)=>{return!e||!t||e===t||(a=e,Array.isArray(a)?a:[a]).some((e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e))));var a};function V(t){const r=e.useRef(t);r.current=t,e.useEffect((()=>{const e=!t.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{e&&e.unsubscribe()}}),[t.disabled])}var k=(e,t,r,a,n)=>"string"==typeof e?b(r,e,n):Array.isArray(e)?e.map((e=>b(r,e))):r;function w(t){const r=x(),{name:a,disabled:n,control:s=r.control,shouldUnregister:l}=t,i=((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(s._names.array,a),c=function(t){const r=x(),{control:a=r.control,name:n,defaultValue:s,disabled:l,exact:i}=t||{},o=e.useRef(n);o.current=n,V({disabled:l,subject:a._subjects.values,next:e=>{N(o.current,e.name,i)&&u(d(k(o.current,a._names,e.values||a._formValues,!1,s)))}});const[c,u]=e.useState(a._getWatch(n,s));return e.useEffect((()=>a._removeUnmounted())),c}({control:s,name:a,defaultValue:b(s._formValues,a,b(s._defaultValues,a,t.defaultValue)),exact:!0}),u=function(t){const r=x(),{control:a=r.control,disabled:n,name:s,exact:l}=t||{},[i,o]=e.useState(a._formState),c=e.useRef(!0),u=e.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=e.useRef(s);return d.current=s,V({disabled:n,next:e=>c.current&&N(d.current,e.name,l)&&j(e,u.current,a._updateFormState)&&o({...a._formState,...e}),subject:a._subjects.state}),e.useEffect((()=>(c.current=!0,u.current.isValid&&a._updateValid(!0),()=>{c.current=!1})),[a]),e.useMemo((()=>E(i,a,u.current,!1)),[i,a])}({control:s,name:a,exact:!0}),m=e.useRef(s.register(a,{...t.rules,value:c,...y(t.disabled)?{disabled:t.disabled}:{}})),h=e.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!b(u.errors,a)},isDirty:{enumerable:!0,get:()=>!!b(u.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!b(u.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!b(u.validatingFields,a)},error:{enumerable:!0,get:()=>b(u.errors,a)}})),[u,a]),_=e.useMemo((()=>({name:a,value:c,...y(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:e=>m.current.onChange({target:{value:o(e),name:a},type:v}),onBlur:()=>m.current.onBlur({target:{value:b(s._formValues,a),name:a},type:p}),ref:e=>{const t=b(s._fields,a);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}})),[a,s._formValues,n,u.disabled,c,s._fields]);return e.useEffect((()=>{const e=s._options.shouldUnregister||l,t=(e,t)=>{const r=b(s._fields,e);r&&r._f&&(r._f.mount=t)};if(t(a,!0),e){const e=d(b(s._options.defaultValues,a));g(s._defaultValues,a,e),f(b(s._formValues,a))&&g(s._formValues,a,e)}return!i&&s.register(a),()=>{(i?e&&!s._state.action:e)?s.unregister(a):t(a,!1)}}),[a,s,i,l]),e.useEffect((()=>{s._updateDisabledField({disabled:n,fields:s._fields,name:a})}),[n,a,s]),e.useMemo((()=>({field:_,formState:u,fieldState:h})),[_,u,h])}const A=e=>e.render(w(e));function F({core:t,...r}){let a=r.align&&"row"!==r.align?"flex-column":"flex-row";return e.createElement(A,{render:({field:t,formState:{errors:s}})=>e.createElement("div",{className:"w-100 d-flex flex-column"},e.createElement("div",{className:`w-100 d-flex gap-3 ${a}`},r.options.map((a=>e.createElement("div",{className:"d-flex align-items-center form-check",key:a.value},e.createElement("input",{checked:a.value===t.value,className:"form-check-input "+(s[r.name]?"is-invalid":""),disabled:r.disabled||a.disabled,id:r.name+"-"+a.value,type:"radio",value:a.value,onChange:t.onChange}),e.createElement("label",{className:"ms-2 form-check-label",htmlFor:r.name+"-"+a.value},a.label))))),e.createElement(n,{...r,errors:s})),control:r.control,name:r.name,rules:{required:!!r.required&&"Campo obrigatório"}})}function C({core:t,...r}){let a=r.align&&"row"!==r.align?"flex-column":"flex-row";return e.createElement("div",{className:"w-100 d-flex flex-column"},e.createElement("div",{className:`w-100 d-flex gap-3 ${a}`},r.options.map((t=>e.createElement(e.Fragment,null,e.createElement("div",{className:"d-flex align-items-center form-check",key:t.value},e.createElement("input",{checked:t.value===r.value,className:"form-check-input",disabled:r.disabled||t.disabled,id:r.name+"-"+t.value,name:r.name,required:r.required,type:"radio",value:t.value,onChange:e=>r.onChange(e.target.value)}),e.createElement("label",{className:"ms-2",htmlFor:r.name+"-"+t.value},t.label)))))),e.createElement(n,{...r}))}exports.Radio=function(t){let n=t,l={...s(n)};return e.createElement(r,{className:t.className,css:t.css,size:t.size??"100"},e.createElement(a,{...t}),t.mode&&"Controlled"!==t.mode?e.createElement(F,{core:l,...n}):e.createElement(C,{core:l,...n}))};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|