@lanaco/lnc-react-ui 4.0.13 → 4.0.15
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/ColorInput.cjs +1 -1
- package/dist/ColorInput.js +1 -1
- package/dist/DecimalInput.cjs +20 -20
- package/dist/DecimalInput.js +156 -152
- package/dist/DecimalInputV2.cjs +48 -0
- package/dist/DecimalInputV2.js +290 -0
- package/dist/Dropdown.cjs +1 -1
- package/dist/Dropdown.js +1 -1
- package/dist/DropdownLookup.cjs +1 -1
- package/dist/DropdownLookup.js +1 -1
- package/dist/EditableTable.cjs +10 -10
- package/dist/EditableTable.js +100 -95
- package/dist/MultiSelectDropdown.cjs +1 -1
- package/dist/MultiSelectDropdown.js +1 -1
- package/dist/MultiSelectDropdownLookup.cjs +1 -1
- package/dist/MultiSelectDropdownLookup.js +1 -1
- package/dist/NumberInput.cjs +1 -1
- package/dist/NumberInput.js +1 -1
- package/dist/PasswordInput.cjs +1 -1
- package/dist/PasswordInput.js +1 -1
- package/dist/TextAreaInput.cjs +1 -1
- package/dist/TextAreaInput.js +1 -1
- package/dist/TextInput.cjs +1 -1
- package/dist/TextInput.js +1 -1
- package/dist/TimeInput.cjs +1 -1
- package/dist/TimeInput.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +173 -171
- package/package.json +2 -1
- package/vite.config.js +1 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { jsxs as G, jsx as N } from "react/jsx-runtime";
|
|
2
|
+
import { P as o } from "./index-BYnWp42a.js";
|
|
3
|
+
import { forwardRef as H, useState as T, useRef as J, useEffect as L } from "react";
|
|
4
|
+
import { n as k } from "./emotion-styled.browser.esm-BiK8DcgW.js";
|
|
5
|
+
import { d as h, a as c, b as M, e as Q, h as V, g as X } from "./utils-C52T57HO.js";
|
|
6
|
+
import { u as Y } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
|
|
7
|
+
const Z = k.div`
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
|
|
11
|
+
min-height: ${(e) => h(e.theme, e.size)};
|
|
12
|
+
max-height: ${(e) => h(e.theme, e.size)};
|
|
13
|
+
background-color: ${(e) => c(
|
|
14
|
+
e.theme,
|
|
15
|
+
"Input",
|
|
16
|
+
e.color,
|
|
17
|
+
"enabled",
|
|
18
|
+
"background"
|
|
19
|
+
)};
|
|
20
|
+
border: 1px solid
|
|
21
|
+
${(e) => c(
|
|
22
|
+
e.theme,
|
|
23
|
+
"Input",
|
|
24
|
+
e.focused === !0 ? "primary" : e.color,
|
|
25
|
+
"enabled",
|
|
26
|
+
"border"
|
|
27
|
+
)};
|
|
28
|
+
border-radius: ${(e) => M(e.theme, "regular")};
|
|
29
|
+
|
|
30
|
+
${(e) => e.focused === !0 && e.readOnly !== !0 ? Q(e.theme) : ""}
|
|
31
|
+
${(e) => e.isDisabled === !0 ? V(e.theme) : ""}
|
|
32
|
+
${(e) => e.isDisabled === !0 ? "border: 1px solid " + c(
|
|
33
|
+
e.theme,
|
|
34
|
+
"Input",
|
|
35
|
+
e.color,
|
|
36
|
+
"disabled",
|
|
37
|
+
"border"
|
|
38
|
+
) : ""}
|
|
39
|
+
|
|
40
|
+
& input {
|
|
41
|
+
background: none;
|
|
42
|
+
border: none;
|
|
43
|
+
outline: none;
|
|
44
|
+
padding-top: 0.625rem;
|
|
45
|
+
padding-bottom: 0.625rem;
|
|
46
|
+
width: 100%;
|
|
47
|
+
|
|
48
|
+
${(e) => X(e.theme, "Input", e.size, "enabled")}
|
|
49
|
+
min-height: ${(e) => h(e.theme, e.size)};
|
|
50
|
+
max-height: ${(e) => h(e.theme, e.size)};
|
|
51
|
+
color: ${(e) => c(
|
|
52
|
+
e.theme,
|
|
53
|
+
"Input",
|
|
54
|
+
e.focused === !0 ? "primary" : e.color,
|
|
55
|
+
"enabled",
|
|
56
|
+
"text"
|
|
57
|
+
)};
|
|
58
|
+
caret-color: ${(e) => c(e.theme, "Input", e.color, "enabled", "caret")};
|
|
59
|
+
padding-right: ${(e) => e.suffix ? "0" : "0.75rem"};
|
|
60
|
+
padding-left: ${(e) => e.prefix ? "0" : "0.75rem"};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
& input:disabled {
|
|
64
|
+
${(e) => V(e.theme)}
|
|
65
|
+
background: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
& input:read-only {
|
|
69
|
+
cursor: default;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
& input::placeholder {
|
|
73
|
+
color: ${(e) => c(
|
|
74
|
+
e.theme,
|
|
75
|
+
"Input",
|
|
76
|
+
e.color,
|
|
77
|
+
"enabled",
|
|
78
|
+
"placeholder"
|
|
79
|
+
)};
|
|
80
|
+
}
|
|
81
|
+
`, B = k.span`
|
|
82
|
+
padding: 0 12px;
|
|
83
|
+
color: ${(e) => c(
|
|
84
|
+
e.theme,
|
|
85
|
+
"Input",
|
|
86
|
+
e.focused === !0 ? "primary" : e.color,
|
|
87
|
+
"enabled",
|
|
88
|
+
"prefix"
|
|
89
|
+
)};
|
|
90
|
+
`, _ = k(B)``, A = H((e, K) => {
|
|
91
|
+
const {
|
|
92
|
+
disabled: C,
|
|
93
|
+
readOnly: O,
|
|
94
|
+
// debounceTime = 0,
|
|
95
|
+
prefix: g,
|
|
96
|
+
suffix: m,
|
|
97
|
+
decimalSeparator: s = ",",
|
|
98
|
+
decimalScale: a = 2,
|
|
99
|
+
allowNegative: v = !0,
|
|
100
|
+
// //----------------
|
|
101
|
+
onKeyDown: F = () => {
|
|
102
|
+
},
|
|
103
|
+
onBlur: f = () => {
|
|
104
|
+
},
|
|
105
|
+
onFocus: y = () => {
|
|
106
|
+
},
|
|
107
|
+
onChange: P = () => {
|
|
108
|
+
},
|
|
109
|
+
value: p,
|
|
110
|
+
//----------------
|
|
111
|
+
className: R = "",
|
|
112
|
+
style: W = {},
|
|
113
|
+
size: U = "small",
|
|
114
|
+
color: b = "primary",
|
|
115
|
+
onInputChange: E = () => {
|
|
116
|
+
},
|
|
117
|
+
...S
|
|
118
|
+
} = e, x = Y(), [$, j] = T(!1), D = (i) => {
|
|
119
|
+
var t, d;
|
|
120
|
+
if (!isNaN(+i)) {
|
|
121
|
+
const l = (t = i == null ? void 0 : i.toString()) == null ? void 0 : t.split(".");
|
|
122
|
+
if (!(l != null && l.length) > 0)
|
|
123
|
+
return "0" + s + new Array(a + 1).join("0");
|
|
124
|
+
if ((l == null ? void 0 : l.length) === 1)
|
|
125
|
+
return l.at(0) + s + new Array(a + 1).join("0");
|
|
126
|
+
if ((l == null ? void 0 : l.length) > 1) {
|
|
127
|
+
let n = (d = l == null ? void 0 : l.at(1)) == null ? void 0 : d.toString();
|
|
128
|
+
if ((n == null ? void 0 : n.length) === a)
|
|
129
|
+
return l.at(0) + s + n;
|
|
130
|
+
if ((n == null ? void 0 : n.length) < a)
|
|
131
|
+
return l.at(0) + s + l.at(1) + new Array(a - n.length + 1).join("0");
|
|
132
|
+
if ((n == null ? void 0 : n.length) > a)
|
|
133
|
+
return l.at(0) + s + n.slice(0, a);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return "0" + s + new Array(a + 1).join("0");
|
|
137
|
+
}, z = D(p), [q, u] = T(z), r = J(z);
|
|
138
|
+
return L(() => {
|
|
139
|
+
const i = D(p);
|
|
140
|
+
r.current = i, u(r.current);
|
|
141
|
+
}, [p]), /* @__PURE__ */ G(
|
|
142
|
+
Z,
|
|
143
|
+
{
|
|
144
|
+
style: W,
|
|
145
|
+
className: R,
|
|
146
|
+
theme: x,
|
|
147
|
+
color: b,
|
|
148
|
+
size: U,
|
|
149
|
+
prefix: g,
|
|
150
|
+
suffix: m,
|
|
151
|
+
focused: $,
|
|
152
|
+
disabled: C,
|
|
153
|
+
readOnly: O,
|
|
154
|
+
children: [
|
|
155
|
+
g && /* @__PURE__ */ N(
|
|
156
|
+
B,
|
|
157
|
+
{
|
|
158
|
+
theme: x,
|
|
159
|
+
color: b,
|
|
160
|
+
focused: $,
|
|
161
|
+
className: "lnc-input-prefix",
|
|
162
|
+
children: g
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ N(
|
|
166
|
+
"input",
|
|
167
|
+
{
|
|
168
|
+
ref: K,
|
|
169
|
+
type: "text",
|
|
170
|
+
...S,
|
|
171
|
+
onKeyDown: (i) => {
|
|
172
|
+
var d, l;
|
|
173
|
+
let t = (d = r.current) == null ? void 0 : d.replace(s, "");
|
|
174
|
+
if (i.key === "Delete" || i.key === "Backspace") {
|
|
175
|
+
if (+t != 0) {
|
|
176
|
+
t = t.slice(0, (t == null ? void 0 : t.length) - 1);
|
|
177
|
+
let n = t.slice(
|
|
178
|
+
0,
|
|
179
|
+
(t == null ? void 0 : t.length) - a
|
|
180
|
+
), w = t.slice((t == null ? void 0 : t.length) - a);
|
|
181
|
+
(n == null ? void 0 : n.length) === 0 ? n = "0" : n === "-" && +t != 0 ? n = "-0" : n === "-" && +t == 0 && (n = "0");
|
|
182
|
+
let I = [
|
|
183
|
+
n,
|
|
184
|
+
s,
|
|
185
|
+
w
|
|
186
|
+
].join("");
|
|
187
|
+
r.current = I, u(r.current);
|
|
188
|
+
}
|
|
189
|
+
} else if (i.key === "-" && v === !0 && +t != 0)
|
|
190
|
+
((l = r == null ? void 0 : r.current) == null ? void 0 : l.slice(1)) === "-" ? r.current = r.current.slice(1, r.current.length) : r.current = "-" + r.current, u(r.current);
|
|
191
|
+
else if (!isNaN(i.key)) {
|
|
192
|
+
t = t + i.key;
|
|
193
|
+
let n = t.slice(0, (t == null ? void 0 : t.length) - a), w = t.slice((t == null ? void 0 : t.length) - a);
|
|
194
|
+
(n == null ? void 0 : n.length) > 1 && (n = n.replace(/^0+/, ""), (n == null ? void 0 : n.length) === 0 && (n = "0"));
|
|
195
|
+
let I = [
|
|
196
|
+
n,
|
|
197
|
+
s,
|
|
198
|
+
w
|
|
199
|
+
].join("");
|
|
200
|
+
r.current = I, u(r.current);
|
|
201
|
+
}
|
|
202
|
+
F(i);
|
|
203
|
+
},
|
|
204
|
+
onBlur: (i) => {
|
|
205
|
+
j(!1), f == null || f(i);
|
|
206
|
+
},
|
|
207
|
+
value: q,
|
|
208
|
+
className: "lnc-ui-decimal-v2-input",
|
|
209
|
+
onFocus: (i) => {
|
|
210
|
+
j(!0), y == null || y(i);
|
|
211
|
+
},
|
|
212
|
+
disabled: C || O,
|
|
213
|
+
onChange: (i) => {
|
|
214
|
+
E(i), P(i);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
m && /* @__PURE__ */ N(
|
|
219
|
+
_,
|
|
220
|
+
{
|
|
221
|
+
theme: x,
|
|
222
|
+
color: b,
|
|
223
|
+
focused: $,
|
|
224
|
+
className: "lnc-input-suffix",
|
|
225
|
+
children: m
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
A.propTypes = {
|
|
233
|
+
id: o.string,
|
|
234
|
+
value: o.any,
|
|
235
|
+
defaultValue: o.any,
|
|
236
|
+
disabled: o.bool,
|
|
237
|
+
readOnly: o.bool,
|
|
238
|
+
debounceTime: o.number,
|
|
239
|
+
/**
|
|
240
|
+
* Reserved space before input. Intented to be used with plain text or `Icon` component.
|
|
241
|
+
*/
|
|
242
|
+
prefix: o.oneOfType([o.string, o.element]),
|
|
243
|
+
/**
|
|
244
|
+
* Reserved space after input. Intented to be used with plain text or `Icon` component.
|
|
245
|
+
*/
|
|
246
|
+
suffix: o.oneOfType([o.string, o.element]),
|
|
247
|
+
thousandSeparator: o.oneOf([".", ",", " "]),
|
|
248
|
+
decimalSeparator: o.oneOf([".", ","]),
|
|
249
|
+
decimalScale: o.number,
|
|
250
|
+
fixedDecimalScale: o.bool,
|
|
251
|
+
allowNegative: o.bool,
|
|
252
|
+
//----------------
|
|
253
|
+
/**
|
|
254
|
+
* `(event, value) => void`
|
|
255
|
+
*/
|
|
256
|
+
onChange: o.func,
|
|
257
|
+
/**
|
|
258
|
+
* `(event, value) => void`
|
|
259
|
+
*/
|
|
260
|
+
onInputChange: o.func,
|
|
261
|
+
/**
|
|
262
|
+
* `(event) => void`
|
|
263
|
+
*/
|
|
264
|
+
onBlur: o.func,
|
|
265
|
+
/**
|
|
266
|
+
* `(event) => void`
|
|
267
|
+
*/
|
|
268
|
+
onFocus: o.func,
|
|
269
|
+
/**
|
|
270
|
+
* `(event) => void`
|
|
271
|
+
*/
|
|
272
|
+
onKeyDown: o.func,
|
|
273
|
+
//----------------
|
|
274
|
+
className: o.string,
|
|
275
|
+
style: o.object,
|
|
276
|
+
size: o.oneOf(["small", "medium", "large"]),
|
|
277
|
+
color: o.oneOf([
|
|
278
|
+
"primary",
|
|
279
|
+
"secondary",
|
|
280
|
+
"success",
|
|
281
|
+
"danger",
|
|
282
|
+
"warning",
|
|
283
|
+
"information",
|
|
284
|
+
"neutral",
|
|
285
|
+
"gray"
|
|
286
|
+
])
|
|
287
|
+
};
|
|
288
|
+
export {
|
|
289
|
+
A as default
|
|
290
|
+
};
|
package/dist/Dropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=require("react/jsx-runtime"),e=require("./index-BIlhCoy2.cjs"),n=require("react"),t=require("./CustomStyles-Dlqxic2X.cjs"),a=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs");require("./index-Ct1N7fF4.cjs");const S=require("./index-DaiUAQVF.cjs");function M(o){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const p=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(s,r,p.get?p:{enumerable:!0,get:()=>o[r]})}}return s.default=o,Object.freeze(s)}const h=M(n);var j=n.forwardRef(function(o,s){var r=t.useStateManager(o);return h.createElement(t.Select,a._extends({ref:s},r))}),x=j;const u=n.forwardRef((o,s)=>{const{styles:r,debounceTime:p=
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=require("react/jsx-runtime"),e=require("./index-BIlhCoy2.cjs"),n=require("react"),t=require("./CustomStyles-Dlqxic2X.cjs"),a=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs");require("./index-Ct1N7fF4.cjs");const S=require("./index-DaiUAQVF.cjs");function M(o){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const p=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(s,r,p.get?p:{enumerable:!0,get:()=>o[r]})}}return s.default=o,Object.freeze(s)}const h=M(n);var j=n.forwardRef(function(o,s){var r=t.useStateManager(o);return h.createElement(t.Select,a._extends({ref:s},r))}),x=j;const u=n.forwardRef((o,s)=>{const{styles:r,debounceTime:p=0,name:C,isSearchable:c=!0,isClearable:i=!0,onInputChange:l,size:y="small",color:T="primary",className:P="",style:b={},...m}=o,f=a.useTheme();return n.useCallback(S.debounce((d,g)=>{l==null||l(d,g)},p)),O.jsx(x,{ref:s,styles:r||t.customStyles,size:y,color:T,theme:f,isSearchable:c,isClearable:i,className:P,style:b,...m})});u.propTypes={options:e.PropTypes.array,styles:e.PropTypes.object,debounceTime:e.PropTypes.number,name:e.PropTypes.string,value:e.PropTypes.any,tabIndex:e.PropTypes.number,isSearchable:e.PropTypes.bool,isClearable:e.PropTypes.bool,isLoading:e.PropTypes.bool,isRtl:e.PropTypes.bool,isDisabled:e.PropTypes.bool,readOnly:e.PropTypes.bool,closeMenuOnSelect:e.PropTypes.bool,closeMenuOnScroll:e.PropTypes.oneOfType([e.PropTypes.bool,e.PropTypes.func]),escapeClearsValue:e.PropTypes.bool,filterOption:e.PropTypes.func,formatGroupLabel:e.PropTypes.func,formatOptionLabel:e.PropTypes.func,getOptionLabel:e.PropTypes.func,getOptionValue:e.PropTypes.func,hideSelectedOptions:e.PropTypes.bool,id:e.PropTypes.string,inputId:e.PropTypes.string,isOptionDisabled:e.PropTypes.func,isOptionSelected:e.PropTypes.func,loadingMessage:e.PropTypes.func,minMenuHeight:e.PropTypes.number,maxMenuHeight:e.PropTypes.number,menuPlacement:e.PropTypes.oneOf(["bottom","auto","top"]),menuPosition:e.PropTypes.oneOf(["absolute","fixed"]),menuShouldBlockScroll:e.PropTypes.bool,menuShouldScrollIntoView:e.PropTypes.bool,openMenuOnFocus:e.PropTypes.bool,openMenuOnClick:e.PropTypes.bool,autoFocus:e.PropTypes.bool,placeholder:e.PropTypes.any,noOptionsMessage:e.PropTypes.string,menuIsOpen:e.PropTypes.bool,components:e.PropTypes.object,defaultValue:e.PropTypes.any,defaultInputValue:e.PropTypes.string,defaultMenuIsOpen:e.PropTypes.bool,delimiter:e.PropTypes.string,onChange:e.PropTypes.func,onInputChange:e.PropTypes.func,onMenuOpen:e.PropTypes.func,onMenuClose:e.PropTypes.func,onFocus:e.PropTypes.func,onBlur:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,color:e.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"]),size:e.PropTypes.oneOf(["small","medium","large"])};exports.components=t.components;exports.default=u;
|
package/dist/Dropdown.js
CHANGED
package/dist/DropdownLookup.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const le=require("react/jsx-runtime"),e=require("./index-BIlhCoy2.cjs"),t=require("react"),B=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),n=require("./CustomStyles-Dlqxic2X.cjs"),ce=require("./defineProperty-DHvxLH8G.cjs");require("./index-Ct1N7fF4.cjs");const fe=require("./index-DaiUAQVF.cjs");function de(o){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(p,s,a.get?a:{enumerable:!0,get:()=>o[s]})}}return p.default=o,Object.freeze(p)}const ye=de(t);var Te=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function Pe(o){var p=o.defaultOptions,s=p===void 0?!1:p,a=o.cacheOptions,i=a===void 0?!1:a,y=o.loadOptions;o.options;var l=o.isLoading,h=l===void 0?!1:l,S=o.onInputChange,m=o.filterOption,C=m===void 0?null:m,g=n._objectWithoutProperties(o,Te),_=g.inputValue,u=t.useRef(void 0),c=t.useRef(!1),T=t.useState(Array.isArray(s)?s:void 0),f=n._slicedToArray(T,2),G=f[0],x=f[1],W=t.useState(typeof _<"u"?_:""),q=n._slicedToArray(W,2),D=q[0],I=q[1],J=t.useState(s===!0),R=n._slicedToArray(J,2),K=R[0],P=R[1],Q=t.useState(void 0),w=n._slicedToArray(Q,2),A=w[0],L=w[1],U=t.useState([]),E=n._slicedToArray(U,2),X=E[0],j=E[1],Y=t.useState(!1),$=n._slicedToArray(Y,2),Z=$[0],v=$[1],ee=t.useState({}),k=n._slicedToArray(ee,2),O=k[0],z=k[1],te=t.useState(void 0),F=n._slicedToArray(te,2),oe=F[0],se=F[1],ne=t.useState(void 0),N=n._slicedToArray(ne,2),re=N[0],pe=N[1];i!==re&&(z({}),pe(i)),s!==oe&&(x(Array.isArray(s)?s:void 0),se(s)),t.useEffect(function(){return c.current=!0,function(){c.current=!1}},[]);var M=t.useCallback(function(b,d){if(!y)return d();var r=y(b,d);r&&typeof r.then=="function"&&r.then(d,function(){return d()})},[y]);t.useEffect(function(){s===!0&&M(D,function(b){c.current&&(x(b||[]),P(!!u.current))})},[]);var ae=t.useCallback(function(b,d){var r=n.handleInputChange(b,d,S);if(!r){u.current=void 0,I(""),L(""),j([]),P(!1),v(!1);return}if(i&&O[r])I(r),L(r),j(O[r]),P(!1),v(!1);else{var ie=u.current={};I(r),P(!0),v(!A),M(r,function(V){c&&ie===u.current&&(u.current=void 0,P(!1),L(r),j(V||[]),v(!1),z(V?n._objectSpread2(n._objectSpread2({},O),{},ce._defineProperty({},r,V)):O))})}},[i,M,A,O,S]),ue=Z?[]:D&&A?X:G||[];return n._objectSpread2(n._objectSpread2({},g),{},{options:ue,isLoading:K||h,onInputChange:ae,filterOption:C})}var Oe=t.forwardRef(function(o,p){var s=Pe(o),a=n.useStateManager(s);return ye.createElement(n.Select,B._extends({ref:p},a))}),be=Oe;const H=t.forwardRef((o,p)=>{const{styles:s,debounceTime:a=
|
|
1
|
+
"use strict";const le=require("react/jsx-runtime"),e=require("./index-BIlhCoy2.cjs"),t=require("react"),B=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),n=require("./CustomStyles-Dlqxic2X.cjs"),ce=require("./defineProperty-DHvxLH8G.cjs");require("./index-Ct1N7fF4.cjs");const fe=require("./index-DaiUAQVF.cjs");function de(o){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(p,s,a.get?a:{enumerable:!0,get:()=>o[s]})}}return p.default=o,Object.freeze(p)}const ye=de(t);var Te=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function Pe(o){var p=o.defaultOptions,s=p===void 0?!1:p,a=o.cacheOptions,i=a===void 0?!1:a,y=o.loadOptions;o.options;var l=o.isLoading,h=l===void 0?!1:l,S=o.onInputChange,m=o.filterOption,C=m===void 0?null:m,g=n._objectWithoutProperties(o,Te),_=g.inputValue,u=t.useRef(void 0),c=t.useRef(!1),T=t.useState(Array.isArray(s)?s:void 0),f=n._slicedToArray(T,2),G=f[0],x=f[1],W=t.useState(typeof _<"u"?_:""),q=n._slicedToArray(W,2),D=q[0],I=q[1],J=t.useState(s===!0),R=n._slicedToArray(J,2),K=R[0],P=R[1],Q=t.useState(void 0),w=n._slicedToArray(Q,2),A=w[0],L=w[1],U=t.useState([]),E=n._slicedToArray(U,2),X=E[0],j=E[1],Y=t.useState(!1),$=n._slicedToArray(Y,2),Z=$[0],v=$[1],ee=t.useState({}),k=n._slicedToArray(ee,2),O=k[0],z=k[1],te=t.useState(void 0),F=n._slicedToArray(te,2),oe=F[0],se=F[1],ne=t.useState(void 0),N=n._slicedToArray(ne,2),re=N[0],pe=N[1];i!==re&&(z({}),pe(i)),s!==oe&&(x(Array.isArray(s)?s:void 0),se(s)),t.useEffect(function(){return c.current=!0,function(){c.current=!1}},[]);var M=t.useCallback(function(b,d){if(!y)return d();var r=y(b,d);r&&typeof r.then=="function"&&r.then(d,function(){return d()})},[y]);t.useEffect(function(){s===!0&&M(D,function(b){c.current&&(x(b||[]),P(!!u.current))})},[]);var ae=t.useCallback(function(b,d){var r=n.handleInputChange(b,d,S);if(!r){u.current=void 0,I(""),L(""),j([]),P(!1),v(!1);return}if(i&&O[r])I(r),L(r),j(O[r]),P(!1),v(!1);else{var ie=u.current={};I(r),P(!0),v(!A),M(r,function(V){c&&ie===u.current&&(u.current=void 0,P(!1),L(r),j(V||[]),v(!1),z(V?n._objectSpread2(n._objectSpread2({},O),{},ce._defineProperty({},r,V)):O))})}},[i,M,A,O,S]),ue=Z?[]:D&&A?X:G||[];return n._objectSpread2(n._objectSpread2({},g),{},{options:ue,isLoading:K||h,onInputChange:ae,filterOption:C})}var Oe=t.forwardRef(function(o,p){var s=Pe(o),a=n.useStateManager(s);return ye.createElement(n.Select,B._extends({ref:p},a))}),be=Oe;const H=t.forwardRef((o,p)=>{const{styles:s,debounceTime:a=0,isSearchable:i=!0,isClearable:y=!0,onInputChange:l,size:h="small",color:S="primary",className:m="",style:C={},...g}=o,_=B.useTheme(),u=t.useCallback(fe.debounce((T,f)=>{l==null||l(T,f)},a)),c=(T,f)=>{u(T,f)};return le.jsx(be,{ref:p,styles:s||n.customStyles,size:h,color:S,theme:_,isSearchable:i,isClearable:y,onInputChange:c,className:m,style:C,...g})});H.propTypes={defaultOptions:e.PropTypes.oneOfType([e.PropTypes.bool,e.PropTypes.array]),cacheOptions:e.PropTypes.any,loadOptions:e.PropTypes.func,styles:e.PropTypes.object,debounceTime:e.PropTypes.number,name:e.PropTypes.string,value:e.PropTypes.any,tabIndex:e.PropTypes.number,isSearchable:e.PropTypes.bool,isClearable:e.PropTypes.bool,isLoading:e.PropTypes.bool,isRtl:e.PropTypes.bool,isDisabled:e.PropTypes.bool,readOnly:e.PropTypes.bool,closeMenuOnSelect:e.PropTypes.bool,closeMenuOnScroll:e.PropTypes.oneOfType([e.PropTypes.bool,e.PropTypes.func]),escapeClearsValue:e.PropTypes.bool,filterOption:e.PropTypes.func,formatGroupLabel:e.PropTypes.func,formatOptionLabel:e.PropTypes.func,getOptionLabel:e.PropTypes.func,getOptionValue:e.PropTypes.func,hideSelectedOptions:e.PropTypes.bool,id:e.PropTypes.string,inputId:e.PropTypes.string,isOptionDisabled:e.PropTypes.func,isOptionSelected:e.PropTypes.func,loadingMessage:e.PropTypes.func,minMenuHeight:e.PropTypes.number,maxMenuHeight:e.PropTypes.number,menuPlacement:e.PropTypes.oneOf(["bottom","auto","top"]),menuPosition:e.PropTypes.oneOf(["absolute","fixed"]),menuShouldBlockScroll:e.PropTypes.bool,menuShouldScrollIntoView:e.PropTypes.bool,openMenuOnFocus:e.PropTypes.bool,openMenuOnClick:e.PropTypes.bool,autoFocus:e.PropTypes.bool,placeholder:e.PropTypes.any,noOptionsMessage:e.PropTypes.string,menuIsOpen:e.PropTypes.bool,components:e.PropTypes.object,defaultValue:e.PropTypes.string,defaultInputValue:e.PropTypes.string,defaultMenuIsOpen:e.PropTypes.bool,delimiter:e.PropTypes.string,onChange:e.PropTypes.func,onInputChange:e.PropTypes.func,onMenuOpen:e.PropTypes.func,onMenuClose:e.PropTypes.func,onFocus:e.PropTypes.func,onBlur:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,color:e.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"]),size:e.PropTypes.oneOf(["small","medium","large"])};module.exports=H;
|
package/dist/DropdownLookup.js
CHANGED
package/dist/EditableTable.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),i=require("react"),r=require("./index-BIlhCoy2.cjs"),w=require("./utils-DTAPpJXU.cjs"),H=require("./Table.cjs")
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),i=require("react"),r=require("./index-BIlhCoy2.cjs"),w=require("./utils-DTAPpJXU.cjs"),H=require("./Table.cjs"),$=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),B=require("./TextInput.cjs"),W=require("./NumberInput.cjs"),J=require("./DecimalInput.cjs"),Q=require("./CheckBoxInput.cjs"),U=require("./Dropdown.cjs"),X=require("./DecimalInputV2.cjs"),Z=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),C={BOOLEAN:"BOOLEAN",STRING:"STRING",INTEGER:"INTEGER",DECIMAL:"DECIMAL",DECIMAL2:"DECIMAL2",DATE:"DATE",SELECT:"SELECT"},ee=$.newStyled.td`
|
|
2
2
|
white-space: nowrap;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
text-overflow: ellipsis;
|
|
5
|
-
max-width: ${
|
|
6
|
-
padding: ${
|
|
7
|
-
${
|
|
5
|
+
max-width: ${s=>s.width};
|
|
6
|
+
padding: ${s=>s.focused&&!s.isBoolean?"0.5rem 0.5rem 0.5rem 0.7rem":"0.5rem 0.5rem 0.5rem 1.5rem"};
|
|
7
|
+
${s=>s.bgColor}
|
|
8
8
|
|
|
9
|
-
${
|
|
10
|
-
`,
|
|
11
|
-
${
|
|
12
|
-
padding: ${
|
|
13
|
-
cursor: ${
|
|
9
|
+
${s=>w.getComponentTypographyCss(s.theme,"TableCell",s.size,"enabled")};
|
|
10
|
+
`,re=$.newStyled.div`
|
|
11
|
+
${s=>w.getComponentTypographyCss(s.theme,"TableSpecialLastRow",s.size,"enabled")};
|
|
12
|
+
padding: ${s=>s.hasRender?"0":"9.5px 6px 9.5px 0"};
|
|
13
|
+
cursor: ${s=>s.tabIndex!==-1?"pointer":"auto"};
|
|
14
14
|
white-space: nowrap;
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
text-overflow: ellipsis;
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
&:focus {
|
|
19
19
|
outline: none;
|
|
20
20
|
}
|
|
21
|
-
`,N=
|
|
21
|
+
`,N=s=>{const[d,L]=i.useState(!1);var l=i.useRef(),P=i.useRef(),A=i.useRef(!0);const{__TYPE__:R="TABLE_CELL",Column:e={},ColumnsToRender:p,RowData:n={},Index:E=0,RowIndex:f,EnableSelection:v=!1,TabIndexOffset:I=100,onFocusChanged:D,RowIdentifier:q,onDiscard:x,onMount:t,onChange:a,className:T="",size:m="small",color:b="primary"}=s,O=Z.useTheme(),S={className:T,size:m,color:b,theme:O};i.useEffect(()=>{t(f,E,P)},[]),i.useEffect(()=>{d||t(f,E,P)},[d]),i.useEffect(()=>{d&&l&&l.current&&l.current.focus()},[d]);const G=()=>e&&e.width?e.width+"%":"auto",F=()=>{if(e.editable!==!0)return-1;var o=p.filter(y=>y.editable),g=o.find(y=>y.id===e.id);return I+f*o.length+o.indexOf(g)},j=(o,g)=>{D(o,g,f,E),g||L(g)},M=o=>{o.key==="Escape"&&(A.current=!1,l.current.blur(),A.current=!0,x(o,f,E,n))},V=()=>{var o=null,g=(u,K)=>{a(u,K,f,E,e,n)},y=u=>{a(_,u,f,E,e,n)},h={...S,debounceTime:0,...e.inputProps,value:e!=null&&e.objectAccessor?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor],defaultChecked:e!=null&&e.objectAccessor?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor],focused:d,onChange:g,onBlur:u=>j(u,!1),onFocus:u=>j(u,!0),onKeyDown:u=>M(u),tabIndex:F()};switch(e.inputType){case C.STRING:o=c.jsx(B,{...h,ref:l});break;case C.INTEGER:o=c.jsx(W,{...h,ref:l});break;case C.DECIMAL:o=c.jsx(J,{...h,ref:l});break;case C.DECIMAL2:o=c.jsx(X,{...h,ref:l});break;case C.DATE:o=c.jsx(B,{...h,ref:l});break;case C.BOOLEAN:o=c.jsx(Q,{...h,ref:l});break;case C.SELECT:o=c.jsx(U.default,{...h,value:e.inputProps.options.find(u=>u.value===(e==null?void 0:e.objectAccessor)?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor]),onChange:y,ref:l});break;default:o=c.jsx(B,{...h,ref:l})}return o},z=o=>{A.current===!0?j(o,!1):L(!1)},Y=()=>{var o=V();if(e.editable===!0&&e.editComponent){var g={};e.inputType===C.SELECT&&(g={items:e.selectItems,mapNameTo:e.selectProps.mapNameTo,mapValueTo:e.selectProps.mapValueTo}),o=c.jsx(e.editComponent,{ref:l,tabIndex:F(),value:e!=null&&e.objectAccessor?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor],onChange:(y,h,u)=>{a(y,h,f,E,e,n,u)},focused:d,onBlur:z,onFocus:y=>j(y,!0),onKeyDown:y=>M(y),...g})}if(e.editable===!0&&d)return o;if(!d||e.editable!==!0)return c.jsx(re,{ref:P,tabIndex:F(),onFocus:()=>L(!0),hasRender:!!e.readonlyComponent,...S,children:e.readonlyComponent?c.jsx(e.readonlyComponent,{rowData:n,value:e!=null&&e.objectAccessor?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor],fullValue:n[e.accessor],disabled:!0}):e!=null&&e.objectAccessor?n[e.accessor][e==null?void 0:e.objectAccessor]:n[e.accessor]})};return i.createElement(ee,{"data-rowindex":f,...S,selection:v,width:G(),key:E,focused:d,isBoolean:e.inputType===C.BOOLEAN},Y())};N.propTypes={__TYPE__:r.PropTypes.string,Column:r.PropTypes.object,RowData:r.PropTypes.object,Index:r.PropTypes.number,EnableSelection:r.PropTypes.bool,TabIndexOffset:r.PropTypes.number,className:r.PropTypes.string,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"])};N.displayName="TABLE_CELL";const k=i.forwardRef((s,d)=>{var{__TYPE__:L="EDITABLE_TABLE",Data:l=[],onRowFocusChange:P=()=>{},onDiscard:A=()=>{},onInputChange:R=()=>{}}=s;const e=i.useRef({FocusedCell:null,PreviousFocusedCell:null}),p=i.useRef([]),n=i.useRef(null),E=i.useRef();i.useImperativeHandle(d,()=>({focusFirstCellOfLastRow:()=>{n.current&&n.current.focus()},focusLastActiveCell:()=>{try{var t=p.current.find(a=>a.row===e.current.PreviousFocusedCell.row&&a.cell===e.current.PreviousFocusedCell.cell);t.ref&&t.ref.focus()}catch{}}}),[s]);const f=(t,a,T,m,b,O)=>{R&&R(t,a,T,m,b,O)},v=(t,a,T,m,b)=>{a&&(e.current={...e.current,FocusedCell:{row:T,cell:m,ref:b}}),a||(e.current={PreviousFocusedCell:e.current.FocusedCell,FocusedCell:null},I(t,T))},I=(t,a)=>{(t.relatedTarget===null||t.relatedTarget.closest("tbody")===null||!t.relatedTarget.closest("tbody").hasAttribute("data-tbody"))&&P(t,a,-1),t.relatedTarget&&t.relatedTarget.closest("tbody")&&t.relatedTarget.closest("tbody").hasAttribute("data-tbody")&&parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex"))!==a&&P(t,a,parseInt(t.relatedTarget.closest("td").getAttribute("data-rowindex")))},D=(t,a,T)=>{if(t===l.length-1&&a===0&&(n.current=T.current),p.current.length===0&&(p.current=[{row:t,cell:a,ref:T.current}]),p.current.length>0&&p.current.find(b=>b.row===t&&b.cell===a)){var m=p.current.find(b=>b.row===t&&b.cell===a);m.ref=T.current}else p.current.length>0&&(p.current=[...p.current,{row:t,cell:a,ref:T.current}])},q=()=>w.renderCustomElement(w.getCustomRender("TABLE_SPECIAL_LAST_ROW",s.children),{TabIndexOffset:50})||c.jsx(c.Fragment,{}),x=()=>{var t={TabIndexOffset:50,onFocusChanged:v,onChange:f,onDiscard:A,onMount:D};return w.renderCustomElement(w.getCustomRender("TABLE_CELL",s.children),t)||c.jsx(N,{...t})};return c.jsx(c.Fragment,{children:c.jsxs(H.default,{ref:E,...s,Data:l,VisibilityPattern:null,children:[s.children,x(),q()]})})});k.propTypes={__TYPE__:r.PropTypes.string,EnableSelection:r.PropTypes.bool,EnableOrdering:r.PropTypes.bool,EnableLoader:r.PropTypes.bool,EnableSelectAll:r.PropTypes.bool,NoDataText:r.PropTypes.string,Loading:r.PropTypes.bool,Columns:r.PropTypes.arrayOf(r.PropTypes.object),Data:r.PropTypes.arrayOf(r.PropTypes.object),SelectedData:r.PropTypes.arrayOf(r.PropTypes.object),SelectedEntirePage:r.PropTypes.bool,RowIdentifier:r.PropTypes.string,VisibilityPattern:r.PropTypes.object,Ordering:r.PropTypes.object,onRowFocusChange:()=>{},onDiscard:()=>{},onInputChange:()=>{},onColumnClick:r.PropTypes.func,onRowClick:r.PropTypes.func,onSelectRow:r.PropTypes.func,onSelectAll:r.PropTypes.func,className:r.PropTypes.string,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","error","warning","gray","white","neutral"])};k.displayName="EDITABLE_TABLE";module.exports=k;
|