@progress/kendo-react-dropdowns 15.0.1-develop.3 → 15.0.1-develop.5
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/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +4 -4
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +16 -14
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +343 -337
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +124 -123
- package/MultiSelectTree/utils.js +1 -1
- package/MultiSelectTree/utils.mjs +17 -17
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +118 -112
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("react"),ue=require("prop-types"),ie=require("../common/MultiColumnList.js"),n=require("@progress/kendo-react-common"),ce=require("../ComboBox/ComboBox.js"),de=require("../common/utils.js"),T=require("../common/withCustomComponent.js");function pe(l){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(m,e,s.get?s:{enumerable:!0,get:()=>l[e]})}}return m.default=l,Object.freeze(m)}const t=pe(se),G=n.createPropsContext(),x=t.forwardRef((l,m)=>{const e=n.usePropsContext(G,l),s=t.useRef(null),c=t.useRef(null);n.getScrollbarWidth();const{columns:d=i.columns,popupSettings:f=i.popupSettings,size:L=i.size,rounded:j=i.rounded,fillMode:z=i.fillMode,className:W,prefix:_=void 0,suffix:D=void 0,onOpen:S,onClose:w,onFocus:R,onBlur:F,onChange:H,onFilterChange:M,onPageChange:N,...V}=e;t.useImperativeHandle(s,()=>{var r;return{element:((r=c.current)==null?void 0:r.element)||null,focus(){c.current&&c.current.focus()},get value(){var o;return(o=c.current)==null?void 0:o.value},get name(){var o;return(o=c.current)==null?void 0:o.name},props:e}}),n.useWebMcpRegister("multicolumncombobox",s,e,e.webMcp),t.useImperativeHandle(m,()=>s.current);const u=t.useMemo(()=>{if(e.groupField!==void 0&&e.data)return de.getItemValue(e.data[0],e.groupField)},[e.data,e.groupField]),[h,b]=t.useState(u),[E,q]=t.useState(!0),k=t.useRef(null),[A]=_?T(e.prefix||t.Fragment):[],[J]=D?T(e.suffix||t.Fragment):[],Q=t.useMemo(()=>{const r=t.createElement("th",{className:"k-table-th",colSpan:d.length},h);return t.createElement(t.Fragment,null,e.header,t.createElement("div",{ref:k,className:"k-table-header-wrap"},t.createElement("table",{className:"k-table",role:"presentation"},t.createElement("colgroup",null,d.map((o,g)=>t.createElement("col",{key:o.uniqueKey?o.uniqueKey:g,style:{width:o.width?o.width:i.width}}))),t.createElement("thead",{className:"k-table-thead"},t.createElement("tr",{className:"k-table-row"},d.map((o,g)=>t.createElement("th",{className:"k-table-th",key:o.uniqueKey?o.uniqueKey:g},o.header||" "))),h&&E&&t.createElement("tr",{className:"k-table-group-row"},e.groupStickyHeaderItemRender?e.groupStickyHeaderItemRender.call(void 0,r,{}):r)))))},[e.header,d,h,E,e.groupStickyHeaderItemRender]),B=e.virtual?e.virtual.skip:0,U=t.useCallback((r,o)=>{const g=d.map((p,le)=>t.createElement("span",{className:e.itemRender?void 0:"k-table-td",style:e.itemRender?void 0:{width:p.width?p.width:i.width},key:p.uniqueKey?p.uniqueKey:le},p.field?String(n.getter(p.field)(o.dataItem)):""));let I,C,v,y;const O=e.data||[],P=o.index-B;e.groupField!==void 0&&(y=n.getter(e.groupField),C=y(O[P]),v=y(O[P-1]),C&&v&&C!==v&&(I=C));const K=t.cloneElement(r,{...r.props,className:n.classNames("k-table-row",{"k-table-alt-row":o.index%2!==0,"k-focus":o.focused,"k-selected":o.selected,"k-first":!!I,"k-disabled":o.dataItem.disabled})},g);return e.itemRender?e.itemRender.call(void 0,K,o):K},[d,e.groupField,e.itemRender,e.data,B]),a=t.useCallback((r,o)=>{r&&r.call(void 0,{...o,target:s.current})},[]),X=t.useCallback(r=>(e.virtual||b(u),a(S,r)),[a,S,e.virtual,u]),Y=t.useCallback(r=>a(w,r),[a,w]),Z=t.useCallback(r=>a(R,r),[a,R]),$=t.useCallback(r=>a(F,r),[a,F]),ee=t.useCallback(r=>a(H,r),[a,H]),te=t.useCallback(r=>a(N,r),[a,N]),re=t.useCallback(r=>(b(u),a(M,{...r,mobileMode:r.target.mobileMode})),[a,u,M]),oe=t.useCallback(r=>{b(r.group)},[]),ae=t.useCallback(r=>{k.current&&(k.current.scrollLeft=r.target.scrollLeft)},[]);t.useEffect(()=>{n.setScrollbarWidth()}),t.useEffect(()=>{const r=e.data;b(u),r&&r.length!==0?q(!0):q(!1)},[e.data,u]);const ne=t.useCallback(r=>t.createElement(ie.MultiColumnList,{...r}),[]);return t.createElement(ce.ComboBox,{...V,list:ne,popupSettings:{...f,popupClass:n.classNames("k-dropdowngrid-popup",f.popupClass),width:f.width,className:f.className},ref:c,header:Q,itemRender:U,groupHeaderItemRender:e.groupHeaderItemRender,size:L,rounded:j,fillMode:z,groupField:e.groupField,isMultiColumn:!0,onOpen:X,onClose:Y,onFocus:Z,onBlur:$,onChange:ee,onFilterChange:re,onPageChange:te,onGroupScroll:oe,onListScroll:ae,className:n.classNames("k-dropdowngrid",W),required:e.required,adaptive:e.adaptive,adaptiveFilter:e.adaptiveFilter,adaptiveTitle:e.adaptiveTitle,adaptiveSubtitle:e.adaptiveSubtitle,footer:e.footer,footerClassName:"k-table-footer",prefix:A,suffix:J})}),me={columns:ue.any.isRequired},i={columns:[],popupSettings:{},width:"200px",size:void 0,rounded:void 0,fillMode:void 0};x.displayName="KendoMultiColumnComboBox";x.propTypes=me;exports.MultiColumnComboBox=x;exports.MultiColumnComboBoxPropsContext=G;
|
|
@@ -5,174 +5,175 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { MultiColumnList as
|
|
11
|
-
import { usePropsContext as
|
|
12
|
-
import { ComboBox as
|
|
13
|
-
import { getItemValue as
|
|
14
|
-
import
|
|
15
|
-
const be = (
|
|
16
|
-
(
|
|
17
|
-
const
|
|
18
|
-
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import se from "prop-types";
|
|
10
|
+
import { MultiColumnList as ie } from "../common/MultiColumnList.mjs";
|
|
11
|
+
import { usePropsContext as ue, getScrollbarWidth as de, useWebMcpRegister as ce, getter as K, classNames as k, setScrollbarWidth as pe, createPropsContext as me } from "@progress/kendo-react-common";
|
|
12
|
+
import { ComboBox as fe } from "../ComboBox/ComboBox.mjs";
|
|
13
|
+
import { getItemValue as ge } from "../common/utils.mjs";
|
|
14
|
+
import G from "../common/withCustomComponent.mjs";
|
|
15
|
+
const be = me(), L = t.forwardRef(
|
|
16
|
+
(T, P) => {
|
|
17
|
+
const e = ue(be, T), c = t.useRef(null), s = t.useRef(null);
|
|
18
|
+
de();
|
|
19
|
+
const {
|
|
20
|
+
columns: i = l.columns,
|
|
19
21
|
popupSettings: p = l.popupSettings,
|
|
20
|
-
size:
|
|
21
|
-
rounded:
|
|
22
|
-
fillMode:
|
|
23
|
-
className:
|
|
24
|
-
prefix:
|
|
22
|
+
size: W = l.size,
|
|
23
|
+
rounded: z = l.rounded,
|
|
24
|
+
fillMode: O = l.fillMode,
|
|
25
|
+
className: V,
|
|
26
|
+
prefix: j = void 0,
|
|
25
27
|
suffix: A = void 0,
|
|
26
|
-
onOpen:
|
|
27
|
-
onClose:
|
|
28
|
-
onFocus:
|
|
29
|
-
onBlur:
|
|
30
|
-
onChange:
|
|
31
|
-
onFilterChange:
|
|
32
|
-
onPageChange:
|
|
28
|
+
onOpen: v,
|
|
29
|
+
onClose: w,
|
|
30
|
+
onFocus: x,
|
|
31
|
+
onBlur: y,
|
|
32
|
+
onChange: S,
|
|
33
|
+
onFilterChange: R,
|
|
34
|
+
onPageChange: F,
|
|
33
35
|
...D
|
|
34
|
-
} =
|
|
35
|
-
|
|
36
|
+
} = e;
|
|
37
|
+
t.useImperativeHandle(c, () => {
|
|
36
38
|
var r;
|
|
37
39
|
return {
|
|
38
|
-
element: ((r =
|
|
40
|
+
element: ((r = s.current) == null ? void 0 : r.element) || null,
|
|
39
41
|
focus() {
|
|
40
|
-
|
|
42
|
+
s.current && s.current.focus();
|
|
41
43
|
},
|
|
42
44
|
get value() {
|
|
43
|
-
var
|
|
44
|
-
return (
|
|
45
|
+
var a;
|
|
46
|
+
return (a = s.current) == null ? void 0 : a.value;
|
|
45
47
|
},
|
|
46
48
|
get name() {
|
|
47
|
-
var
|
|
48
|
-
return (
|
|
49
|
+
var a;
|
|
50
|
+
return (a = s.current) == null ? void 0 : a.name;
|
|
49
51
|
},
|
|
50
|
-
props:
|
|
52
|
+
props: e
|
|
51
53
|
};
|
|
52
|
-
}), e.useImperativeHandle(
|
|
53
|
-
|
|
54
|
-
() =>
|
|
54
|
+
}), ce("multicolumncombobox", c, e, e.webMcp), t.useImperativeHandle(
|
|
55
|
+
P,
|
|
56
|
+
() => c.current
|
|
55
57
|
);
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
}, [
|
|
60
|
-
const r = /* @__PURE__ */
|
|
61
|
-
return /* @__PURE__ */
|
|
58
|
+
const n = t.useMemo(() => {
|
|
59
|
+
if (e.groupField !== void 0 && e.data)
|
|
60
|
+
return ge(e.data[0], e.groupField);
|
|
61
|
+
}, [e.data, e.groupField]), [g, m] = t.useState(n), [H, E] = t.useState(!0), b = t.useRef(null), [J] = j ? G(e.prefix || t.Fragment) : [], [Q] = A ? G(e.suffix || t.Fragment) : [], U = t.useMemo(() => {
|
|
62
|
+
const r = /* @__PURE__ */ t.createElement("th", { className: "k-table-th", colSpan: i.length }, g);
|
|
63
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, e.header, /* @__PURE__ */ t.createElement("div", { ref: b, className: "k-table-header-wrap" }, /* @__PURE__ */ t.createElement("table", { className: "k-table", role: "presentation" }, /* @__PURE__ */ t.createElement("colgroup", null, i.map((a, d) => /* @__PURE__ */ t.createElement(
|
|
62
64
|
"col",
|
|
63
65
|
{
|
|
64
|
-
key:
|
|
65
|
-
style: { width:
|
|
66
|
+
key: a.uniqueKey ? a.uniqueKey : d,
|
|
67
|
+
style: { width: a.width ? a.width : l.width }
|
|
66
68
|
}
|
|
67
|
-
))), /* @__PURE__ */
|
|
68
|
-
}, [
|
|
69
|
-
() =>
|
|
70
|
-
|
|
71
|
-
`calc(${a.map((r) => be(r.width, l.width)).filter(Boolean).join(" + ")} + ${y}px + 4px)`
|
|
72
|
-
),
|
|
73
|
-
[a, y]
|
|
74
|
-
), q = t.virtual ? t.virtual.skip : 0, Y = e.useCallback(
|
|
75
|
-
(r, o) => {
|
|
76
|
-
const c = a.map((u, ie) => /* @__PURE__ */ e.createElement(
|
|
69
|
+
))), /* @__PURE__ */ t.createElement("thead", { className: "k-table-thead" }, /* @__PURE__ */ t.createElement("tr", { className: "k-table-row" }, i.map((a, d) => /* @__PURE__ */ t.createElement("th", { className: "k-table-th", key: a.uniqueKey ? a.uniqueKey : d }, a.header || " "))), g && H && /* @__PURE__ */ t.createElement("tr", { className: "k-table-group-row" }, e.groupStickyHeaderItemRender ? e.groupStickyHeaderItemRender.call(void 0, r, {}) : r)))));
|
|
70
|
+
}, [e.header, i, g, H, e.groupStickyHeaderItemRender]), N = e.virtual ? e.virtual.skip : 0, X = t.useCallback(
|
|
71
|
+
(r, a) => {
|
|
72
|
+
const d = i.map((u, le) => /* @__PURE__ */ t.createElement(
|
|
77
73
|
"span",
|
|
78
74
|
{
|
|
79
|
-
className:
|
|
80
|
-
style:
|
|
81
|
-
key: u.uniqueKey ? u.uniqueKey :
|
|
75
|
+
className: e.itemRender ? void 0 : "k-table-td",
|
|
76
|
+
style: e.itemRender ? void 0 : { width: u.width ? u.width : l.width },
|
|
77
|
+
key: u.uniqueKey ? u.uniqueKey : le
|
|
82
78
|
},
|
|
83
|
-
u.field ? String(
|
|
79
|
+
u.field ? String(K(u.field)(a.dataItem)) : ""
|
|
84
80
|
));
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const
|
|
81
|
+
let M, f, h, C;
|
|
82
|
+
const I = e.data || [], q = a.index - N;
|
|
83
|
+
e.groupField !== void 0 && (C = K(e.groupField), f = C(I[q]), h = C(I[q - 1]), f && h && f !== h && (M = f));
|
|
84
|
+
const B = t.cloneElement(
|
|
89
85
|
r,
|
|
90
86
|
{
|
|
91
87
|
...r.props,
|
|
92
|
-
className:
|
|
93
|
-
"k-table-alt-row":
|
|
94
|
-
"k-focus":
|
|
95
|
-
"k-selected":
|
|
96
|
-
"k-first": !!
|
|
97
|
-
"k-disabled":
|
|
88
|
+
className: k("k-table-row", {
|
|
89
|
+
"k-table-alt-row": a.index % 2 !== 0,
|
|
90
|
+
"k-focus": a.focused,
|
|
91
|
+
"k-selected": a.selected,
|
|
92
|
+
"k-first": !!M,
|
|
93
|
+
"k-disabled": a.dataItem.disabled
|
|
98
94
|
})
|
|
99
95
|
},
|
|
100
|
-
|
|
96
|
+
d
|
|
101
97
|
);
|
|
102
|
-
return
|
|
98
|
+
return e.itemRender ? e.itemRender.call(void 0, B, a) : B;
|
|
103
99
|
},
|
|
104
|
-
[
|
|
105
|
-
),
|
|
100
|
+
[i, e.groupField, e.itemRender, e.data, N]
|
|
101
|
+
), o = t.useCallback((r, a) => {
|
|
106
102
|
r && r.call(void 0, {
|
|
107
|
-
...
|
|
108
|
-
target:
|
|
103
|
+
...a,
|
|
104
|
+
target: c.current
|
|
109
105
|
});
|
|
110
|
-
}, []),
|
|
111
|
-
(r) => (
|
|
112
|
-
[
|
|
113
|
-
),
|
|
114
|
-
(r) => (
|
|
106
|
+
}, []), Y = t.useCallback(
|
|
107
|
+
(r) => (e.virtual || m(n), o(v, r)),
|
|
108
|
+
[o, v, e.virtual, n]
|
|
109
|
+
), Z = t.useCallback((r) => o(w, r), [o, w]), _ = t.useCallback((r) => o(x, r), [o, x]), $ = t.useCallback((r) => o(y, r), [o, y]), ee = t.useCallback(
|
|
110
|
+
(r) => o(S, r),
|
|
111
|
+
[o, S]
|
|
112
|
+
), te = t.useCallback(
|
|
113
|
+
(r) => o(F, r),
|
|
114
|
+
[o, F]
|
|
115
|
+
), re = t.useCallback(
|
|
116
|
+
(r) => (m(n), o(R, {
|
|
115
117
|
...r,
|
|
116
118
|
mobileMode: r.target.mobileMode
|
|
117
119
|
})),
|
|
118
|
-
[
|
|
119
|
-
),
|
|
120
|
+
[o, n, R]
|
|
121
|
+
), ae = t.useCallback((r) => {
|
|
120
122
|
m(r.group);
|
|
121
|
-
}, []),
|
|
123
|
+
}, []), oe = t.useCallback((r) => {
|
|
122
124
|
b.current && (b.current.scrollLeft = r.target.scrollLeft);
|
|
123
125
|
}, []);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}),
|
|
127
|
-
const r =
|
|
128
|
-
m(
|
|
129
|
-
}, [
|
|
130
|
-
const
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
|
|
126
|
+
t.useEffect(() => {
|
|
127
|
+
pe();
|
|
128
|
+
}), t.useEffect(() => {
|
|
129
|
+
const r = e.data;
|
|
130
|
+
m(n), r && r.length !== 0 ? E(!0) : E(!1);
|
|
131
|
+
}, [e.data, n]);
|
|
132
|
+
const ne = t.useCallback((r) => /* @__PURE__ */ t.createElement(ie, { ...r }), []);
|
|
133
|
+
return /* @__PURE__ */ t.createElement(
|
|
134
|
+
fe,
|
|
133
135
|
{
|
|
134
136
|
...D,
|
|
135
|
-
list:
|
|
137
|
+
list: ne,
|
|
136
138
|
popupSettings: {
|
|
137
139
|
...p,
|
|
138
|
-
popupClass:
|
|
139
|
-
width: p.width
|
|
140
|
+
popupClass: k("k-dropdowngrid-popup", p.popupClass),
|
|
141
|
+
width: p.width,
|
|
140
142
|
className: p.className
|
|
141
143
|
},
|
|
142
|
-
ref:
|
|
144
|
+
ref: s,
|
|
143
145
|
header: U,
|
|
144
|
-
itemRender:
|
|
145
|
-
groupHeaderItemRender:
|
|
146
|
-
size:
|
|
147
|
-
rounded:
|
|
148
|
-
fillMode:
|
|
149
|
-
groupField:
|
|
146
|
+
itemRender: X,
|
|
147
|
+
groupHeaderItemRender: e.groupHeaderItemRender,
|
|
148
|
+
size: W,
|
|
149
|
+
rounded: z,
|
|
150
|
+
fillMode: O,
|
|
151
|
+
groupField: e.groupField,
|
|
150
152
|
isMultiColumn: !0,
|
|
151
|
-
onOpen:
|
|
152
|
-
onClose:
|
|
153
|
-
onFocus:
|
|
154
|
-
onBlur:
|
|
155
|
-
onChange:
|
|
156
|
-
onFilterChange:
|
|
157
|
-
onPageChange:
|
|
158
|
-
onGroupScroll:
|
|
159
|
-
onListScroll:
|
|
160
|
-
className:
|
|
161
|
-
required:
|
|
162
|
-
adaptive:
|
|
163
|
-
adaptiveFilter:
|
|
164
|
-
adaptiveTitle:
|
|
165
|
-
adaptiveSubtitle:
|
|
166
|
-
footer:
|
|
153
|
+
onOpen: Y,
|
|
154
|
+
onClose: Z,
|
|
155
|
+
onFocus: _,
|
|
156
|
+
onBlur: $,
|
|
157
|
+
onChange: ee,
|
|
158
|
+
onFilterChange: re,
|
|
159
|
+
onPageChange: te,
|
|
160
|
+
onGroupScroll: ae,
|
|
161
|
+
onListScroll: oe,
|
|
162
|
+
className: k("k-dropdowngrid", V),
|
|
163
|
+
required: e.required,
|
|
164
|
+
adaptive: e.adaptive,
|
|
165
|
+
adaptiveFilter: e.adaptiveFilter,
|
|
166
|
+
adaptiveTitle: e.adaptiveTitle,
|
|
167
|
+
adaptiveSubtitle: e.adaptiveSubtitle,
|
|
168
|
+
footer: e.footer,
|
|
167
169
|
footerClassName: "k-table-footer",
|
|
168
170
|
prefix: J,
|
|
169
171
|
suffix: Q
|
|
170
172
|
}
|
|
171
173
|
);
|
|
172
174
|
}
|
|
173
|
-
),
|
|
174
|
-
|
|
175
|
-
columns: ue.any.isRequired
|
|
175
|
+
), he = {
|
|
176
|
+
columns: se.any.isRequired
|
|
176
177
|
}, l = {
|
|
177
178
|
columns: [],
|
|
178
179
|
popupSettings: {},
|
|
@@ -181,9 +182,9 @@ const be = (s, g) => s ? typeof s == "number" ? s + "px" : s : g, ke = fe(), P =
|
|
|
181
182
|
rounded: void 0,
|
|
182
183
|
fillMode: void 0
|
|
183
184
|
};
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
L.displayName = "KendoMultiColumnComboBox";
|
|
186
|
+
L.propTypes = he;
|
|
186
187
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
L as MultiColumnComboBox,
|
|
189
|
+
be as MultiColumnComboBoxPropsContext
|
|
189
190
|
};
|
package/MultiSelectTree/utils.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@progress/kendo-react-common"),r=(i,m)=>{const u={};return i&&i.length&&i.forEach(f=>{u[m(f)]=!0}),u},G=(i,m)=>{const{items:u,dataItemKey:f,value:p,subItemsField:S="items",operation:V}=m,t=C.getter(f),I=r(p,t);if(V==="clear")return[];if(V==="delete"){const n=r(u,t);return p.filter(e=>!n[t(e)])}const y=u[0],w=t(y),d=C.getter(S),a=[...i],l=[];let M=[],g;for(;a.length;){const n=a.pop();if(w===t(n)){M=l.map(e=>e.item),g=n;break}else{const e=d(n);for(e&&e.length&&(l.push({item:n,parentPosition:a.length}),a.push(...e));l.length&&l[l.length-1].parentPosition===a.length;)l.pop()}}const b=[...d(g)||[]],k=[];for(;b.length;){const n=b.pop();k.push(n);const e=d(n);e&&e.length&&b.push(...e)}const P=!I[w],c=[];if(P){c.push(...p),c.push(g),c.push(...k.filter(s=>!I[t(s)]));const n=M.filter(s=>!I[t(s)]),e=r(c,t);for(let s=n.length-1;s>-1;s--){const h=n[s],o=d(h);if(o.filter(T=>e[t(T)]).length<o.length)break;c.push(h),e[t(h)]=!0}}else{const n=t(g),e=r(k,t),s=r(M,t);c.push(...p.filter(h=>{const o=t(h);return!e[o]&&n!==o&&!s[o]}))}return c};exports.getMultiSelectTreeValue=G;exports.getValueMap=r;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { getter as V } from "@progress/kendo-react-common";
|
|
9
|
-
const a = (
|
|
9
|
+
const a = (r, f) => {
|
|
10
10
|
const i = {};
|
|
11
|
-
return
|
|
11
|
+
return r && r.length && r.forEach((g) => {
|
|
12
12
|
i[f(g)] = !0;
|
|
13
13
|
}), i;
|
|
14
|
-
}, E = (
|
|
14
|
+
}, E = (r, f) => {
|
|
15
15
|
const { items: i, dataItemKey: g, value: u, subItemsField: x = "items", operation: w } = f, t = V(g), I = a(u, t);
|
|
16
16
|
if (w === "clear")
|
|
17
17
|
return [];
|
|
@@ -19,17 +19,17 @@ const a = (l, f) => {
|
|
|
19
19
|
const n = a(i, t);
|
|
20
20
|
return u.filter((e) => !n[t(e)]);
|
|
21
21
|
}
|
|
22
|
-
const G = i[0], C = t(G), d = V(x), h = [...
|
|
22
|
+
const G = i[0], C = t(G), d = V(x), h = [...r], o = [];
|
|
23
23
|
let b = [], m;
|
|
24
24
|
for (; h.length; ) {
|
|
25
25
|
const n = h.pop();
|
|
26
26
|
if (C === t(n)) {
|
|
27
|
-
b =
|
|
27
|
+
b = o.map((e) => e.item), m = n;
|
|
28
28
|
break;
|
|
29
29
|
} else {
|
|
30
|
-
c && c.length && c[c.length - 1].parentPosition === h.length && c.pop();
|
|
31
30
|
const e = d(n);
|
|
32
|
-
e && e.length && (
|
|
31
|
+
for (e && e.length && (o.push({ item: n, parentPosition: h.length }), h.push(...e)); o.length && o[o.length - 1].parentPosition === h.length; )
|
|
32
|
+
o.pop();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
const k = [...d(m) || []], M = [];
|
|
@@ -39,26 +39,26 @@ const a = (l, f) => {
|
|
|
39
39
|
const e = d(n);
|
|
40
40
|
e && e.length && k.push(...e);
|
|
41
41
|
}
|
|
42
|
-
const L = !I[C],
|
|
42
|
+
const L = !I[C], c = [];
|
|
43
43
|
if (L) {
|
|
44
|
-
|
|
45
|
-
const n = b.filter((s) => !I[t(s)]), e = a(
|
|
44
|
+
c.push(...u), c.push(m), c.push(...M.filter((s) => !I[t(s)]));
|
|
45
|
+
const n = b.filter((s) => !I[t(s)]), e = a(c, t);
|
|
46
46
|
for (let s = n.length - 1; s > -1; s--) {
|
|
47
|
-
const p = n[s],
|
|
48
|
-
if (
|
|
47
|
+
const p = n[s], l = d(p);
|
|
48
|
+
if (l.filter((P) => e[t(P)]).length < l.length)
|
|
49
49
|
break;
|
|
50
|
-
|
|
50
|
+
c.push(p), e[t(p)] = !0;
|
|
51
51
|
}
|
|
52
52
|
} else {
|
|
53
53
|
const n = t(m), e = a(M, t), s = a(b, t);
|
|
54
|
-
|
|
54
|
+
c.push(
|
|
55
55
|
...u.filter((p) => {
|
|
56
|
-
const
|
|
57
|
-
return !e[
|
|
56
|
+
const l = t(p);
|
|
57
|
+
return !e[l] && n !== l && !s[l];
|
|
58
58
|
})
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return c;
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
64
64
|
E as getMultiSelectTreeValue,
|
package/common/DropDownBase.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),
|
|
8
|
+
"use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),r=class r{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var a,u,d,g,f,m;const s=this.vs,i=(u=(a=this.list)==null?void 0:a.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,p=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&p!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(p/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>{t.scrollElement=s},key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){var i;this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="");const e=this.component.props,t=(i=e.opened)!=null?i:this.component.state.opened,s=e.popupSettings||{};if(t&&s.width===void 0){const o=this.popupWidth;this.calculatePopupWidth(),this.popupWidth!==o&&this.component.forceUpdate()}}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,p=o.container||i.parentNode,a=t!==void 0?t:o.enabled;c.scrollToItem(p,i,e,o.translate,a)}}updateComponentArgs(e){for(const t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:p}=s,a=s.opened!==void 0?s.opened:this.component.state.opened;e&&p&&this.vs.enabled&&(p.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,p.skip-1,p.pageSize):!a&&p.skip+p.pageSize<p.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,p.skip+1,p.pageSize))}getPopupSettings(){return Object.assign({},r.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};r.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},r.propTypes={...r.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},r.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=r;module.exports=h;
|