ninegrid2 6.243.0 → 6.245.0
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/bundle.cjs.js +40 -37
- package/dist/bundle.esm.js +40 -37
- package/dist/etc/ngFiltering.js +40 -37
- package/package.json +1 -1
- package/src/etc/ngFiltering.js +40 -37
package/dist/bundle.cjs.js
CHANGED
|
@@ -17991,7 +17991,7 @@ class ngFilterButton extends HTMLElement
|
|
|
17991
17991
|
class ngFilterPanel extends HTMLElement
|
|
17992
17992
|
{
|
|
17993
17993
|
#owner;
|
|
17994
|
-
#
|
|
17994
|
+
#button;
|
|
17995
17995
|
#timer;
|
|
17996
17996
|
|
|
17997
17997
|
constructor () {
|
|
@@ -18002,7 +18002,6 @@ class ngFilterPanel extends HTMLElement
|
|
|
18002
18002
|
connectedCallback() {
|
|
18003
18003
|
|
|
18004
18004
|
this.#owner = this.getRootNode().host;
|
|
18005
|
-
console.log("========================", this.#owner);
|
|
18006
18005
|
|
|
18007
18006
|
const cssPath = this.getRootNode().host.closest("nine-grid").getAttribute("css-path") || "";
|
|
18008
18007
|
|
|
@@ -18041,25 +18040,21 @@ class ngFilterPanel extends HTMLElement
|
|
|
18041
18040
|
</div>
|
|
18042
18041
|
`;
|
|
18043
18042
|
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
//$(this).on("mousedown", e => { e.preventDefault(); e.stopPropagation(); });
|
|
18050
|
-
//$(this).on("mousedown", e => { e.stopPropagation(); });
|
|
18043
|
+
this.shadowRoot.querySelector("input[type=text]").addEventListener("input", this.#onInput);
|
|
18044
|
+
this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change", this.#onSelectAll);
|
|
18045
|
+
this.shadowRoot.querySelector("#btnOk").addEventListener("click", this.#onOk);
|
|
18046
|
+
this.shadowRoot.querySelector("#btnCancel").addEventListener("click", this.#onCancel);
|
|
18051
18047
|
};
|
|
18052
18048
|
|
|
18053
18049
|
#onOk = (e) => {
|
|
18054
18050
|
|
|
18055
18051
|
const grd = this.shadowRoot.querySelector("nine-grid");
|
|
18056
18052
|
|
|
18057
|
-
//ninegrid.j.querySelectorAll(grd).addClass("loading");
|
|
18058
|
-
//ninegrid.j.querySelectorAll(this.#target.owner).addClass("loading");
|
|
18059
18053
|
this.classList.add("loading");
|
|
18060
18054
|
|
|
18061
18055
|
setTimeout(() => {
|
|
18062
18056
|
|
|
18057
|
+
/**
|
|
18063
18058
|
const LVL_IDX = grd.fields.indexOf("LVL");
|
|
18064
18059
|
const CHK_IDX = grd.fields.indexOf("CHK");
|
|
18065
18060
|
const COLNM_IDX = grd.fields.indexOf("COLNM");
|
|
@@ -18077,36 +18072,49 @@ class ngFilterPanel extends HTMLElement
|
|
|
18077
18072
|
data : [...new Set(grd.data.getValidData().filter(m => { return m.v[CHK_IDX] == "Y" && m.v[COLNM_IDX] == v; }).map(m => { return m.v[DATA_IDX] || ''; }))].sort((a,b) => { return a > b ? 1 : -1; }),
|
|
18078
18073
|
});
|
|
18079
18074
|
});
|
|
18080
|
-
}
|
|
18075
|
+
} */
|
|
18076
|
+
const [LVL_IDX, CHK_IDX, COLNM_IDX, DATA_IDX] = ["LVL", "CHK", "COLNM", "DATA"].map(k => grd.fields.indexOf(k));
|
|
18077
|
+
const checked = grd.data.getValidDataNF().filter(m => m.v[LVL_IDX] === 2 && m.v[CHK_IDX] === "Y");
|
|
18078
|
+
const filterOptions = checked.length > 0 ? [...new Set(checked.map(m => m.v[COLNM_IDX]))].map(v => ({
|
|
18079
|
+
colnm: v,
|
|
18080
|
+
data: [...new Set(grd.data.getValidData().filter(m => m.v[CHK_IDX] === "Y" && m.v[COLNM_IDX] === v).map(m => m.v[DATA_IDX] || ''))].sort()
|
|
18081
|
+
})) : [];
|
|
18081
18082
|
|
|
18082
|
-
//console.log(filterOptions);
|
|
18083
|
-
//console.log(this.#target, this.#target.button, filterOptions)
|
|
18084
18083
|
|
|
18085
|
-
this.#
|
|
18084
|
+
this.#button.filterOptions = filterOptions;
|
|
18086
18085
|
|
|
18086
|
+
/**
|
|
18087
18087
|
var oParam = {};
|
|
18088
18088
|
|
|
18089
|
-
this.#
|
|
18089
|
+
this.#owner.body.querySelectorAll("ng-filter-button").forEach(el => {
|
|
18090
18090
|
|
|
18091
18091
|
//if (!el.filterOptions) return true;
|
|
18092
18092
|
|
|
18093
18093
|
el.filterOptions.forEach(filterOptions => {
|
|
18094
18094
|
if (filterOptions.data.length > 0) oParam[filterOptions.colnm] = filterOptions.data;
|
|
18095
18095
|
});
|
|
18096
|
-
});
|
|
18097
|
-
|
|
18098
|
-
this.#target.owner.filtering.set(oParam);
|
|
18096
|
+
}); */
|
|
18099
18097
|
|
|
18098
|
+
const oParam = Object.fromEntries(
|
|
18099
|
+
[...this.#owner.body.querySelectorAll("ng-filter-button")]
|
|
18100
|
+
.flatMap(el => el.filterOptions)
|
|
18101
|
+
.filter(opt => opt.data.length > 0)
|
|
18102
|
+
.map(opt => [opt.colnm, opt.data])
|
|
18103
|
+
);
|
|
18104
|
+
|
|
18105
|
+
this.#owner.filtering.set(oParam);
|
|
18100
18106
|
this.classList.remove("loading");
|
|
18101
18107
|
});
|
|
18102
18108
|
|
|
18103
|
-
|
|
18109
|
+
//$(this).hide();
|
|
18110
|
+
this.style.display = 'none';
|
|
18104
18111
|
};
|
|
18105
18112
|
|
|
18106
18113
|
|
|
18107
18114
|
|
|
18108
18115
|
#onCancel = (e) => {
|
|
18109
|
-
|
|
18116
|
+
//$(this).hide();
|
|
18117
|
+
this.style.display = 'none';
|
|
18110
18118
|
};
|
|
18111
18119
|
|
|
18112
18120
|
#onSelectAll = (e) => {
|
|
@@ -18159,13 +18167,13 @@ class ngFilterPanel extends HTMLElement
|
|
|
18159
18167
|
|
|
18160
18168
|
open = (filterButton) => {
|
|
18161
18169
|
|
|
18162
|
-
const owner = this.shadow.closest("nine-grid");
|
|
18170
|
+
//const owner = this.shadow.closest("nine-grid");
|
|
18163
18171
|
|
|
18164
18172
|
/** 위치 */
|
|
18165
18173
|
const cell = filterButton.closest("th,td");
|
|
18166
18174
|
|
|
18167
18175
|
const filterButtonRect = filterButton.getBoundingClientRect();
|
|
18168
|
-
const ownerRect = owner.getBoundingClientRect();
|
|
18176
|
+
const ownerRect = this.#owner.getBoundingClientRect();
|
|
18169
18177
|
const cellRect = cell.getBoundingClientRect();
|
|
18170
18178
|
const targetRect = this.getBoundingClientRect();
|
|
18171
18179
|
|
|
@@ -18185,12 +18193,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
18185
18193
|
var col = filterButton.closest('th,td').dataset.col;
|
|
18186
18194
|
this.col = col;
|
|
18187
18195
|
|
|
18188
|
-
this.#
|
|
18189
|
-
owner : owner,
|
|
18190
|
-
button : filterButton,
|
|
18191
|
-
uuid : owner.uuid,
|
|
18192
|
-
col : col,
|
|
18193
|
-
};
|
|
18196
|
+
this.#button = filterButton;
|
|
18194
18197
|
|
|
18195
18198
|
this.style.display = 'flex';
|
|
18196
18199
|
this.classList.add("loading");
|
|
@@ -18204,7 +18207,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
18204
18207
|
setTimeout(() => {
|
|
18205
18208
|
|
|
18206
18209
|
|
|
18207
|
-
let data = owner.data.getValidDataNF();
|
|
18210
|
+
let data = this.#owner.data.getValidDataNF();
|
|
18208
18211
|
|
|
18209
18212
|
var ds = [];
|
|
18210
18213
|
filterButton.filterOptions.forEach((filterOption,i) => {
|
|
@@ -18216,22 +18219,22 @@ class ngFilterPanel extends HTMLElement
|
|
|
18216
18219
|
});
|
|
18217
18220
|
|
|
18218
18221
|
/**
|
|
18219
|
-
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
|
|
18222
|
+
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, this.#owner.template);
|
|
18220
18223
|
var expr = cell.attr("data-expr");
|
|
18221
|
-
var exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
18224
|
+
var exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
18222
18225
|
*/
|
|
18223
18226
|
|
|
18224
|
-
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
|
|
18227
|
+
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, this.#owner.tmpl).elem();
|
|
18225
18228
|
const expr = cell.getAttribute("data-expr");
|
|
18226
|
-
const exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
18229
|
+
const exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
18227
18230
|
|
|
18228
18231
|
var data2 = [];
|
|
18229
18232
|
for (var rowData of data) {
|
|
18230
|
-
var idx = owner.fields.indexOf(filterOption.colnm);
|
|
18233
|
+
var idx = this.#owner.fields.indexOf(filterOption.colnm);
|
|
18231
18234
|
|
|
18232
18235
|
if (expr) {
|
|
18233
|
-
var o = owner.data.conv(rowData);
|
|
18234
|
-
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
|
|
18236
|
+
var o = this.#owner.data.conv(rowData);
|
|
18237
|
+
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, this.#owner.data)});
|
|
18235
18238
|
}
|
|
18236
18239
|
else {
|
|
18237
18240
|
data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
|
package/dist/bundle.esm.js
CHANGED
|
@@ -17989,7 +17989,7 @@ class ngFilterButton extends HTMLElement
|
|
|
17989
17989
|
class ngFilterPanel extends HTMLElement
|
|
17990
17990
|
{
|
|
17991
17991
|
#owner;
|
|
17992
|
-
#
|
|
17992
|
+
#button;
|
|
17993
17993
|
#timer;
|
|
17994
17994
|
|
|
17995
17995
|
constructor () {
|
|
@@ -18000,7 +18000,6 @@ class ngFilterPanel extends HTMLElement
|
|
|
18000
18000
|
connectedCallback() {
|
|
18001
18001
|
|
|
18002
18002
|
this.#owner = this.getRootNode().host;
|
|
18003
|
-
console.log("========================", this.#owner);
|
|
18004
18003
|
|
|
18005
18004
|
const cssPath = this.getRootNode().host.closest("nine-grid").getAttribute("css-path") || "";
|
|
18006
18005
|
|
|
@@ -18039,25 +18038,21 @@ class ngFilterPanel extends HTMLElement
|
|
|
18039
18038
|
</div>
|
|
18040
18039
|
`;
|
|
18041
18040
|
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
//$(this).on("mousedown", e => { e.preventDefault(); e.stopPropagation(); });
|
|
18048
|
-
//$(this).on("mousedown", e => { e.stopPropagation(); });
|
|
18041
|
+
this.shadowRoot.querySelector("input[type=text]").addEventListener("input", this.#onInput);
|
|
18042
|
+
this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change", this.#onSelectAll);
|
|
18043
|
+
this.shadowRoot.querySelector("#btnOk").addEventListener("click", this.#onOk);
|
|
18044
|
+
this.shadowRoot.querySelector("#btnCancel").addEventListener("click", this.#onCancel);
|
|
18049
18045
|
};
|
|
18050
18046
|
|
|
18051
18047
|
#onOk = (e) => {
|
|
18052
18048
|
|
|
18053
18049
|
const grd = this.shadowRoot.querySelector("nine-grid");
|
|
18054
18050
|
|
|
18055
|
-
//ninegrid.j.querySelectorAll(grd).addClass("loading");
|
|
18056
|
-
//ninegrid.j.querySelectorAll(this.#target.owner).addClass("loading");
|
|
18057
18051
|
this.classList.add("loading");
|
|
18058
18052
|
|
|
18059
18053
|
setTimeout(() => {
|
|
18060
18054
|
|
|
18055
|
+
/**
|
|
18061
18056
|
const LVL_IDX = grd.fields.indexOf("LVL");
|
|
18062
18057
|
const CHK_IDX = grd.fields.indexOf("CHK");
|
|
18063
18058
|
const COLNM_IDX = grd.fields.indexOf("COLNM");
|
|
@@ -18075,36 +18070,49 @@ class ngFilterPanel extends HTMLElement
|
|
|
18075
18070
|
data : [...new Set(grd.data.getValidData().filter(m => { return m.v[CHK_IDX] == "Y" && m.v[COLNM_IDX] == v; }).map(m => { return m.v[DATA_IDX] || ''; }))].sort((a,b) => { return a > b ? 1 : -1; }),
|
|
18076
18071
|
});
|
|
18077
18072
|
});
|
|
18078
|
-
}
|
|
18073
|
+
} */
|
|
18074
|
+
const [LVL_IDX, CHK_IDX, COLNM_IDX, DATA_IDX] = ["LVL", "CHK", "COLNM", "DATA"].map(k => grd.fields.indexOf(k));
|
|
18075
|
+
const checked = grd.data.getValidDataNF().filter(m => m.v[LVL_IDX] === 2 && m.v[CHK_IDX] === "Y");
|
|
18076
|
+
const filterOptions = checked.length > 0 ? [...new Set(checked.map(m => m.v[COLNM_IDX]))].map(v => ({
|
|
18077
|
+
colnm: v,
|
|
18078
|
+
data: [...new Set(grd.data.getValidData().filter(m => m.v[CHK_IDX] === "Y" && m.v[COLNM_IDX] === v).map(m => m.v[DATA_IDX] || ''))].sort()
|
|
18079
|
+
})) : [];
|
|
18079
18080
|
|
|
18080
|
-
//console.log(filterOptions);
|
|
18081
|
-
//console.log(this.#target, this.#target.button, filterOptions)
|
|
18082
18081
|
|
|
18083
|
-
this.#
|
|
18082
|
+
this.#button.filterOptions = filterOptions;
|
|
18084
18083
|
|
|
18084
|
+
/**
|
|
18085
18085
|
var oParam = {};
|
|
18086
18086
|
|
|
18087
|
-
this.#
|
|
18087
|
+
this.#owner.body.querySelectorAll("ng-filter-button").forEach(el => {
|
|
18088
18088
|
|
|
18089
18089
|
//if (!el.filterOptions) return true;
|
|
18090
18090
|
|
|
18091
18091
|
el.filterOptions.forEach(filterOptions => {
|
|
18092
18092
|
if (filterOptions.data.length > 0) oParam[filterOptions.colnm] = filterOptions.data;
|
|
18093
18093
|
});
|
|
18094
|
-
});
|
|
18095
|
-
|
|
18096
|
-
this.#target.owner.filtering.set(oParam);
|
|
18094
|
+
}); */
|
|
18097
18095
|
|
|
18096
|
+
const oParam = Object.fromEntries(
|
|
18097
|
+
[...this.#owner.body.querySelectorAll("ng-filter-button")]
|
|
18098
|
+
.flatMap(el => el.filterOptions)
|
|
18099
|
+
.filter(opt => opt.data.length > 0)
|
|
18100
|
+
.map(opt => [opt.colnm, opt.data])
|
|
18101
|
+
);
|
|
18102
|
+
|
|
18103
|
+
this.#owner.filtering.set(oParam);
|
|
18098
18104
|
this.classList.remove("loading");
|
|
18099
18105
|
});
|
|
18100
18106
|
|
|
18101
|
-
|
|
18107
|
+
//$(this).hide();
|
|
18108
|
+
this.style.display = 'none';
|
|
18102
18109
|
};
|
|
18103
18110
|
|
|
18104
18111
|
|
|
18105
18112
|
|
|
18106
18113
|
#onCancel = (e) => {
|
|
18107
|
-
|
|
18114
|
+
//$(this).hide();
|
|
18115
|
+
this.style.display = 'none';
|
|
18108
18116
|
};
|
|
18109
18117
|
|
|
18110
18118
|
#onSelectAll = (e) => {
|
|
@@ -18157,13 +18165,13 @@ class ngFilterPanel extends HTMLElement
|
|
|
18157
18165
|
|
|
18158
18166
|
open = (filterButton) => {
|
|
18159
18167
|
|
|
18160
|
-
const owner = this.shadow.closest("nine-grid");
|
|
18168
|
+
//const owner = this.shadow.closest("nine-grid");
|
|
18161
18169
|
|
|
18162
18170
|
/** 위치 */
|
|
18163
18171
|
const cell = filterButton.closest("th,td");
|
|
18164
18172
|
|
|
18165
18173
|
const filterButtonRect = filterButton.getBoundingClientRect();
|
|
18166
|
-
const ownerRect = owner.getBoundingClientRect();
|
|
18174
|
+
const ownerRect = this.#owner.getBoundingClientRect();
|
|
18167
18175
|
const cellRect = cell.getBoundingClientRect();
|
|
18168
18176
|
const targetRect = this.getBoundingClientRect();
|
|
18169
18177
|
|
|
@@ -18183,12 +18191,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
18183
18191
|
var col = filterButton.closest('th,td').dataset.col;
|
|
18184
18192
|
this.col = col;
|
|
18185
18193
|
|
|
18186
|
-
this.#
|
|
18187
|
-
owner : owner,
|
|
18188
|
-
button : filterButton,
|
|
18189
|
-
uuid : owner.uuid,
|
|
18190
|
-
col : col,
|
|
18191
|
-
};
|
|
18194
|
+
this.#button = filterButton;
|
|
18192
18195
|
|
|
18193
18196
|
this.style.display = 'flex';
|
|
18194
18197
|
this.classList.add("loading");
|
|
@@ -18202,7 +18205,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
18202
18205
|
setTimeout(() => {
|
|
18203
18206
|
|
|
18204
18207
|
|
|
18205
|
-
let data = owner.data.getValidDataNF();
|
|
18208
|
+
let data = this.#owner.data.getValidDataNF();
|
|
18206
18209
|
|
|
18207
18210
|
var ds = [];
|
|
18208
18211
|
filterButton.filterOptions.forEach((filterOption,i) => {
|
|
@@ -18214,22 +18217,22 @@ class ngFilterPanel extends HTMLElement
|
|
|
18214
18217
|
});
|
|
18215
18218
|
|
|
18216
18219
|
/**
|
|
18217
|
-
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
|
|
18220
|
+
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, this.#owner.template);
|
|
18218
18221
|
var expr = cell.attr("data-expr");
|
|
18219
|
-
var exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
18222
|
+
var exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
18220
18223
|
*/
|
|
18221
18224
|
|
|
18222
|
-
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
|
|
18225
|
+
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, this.#owner.tmpl).elem();
|
|
18223
18226
|
const expr = cell.getAttribute("data-expr");
|
|
18224
|
-
const exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
18227
|
+
const exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
18225
18228
|
|
|
18226
18229
|
var data2 = [];
|
|
18227
18230
|
for (var rowData of data) {
|
|
18228
|
-
var idx = owner.fields.indexOf(filterOption.colnm);
|
|
18231
|
+
var idx = this.#owner.fields.indexOf(filterOption.colnm);
|
|
18229
18232
|
|
|
18230
18233
|
if (expr) {
|
|
18231
|
-
var o = owner.data.conv(rowData);
|
|
18232
|
-
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
|
|
18234
|
+
var o = this.#owner.data.conv(rowData);
|
|
18235
|
+
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, this.#owner.data)});
|
|
18233
18236
|
}
|
|
18234
18237
|
else {
|
|
18235
18238
|
data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
|
package/dist/etc/ngFiltering.js
CHANGED
|
@@ -168,7 +168,7 @@ class ngFilterButton extends HTMLElement
|
|
|
168
168
|
class ngFilterPanel extends HTMLElement
|
|
169
169
|
{
|
|
170
170
|
#owner;
|
|
171
|
-
#
|
|
171
|
+
#button;
|
|
172
172
|
#timer;
|
|
173
173
|
|
|
174
174
|
constructor () {
|
|
@@ -179,7 +179,6 @@ class ngFilterPanel extends HTMLElement
|
|
|
179
179
|
connectedCallback() {
|
|
180
180
|
|
|
181
181
|
this.#owner = this.getRootNode().host;
|
|
182
|
-
console.log("========================", this.#owner)
|
|
183
182
|
|
|
184
183
|
const cssPath = this.getRootNode().host.closest("nine-grid").getAttribute("css-path") || "";
|
|
185
184
|
|
|
@@ -218,25 +217,21 @@ class ngFilterPanel extends HTMLElement
|
|
|
218
217
|
</div>
|
|
219
218
|
`;
|
|
220
219
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
//$(this).on("mousedown", e => { e.preventDefault(); e.stopPropagation(); });
|
|
227
|
-
//$(this).on("mousedown", e => { e.stopPropagation(); });
|
|
220
|
+
this.shadowRoot.querySelector("input[type=text]").addEventListener("input", this.#onInput);
|
|
221
|
+
this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change", this.#onSelectAll);
|
|
222
|
+
this.shadowRoot.querySelector("#btnOk").addEventListener("click", this.#onOk);
|
|
223
|
+
this.shadowRoot.querySelector("#btnCancel").addEventListener("click", this.#onCancel);
|
|
228
224
|
};
|
|
229
225
|
|
|
230
226
|
#onOk = (e) => {
|
|
231
227
|
|
|
232
228
|
const grd = this.shadowRoot.querySelector("nine-grid");
|
|
233
229
|
|
|
234
|
-
//ninegrid.j.querySelectorAll(grd).addClass("loading");
|
|
235
|
-
//ninegrid.j.querySelectorAll(this.#target.owner).addClass("loading");
|
|
236
230
|
this.classList.add("loading");
|
|
237
231
|
|
|
238
232
|
setTimeout(() => {
|
|
239
233
|
|
|
234
|
+
/**
|
|
240
235
|
const LVL_IDX = grd.fields.indexOf("LVL");
|
|
241
236
|
const CHK_IDX = grd.fields.indexOf("CHK");
|
|
242
237
|
const COLNM_IDX = grd.fields.indexOf("COLNM");
|
|
@@ -254,36 +249,49 @@ class ngFilterPanel extends HTMLElement
|
|
|
254
249
|
data : [...new Set(grd.data.getValidData().filter(m => { return m.v[CHK_IDX] == "Y" && m.v[COLNM_IDX] == v; }).map(m => { return m.v[DATA_IDX] || ''; }))].sort((a,b) => { return a > b ? 1 : -1; }),
|
|
255
250
|
});
|
|
256
251
|
});
|
|
257
|
-
}
|
|
252
|
+
} */
|
|
253
|
+
const [LVL_IDX, CHK_IDX, COLNM_IDX, DATA_IDX] = ["LVL", "CHK", "COLNM", "DATA"].map(k => grd.fields.indexOf(k));
|
|
254
|
+
const checked = grd.data.getValidDataNF().filter(m => m.v[LVL_IDX] === 2 && m.v[CHK_IDX] === "Y");
|
|
255
|
+
const filterOptions = checked.length > 0 ? [...new Set(checked.map(m => m.v[COLNM_IDX]))].map(v => ({
|
|
256
|
+
colnm: v,
|
|
257
|
+
data: [...new Set(grd.data.getValidData().filter(m => m.v[CHK_IDX] === "Y" && m.v[COLNM_IDX] === v).map(m => m.v[DATA_IDX] || ''))].sort()
|
|
258
|
+
})) : [];
|
|
258
259
|
|
|
259
|
-
//console.log(filterOptions);
|
|
260
|
-
//console.log(this.#target, this.#target.button, filterOptions)
|
|
261
260
|
|
|
262
|
-
this.#
|
|
261
|
+
this.#button.filterOptions = filterOptions;
|
|
263
262
|
|
|
263
|
+
/**
|
|
264
264
|
var oParam = {};
|
|
265
265
|
|
|
266
|
-
this.#
|
|
266
|
+
this.#owner.body.querySelectorAll("ng-filter-button").forEach(el => {
|
|
267
267
|
|
|
268
268
|
//if (!el.filterOptions) return true;
|
|
269
269
|
|
|
270
270
|
el.filterOptions.forEach(filterOptions => {
|
|
271
271
|
if (filterOptions.data.length > 0) oParam[filterOptions.colnm] = filterOptions.data;
|
|
272
272
|
});
|
|
273
|
-
});
|
|
273
|
+
}); */
|
|
274
|
+
|
|
275
|
+
const oParam = Object.fromEntries(
|
|
276
|
+
[...this.#owner.body.querySelectorAll("ng-filter-button")]
|
|
277
|
+
.flatMap(el => el.filterOptions)
|
|
278
|
+
.filter(opt => opt.data.length > 0)
|
|
279
|
+
.map(opt => [opt.colnm, opt.data])
|
|
280
|
+
);
|
|
274
281
|
|
|
275
|
-
this.#
|
|
276
|
-
|
|
282
|
+
this.#owner.filtering.set(oParam);
|
|
277
283
|
this.classList.remove("loading");
|
|
278
284
|
});
|
|
279
285
|
|
|
280
|
-
|
|
286
|
+
//$(this).hide();
|
|
287
|
+
this.style.display = 'none';
|
|
281
288
|
};
|
|
282
289
|
|
|
283
290
|
|
|
284
291
|
|
|
285
292
|
#onCancel = (e) => {
|
|
286
|
-
|
|
293
|
+
//$(this).hide();
|
|
294
|
+
this.style.display = 'none';
|
|
287
295
|
};
|
|
288
296
|
|
|
289
297
|
#onSelectAll = (e) => {
|
|
@@ -336,13 +344,13 @@ class ngFilterPanel extends HTMLElement
|
|
|
336
344
|
|
|
337
345
|
open = (filterButton) => {
|
|
338
346
|
|
|
339
|
-
const owner = this.shadow.closest("nine-grid");
|
|
347
|
+
//const owner = this.shadow.closest("nine-grid");
|
|
340
348
|
|
|
341
349
|
/** 위치 */
|
|
342
350
|
const cell = filterButton.closest("th,td");
|
|
343
351
|
|
|
344
352
|
const filterButtonRect = filterButton.getBoundingClientRect();
|
|
345
|
-
const ownerRect = owner.getBoundingClientRect();
|
|
353
|
+
const ownerRect = this.#owner.getBoundingClientRect();
|
|
346
354
|
const cellRect = cell.getBoundingClientRect();
|
|
347
355
|
const targetRect = this.getBoundingClientRect();
|
|
348
356
|
|
|
@@ -362,12 +370,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
362
370
|
var col = filterButton.closest('th,td').dataset.col;
|
|
363
371
|
this.col = col;
|
|
364
372
|
|
|
365
|
-
this.#
|
|
366
|
-
owner : owner,
|
|
367
|
-
button : filterButton,
|
|
368
|
-
uuid : owner.uuid,
|
|
369
|
-
col : col,
|
|
370
|
-
}
|
|
373
|
+
this.#button = filterButton;
|
|
371
374
|
|
|
372
375
|
this.style.display = 'flex';
|
|
373
376
|
this.classList.add("loading");
|
|
@@ -381,7 +384,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
381
384
|
setTimeout(() => {
|
|
382
385
|
|
|
383
386
|
|
|
384
|
-
let data = owner.data.getValidDataNF();
|
|
387
|
+
let data = this.#owner.data.getValidDataNF();
|
|
385
388
|
|
|
386
389
|
var ds = [];
|
|
387
390
|
filterButton.filterOptions.forEach((filterOption,i) => {
|
|
@@ -393,22 +396,22 @@ class ngFilterPanel extends HTMLElement
|
|
|
393
396
|
});
|
|
394
397
|
|
|
395
398
|
/**
|
|
396
|
-
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
|
|
399
|
+
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, this.#owner.template);
|
|
397
400
|
var expr = cell.attr("data-expr");
|
|
398
|
-
var exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
401
|
+
var exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
399
402
|
*/
|
|
400
403
|
|
|
401
|
-
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
|
|
404
|
+
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, this.#owner.tmpl).elem();
|
|
402
405
|
const expr = cell.getAttribute("data-expr");
|
|
403
|
-
const exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
406
|
+
const exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
404
407
|
|
|
405
408
|
var data2 = [];
|
|
406
409
|
for (var rowData of data) {
|
|
407
|
-
var idx = owner.fields.indexOf(filterOption.colnm);
|
|
410
|
+
var idx = this.#owner.fields.indexOf(filterOption.colnm);
|
|
408
411
|
|
|
409
412
|
if (expr) {
|
|
410
|
-
var o = owner.data.conv(rowData);
|
|
411
|
-
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
|
|
413
|
+
var o = this.#owner.data.conv(rowData);
|
|
414
|
+
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, this.#owner.data)});
|
|
412
415
|
}
|
|
413
416
|
else {
|
|
414
417
|
data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
|
package/package.json
CHANGED
package/src/etc/ngFiltering.js
CHANGED
|
@@ -168,7 +168,7 @@ class ngFilterButton extends HTMLElement
|
|
|
168
168
|
class ngFilterPanel extends HTMLElement
|
|
169
169
|
{
|
|
170
170
|
#owner;
|
|
171
|
-
#
|
|
171
|
+
#button;
|
|
172
172
|
#timer;
|
|
173
173
|
|
|
174
174
|
constructor () {
|
|
@@ -179,7 +179,6 @@ class ngFilterPanel extends HTMLElement
|
|
|
179
179
|
connectedCallback() {
|
|
180
180
|
|
|
181
181
|
this.#owner = this.getRootNode().host;
|
|
182
|
-
console.log("========================", this.#owner)
|
|
183
182
|
|
|
184
183
|
const cssPath = this.getRootNode().host.closest("nine-grid").getAttribute("css-path") || "";
|
|
185
184
|
|
|
@@ -218,25 +217,21 @@ class ngFilterPanel extends HTMLElement
|
|
|
218
217
|
</div>
|
|
219
218
|
`;
|
|
220
219
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
//$(this).on("mousedown", e => { e.preventDefault(); e.stopPropagation(); });
|
|
227
|
-
//$(this).on("mousedown", e => { e.stopPropagation(); });
|
|
220
|
+
this.shadowRoot.querySelector("input[type=text]").addEventListener("input", this.#onInput);
|
|
221
|
+
this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change", this.#onSelectAll);
|
|
222
|
+
this.shadowRoot.querySelector("#btnOk").addEventListener("click", this.#onOk);
|
|
223
|
+
this.shadowRoot.querySelector("#btnCancel").addEventListener("click", this.#onCancel);
|
|
228
224
|
};
|
|
229
225
|
|
|
230
226
|
#onOk = (e) => {
|
|
231
227
|
|
|
232
228
|
const grd = this.shadowRoot.querySelector("nine-grid");
|
|
233
229
|
|
|
234
|
-
//ninegrid.j.querySelectorAll(grd).addClass("loading");
|
|
235
|
-
//ninegrid.j.querySelectorAll(this.#target.owner).addClass("loading");
|
|
236
230
|
this.classList.add("loading");
|
|
237
231
|
|
|
238
232
|
setTimeout(() => {
|
|
239
233
|
|
|
234
|
+
/**
|
|
240
235
|
const LVL_IDX = grd.fields.indexOf("LVL");
|
|
241
236
|
const CHK_IDX = grd.fields.indexOf("CHK");
|
|
242
237
|
const COLNM_IDX = grd.fields.indexOf("COLNM");
|
|
@@ -254,36 +249,49 @@ class ngFilterPanel extends HTMLElement
|
|
|
254
249
|
data : [...new Set(grd.data.getValidData().filter(m => { return m.v[CHK_IDX] == "Y" && m.v[COLNM_IDX] == v; }).map(m => { return m.v[DATA_IDX] || ''; }))].sort((a,b) => { return a > b ? 1 : -1; }),
|
|
255
250
|
});
|
|
256
251
|
});
|
|
257
|
-
}
|
|
252
|
+
} */
|
|
253
|
+
const [LVL_IDX, CHK_IDX, COLNM_IDX, DATA_IDX] = ["LVL", "CHK", "COLNM", "DATA"].map(k => grd.fields.indexOf(k));
|
|
254
|
+
const checked = grd.data.getValidDataNF().filter(m => m.v[LVL_IDX] === 2 && m.v[CHK_IDX] === "Y");
|
|
255
|
+
const filterOptions = checked.length > 0 ? [...new Set(checked.map(m => m.v[COLNM_IDX]))].map(v => ({
|
|
256
|
+
colnm: v,
|
|
257
|
+
data: [...new Set(grd.data.getValidData().filter(m => m.v[CHK_IDX] === "Y" && m.v[COLNM_IDX] === v).map(m => m.v[DATA_IDX] || ''))].sort()
|
|
258
|
+
})) : [];
|
|
258
259
|
|
|
259
|
-
//console.log(filterOptions);
|
|
260
|
-
//console.log(this.#target, this.#target.button, filterOptions)
|
|
261
260
|
|
|
262
|
-
this.#
|
|
261
|
+
this.#button.filterOptions = filterOptions;
|
|
263
262
|
|
|
263
|
+
/**
|
|
264
264
|
var oParam = {};
|
|
265
265
|
|
|
266
|
-
this.#
|
|
266
|
+
this.#owner.body.querySelectorAll("ng-filter-button").forEach(el => {
|
|
267
267
|
|
|
268
268
|
//if (!el.filterOptions) return true;
|
|
269
269
|
|
|
270
270
|
el.filterOptions.forEach(filterOptions => {
|
|
271
271
|
if (filterOptions.data.length > 0) oParam[filterOptions.colnm] = filterOptions.data;
|
|
272
272
|
});
|
|
273
|
-
});
|
|
273
|
+
}); */
|
|
274
|
+
|
|
275
|
+
const oParam = Object.fromEntries(
|
|
276
|
+
[...this.#owner.body.querySelectorAll("ng-filter-button")]
|
|
277
|
+
.flatMap(el => el.filterOptions)
|
|
278
|
+
.filter(opt => opt.data.length > 0)
|
|
279
|
+
.map(opt => [opt.colnm, opt.data])
|
|
280
|
+
);
|
|
274
281
|
|
|
275
|
-
this.#
|
|
276
|
-
|
|
282
|
+
this.#owner.filtering.set(oParam);
|
|
277
283
|
this.classList.remove("loading");
|
|
278
284
|
});
|
|
279
285
|
|
|
280
|
-
|
|
286
|
+
//$(this).hide();
|
|
287
|
+
this.style.display = 'none';
|
|
281
288
|
};
|
|
282
289
|
|
|
283
290
|
|
|
284
291
|
|
|
285
292
|
#onCancel = (e) => {
|
|
286
|
-
|
|
293
|
+
//$(this).hide();
|
|
294
|
+
this.style.display = 'none';
|
|
287
295
|
};
|
|
288
296
|
|
|
289
297
|
#onSelectAll = (e) => {
|
|
@@ -336,13 +344,13 @@ class ngFilterPanel extends HTMLElement
|
|
|
336
344
|
|
|
337
345
|
open = (filterButton) => {
|
|
338
346
|
|
|
339
|
-
const owner = this.shadow.closest("nine-grid");
|
|
347
|
+
//const owner = this.shadow.closest("nine-grid");
|
|
340
348
|
|
|
341
349
|
/** 위치 */
|
|
342
350
|
const cell = filterButton.closest("th,td");
|
|
343
351
|
|
|
344
352
|
const filterButtonRect = filterButton.getBoundingClientRect();
|
|
345
|
-
const ownerRect = owner.getBoundingClientRect();
|
|
353
|
+
const ownerRect = this.#owner.getBoundingClientRect();
|
|
346
354
|
const cellRect = cell.getBoundingClientRect();
|
|
347
355
|
const targetRect = this.getBoundingClientRect();
|
|
348
356
|
|
|
@@ -362,12 +370,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
362
370
|
var col = filterButton.closest('th,td').dataset.col;
|
|
363
371
|
this.col = col;
|
|
364
372
|
|
|
365
|
-
this.#
|
|
366
|
-
owner : owner,
|
|
367
|
-
button : filterButton,
|
|
368
|
-
uuid : owner.uuid,
|
|
369
|
-
col : col,
|
|
370
|
-
}
|
|
373
|
+
this.#button = filterButton;
|
|
371
374
|
|
|
372
375
|
this.style.display = 'flex';
|
|
373
376
|
this.classList.add("loading");
|
|
@@ -381,7 +384,7 @@ class ngFilterPanel extends HTMLElement
|
|
|
381
384
|
setTimeout(() => {
|
|
382
385
|
|
|
383
386
|
|
|
384
|
-
let data = owner.data.getValidDataNF();
|
|
387
|
+
let data = this.#owner.data.getValidDataNF();
|
|
385
388
|
|
|
386
389
|
var ds = [];
|
|
387
390
|
filterButton.filterOptions.forEach((filterOption,i) => {
|
|
@@ -393,22 +396,22 @@ class ngFilterPanel extends HTMLElement
|
|
|
393
396
|
});
|
|
394
397
|
|
|
395
398
|
/**
|
|
396
|
-
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, owner.template);
|
|
399
|
+
var cell = $(`[data-col=${col}][data-bind=${filterOption.colnm}]`, this.#owner.template);
|
|
397
400
|
var expr = cell.attr("data-expr");
|
|
398
|
-
var exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
401
|
+
var exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
399
402
|
*/
|
|
400
403
|
|
|
401
|
-
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, owner.tmpl).elem();
|
|
404
|
+
const cell = ninegrid.j.querySelectorAll(`[data-col="${col}"][data-bind="${filterOption.colnm}"]`, this.#owner.tmpl).elem();
|
|
402
405
|
const expr = cell.getAttribute("data-expr");
|
|
403
|
-
const exprFunc = (expr) ? owner.exprFunction(expr) : null;
|
|
406
|
+
const exprFunc = (expr) ? this.#owner.exprFunction(expr) : null;
|
|
404
407
|
|
|
405
408
|
var data2 = [];
|
|
406
409
|
for (var rowData of data) {
|
|
407
|
-
var idx = owner.fields.indexOf(filterOption.colnm);
|
|
410
|
+
var idx = this.#owner.fields.indexOf(filterOption.colnm);
|
|
408
411
|
|
|
409
412
|
if (expr) {
|
|
410
|
-
var o = owner.data.conv(rowData);
|
|
411
|
-
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, owner.data)});
|
|
413
|
+
var o = this.#owner.data.conv(rowData);
|
|
414
|
+
data2.push({v:o[filterOption.colnm],v2:exprFunc(o, rowData.__ng.rowidx, this.#owner.data)});
|
|
412
415
|
}
|
|
413
416
|
else {
|
|
414
417
|
data2.push({v:rowData.v[idx],v2:rowData.v[idx]});
|