ninegrid2 6.232.0 → 6.234.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.
@@ -16138,115 +16138,6 @@ class ngData
16138
16138
  }
16139
16139
 
16140
16140
 
16141
- /**
16142
- * { "key1": [1,2,...], "key2": [1,2,...], ... }
16143
- */
16144
- setFilter = (oFilter) => {
16145
-
16146
- this.#owner.filtering.on();
16147
-
16148
-
16149
- let jsonFilter = {};
16150
- if (Array.isArray(oFilter)) {
16151
-
16152
- for (let key in oFilter[0]) {
16153
- //console.log(`::::::${key}::::::`)
16154
- //key = key.trim();
16155
- //console.log(key);
16156
- jsonFilter[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
16157
- }
16158
- }
16159
- else {
16160
- jsonFilter = oFilter;
16161
- }
16162
-
16163
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
16164
-
16165
- //let filterData = [];
16166
-
16167
- console.log("==================", jsonFilter);
16168
-
16169
- this.clearFilter();
16170
-
16171
- for (let key in jsonFilter) {
16172
- const arr = jsonFilter[key];
16173
- const idx = this.#parent.owner.fields.indexOf(key);
16174
-
16175
- let isNum = false;
16176
- for (let o of this.getValidData()) {
16177
- if (o.v[idx] == null) continue;
16178
-
16179
- //console.log(o.v[idx], typeof o.v[idx])
16180
-
16181
- isNum = (typeof o.v[idx] === "number") ? true : false;
16182
-
16183
- break;
16184
- }
16185
-
16186
- if (isNum) {
16187
- for (var i = 0; i < arr.length; i++) {
16188
- arr[i] = Number(arr[i]);
16189
- }
16190
- }
16191
-
16192
- /** filtering button 용 데이타 */
16193
- /**
16194
- filterData.push({
16195
- "colnm" : key,
16196
- "data" : arr,
16197
- }); */
16198
- //console.log(arr);
16199
-
16200
-
16201
- //console.log(arr, idx, arr.nineBinarySearch(m.v[idx]));
16202
-
16203
- this.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
16204
-
16205
-
16206
- //break;
16207
-
16208
-
16209
- }
16210
-
16211
-
16212
- this.refreshFilter();
16213
-
16214
- var colnms = [];
16215
- for (let key in jsonFilter) {
16216
- colnms.push(key);
16217
- }
16218
- //var colnms = filterData.map(item => item.colnm);
16219
-
16220
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
16221
- v.filterData = null;
16222
- });
16223
-
16224
- for (let key in jsonFilter) {
16225
- const arr = jsonFilter[key];
16226
- this.#parent.owner.fields.indexOf(key);
16227
-
16228
- //console.log(filterData);
16229
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
16230
- //v.filterData = null;
16231
- //console.log(v);
16232
- //var b = v.colnms;
16233
- v.colnms.forEach(colnm => {
16234
-
16235
- console.log(colnms, colnm);
16236
- if (colnms.includes(colnm)) {
16237
- console.log("==================");
16238
-
16239
- v.filterData = arr;
16240
- }
16241
- });
16242
- });
16243
- }
16244
-
16245
-
16246
- this.#parent.owner.scrollTo_V1(0);
16247
-
16248
- this.#parent.owner.paging.reset();
16249
- };
16250
16141
 
16251
16142
  /**
16252
16143
  *
@@ -17944,12 +17835,14 @@ class ngFiltering
17944
17835
  #owner;
17945
17836
  #isFiltering;
17946
17837
 
17947
- constructor (owner) {
17948
- this.#owner = owner;
17949
- this.#isFiltering = false;
17838
+ constructor(owner) {
17839
+ this.#owner = owner;
17840
+ this.#isFiltering = false;
17950
17841
 
17951
- $(this.#owner.shadowRoot).append($('<ng-filter-panel></ng-filter-panel>').hide());
17952
- }
17842
+ const filterPanel = document.createElement("ng-filter-panel"); // ✅ 필터 패널 생성
17843
+ filterPanel.style.display = "none"; // ✅ 숨김 처리
17844
+ this.#owner.shadowRoot.appendChild(filterPanel); // ✅ Shadow DOM 내부에 추가
17845
+ }
17953
17846
 
17954
17847
  initialize = () => {
17955
17848
  /**
@@ -17957,8 +17850,6 @@ class ngFiltering
17957
17850
  */
17958
17851
  this.#isFiltering = false;
17959
17852
  this.#owner.data.clearFilter();
17960
-
17961
- //this.#on();
17962
17853
  };
17963
17854
 
17964
17855
  isFiltering = () => {
@@ -17977,8 +17868,8 @@ class ngFiltering
17977
17868
  .map(el => el.dataset.bind ? { colnm: el.dataset.bind, data: [] } : null)
17978
17869
  .filter(Boolean); // ✅ `null` 제거
17979
17870
 
17980
- td.querySelector("ng-filter-button")?.remove();
17981
17871
  if (options.length > 0) {
17872
+ td.querySelector("ng-filter-button")?.remove();
17982
17873
 
17983
17874
  const filterButton = document.createElement("ng-filter-button");
17984
17875
  td.appendChild(filterButton);
@@ -18006,6 +17897,7 @@ class ngFiltering
18006
17897
 
18007
17898
  this.on();
18008
17899
 
17900
+ /**
18009
17901
  let jsonFilter = {};
18010
17902
  if (Array.isArray(oFilter)) {
18011
17903
  for (let key in oFilter[0]) {
@@ -18015,12 +17907,13 @@ class ngFiltering
18015
17907
  else {
18016
17908
  jsonFilter = oFilter;
18017
17909
  }
18018
-
18019
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
17910
+ */
18020
17911
 
18021
- //let filterData = [];
18022
-
18023
- console.log("==================", jsonFilter);
17912
+ let jsonFilter = Array.isArray(oFilter)
17913
+ ? Object.fromEntries(Object.keys(oFilter[0]).map(key => [key, [...new Set(oFilter.map(item => item[key]))]]))
17914
+ : oFilter;
17915
+
17916
+ console.log(oFilter, jsonFilter);
18024
17917
 
18025
17918
  this.#owner.data.clearFilter();
18026
17919
 
@@ -18032,8 +17925,6 @@ class ngFiltering
18032
17925
  for (let o of this.#owner.data.getValidData()) {
18033
17926
  if (o.v[idx] == null) continue;
18034
17927
 
18035
- //console.log(o.v[idx], typeof o.v[idx])
18036
-
18037
17928
  isNum = (typeof o.v[idx] === "number") ? true : false;
18038
17929
 
18039
17930
  break;
@@ -18090,82 +17981,12 @@ class ngFiltering
18090
17981
 
18091
17982
  return index;
18092
17983
  };
18093
-
18094
-
18095
-
18096
-
18097
-
18098
- #init = (option) => {
18099
-
18100
- let jsonOption = {};
18101
- if (Array.isArray(option)) {
18102
- for (let key in option[0]) {
18103
- jsonOption[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
18104
- }
18105
- }
18106
- else {
18107
- jsonOption = option;
18108
- }
18109
-
18110
- this.#owner.data.clearFilter();
18111
-
18112
- for (let key in jsonOption) {
18113
- const arr = jsonOption[key];
18114
- const idx = this.#owner.fields.indexOf(key);
18115
-
18116
- for (let o of this.#owner.data.getValidData()) {
18117
- if (o.v[idx] != null) {
18118
- if (typeof o.v[idx] === "number") {
18119
- for (var i = 0; i < arr.length; i++) {
18120
- arr[i] = Number(arr[i]);
18121
- }
18122
- }
18123
- break;
18124
- }
18125
- }
18126
-
18127
- this.#owner.data.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
18128
- }
18129
-
18130
-
18131
- this.#owner.data.refreshFilter();
18132
-
18133
- var colnms = [];
18134
- for (let key in jsonOption) {
18135
- colnms.push(key);
18136
- }
18137
- //var colnms = filterData.map(item => item.colnm);
18138
-
18139
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
18140
- v.filterData = null;
18141
- });
18142
-
18143
- for (let key in jsonOption) {
18144
- const arr = jsonOption[key];
18145
-
18146
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
18147
- //console.log(v.colnms);
18148
-
18149
- v.colnms.forEach(colnm => {
18150
- if (colnms.includes(colnm)) {
18151
- v.filterData = arr;
18152
- }
18153
- });
18154
- });
18155
- }
18156
-
18157
-
18158
- this.#owner.scrollTo_V1(0);
18159
-
18160
- this.#owner.paging.reset();
18161
- };
18162
17984
  }
18163
17985
 
18164
17986
  class ngFilterButton extends HTMLElement
18165
17987
  {
18166
17988
  #owner;
18167
17989
  #filterOptions;
18168
- #colnms;
18169
17990
 
18170
17991
  constructor () {
18171
17992
  super();
@@ -18174,15 +17995,8 @@ class ngFilterButton extends HTMLElement
18174
17995
  connectedCallback() {
18175
17996
  this.#owner = this.getRootNode().host;//this.closest("nine-grid");
18176
17997
 
18177
- $(this).off("click", this.#onClick);
18178
- $(this).on("click", this.#onClick);
18179
- };
18180
-
18181
- get colnms() {
18182
- return this.#colnms || [];
18183
- };
18184
- set colnms(v) {
18185
- this.#colnms = v;
17998
+ this.removeEventListener("click", this.#onClick);
17999
+ this.addEventListener("click", this.#onClick);
18186
18000
  };
18187
18001
 
18188
18002
  get filterOptions() {
@@ -18199,32 +18013,8 @@ class ngFilterButton extends HTMLElement
18199
18013
  e.stopPropagation();
18200
18014
 
18201
18015
  const panel = this.#owner.shadowRoot.querySelector('ng-filter-panel');
18202
-
18203
- //console.log(panel.isHidden);
18204
-
18205
- //panel.style.display = 'flex' : 'none';
18206
- //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18207
-
18208
- if (panel.col === this.closest('th,td').dataset.col) {
18209
- panel.close();
18210
- }
18211
- else {
18212
- /**
18213
- var cell = e.target.closest("th,td");
18214
-
18215
- var l = $(e.target).offset().left - $(this.#owner).offset().left;// - $(panel).width() + $(e.target).width() + 1;
18216
- if (l < 0) l = 0;
18217
- if (l + $(panel).width() > $(this.#owner).width()) l = $(this.#owner).width() - $(panel).width() - 5;
18218
-
18219
-
18220
-
18221
- var t = $(cell).offset().top + $(cell).height()- $(this.#owner).offset().top;//$(e.target).offset().top + $(e.target).height() + 2;
18222
-
18223
- //$(panel).offset({left: l, top: t});
18224
- $(panel).css({left: l, top: t});
18225
- */
18226
- panel.open(this);
18227
- }
18016
+
18017
+ (panel.col === this.closest('th,td').dataset.col) ? panel.close() : panel.open(this);
18228
18018
  };
18229
18019
  }
18230
18020
 
@@ -16136,115 +16136,6 @@ class ngData
16136
16136
  }
16137
16137
 
16138
16138
 
16139
- /**
16140
- * { "key1": [1,2,...], "key2": [1,2,...], ... }
16141
- */
16142
- setFilter = (oFilter) => {
16143
-
16144
- this.#owner.filtering.on();
16145
-
16146
-
16147
- let jsonFilter = {};
16148
- if (Array.isArray(oFilter)) {
16149
-
16150
- for (let key in oFilter[0]) {
16151
- //console.log(`::::::${key}::::::`)
16152
- //key = key.trim();
16153
- //console.log(key);
16154
- jsonFilter[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
16155
- }
16156
- }
16157
- else {
16158
- jsonFilter = oFilter;
16159
- }
16160
-
16161
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
16162
-
16163
- //let filterData = [];
16164
-
16165
- console.log("==================", jsonFilter);
16166
-
16167
- this.clearFilter();
16168
-
16169
- for (let key in jsonFilter) {
16170
- const arr = jsonFilter[key];
16171
- const idx = this.#parent.owner.fields.indexOf(key);
16172
-
16173
- let isNum = false;
16174
- for (let o of this.getValidData()) {
16175
- if (o.v[idx] == null) continue;
16176
-
16177
- //console.log(o.v[idx], typeof o.v[idx])
16178
-
16179
- isNum = (typeof o.v[idx] === "number") ? true : false;
16180
-
16181
- break;
16182
- }
16183
-
16184
- if (isNum) {
16185
- for (var i = 0; i < arr.length; i++) {
16186
- arr[i] = Number(arr[i]);
16187
- }
16188
- }
16189
-
16190
- /** filtering button 용 데이타 */
16191
- /**
16192
- filterData.push({
16193
- "colnm" : key,
16194
- "data" : arr,
16195
- }); */
16196
- //console.log(arr);
16197
-
16198
-
16199
- //console.log(arr, idx, arr.nineBinarySearch(m.v[idx]));
16200
-
16201
- this.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
16202
-
16203
-
16204
- //break;
16205
-
16206
-
16207
- }
16208
-
16209
-
16210
- this.refreshFilter();
16211
-
16212
- var colnms = [];
16213
- for (let key in jsonFilter) {
16214
- colnms.push(key);
16215
- }
16216
- //var colnms = filterData.map(item => item.colnm);
16217
-
16218
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
16219
- v.filterData = null;
16220
- });
16221
-
16222
- for (let key in jsonFilter) {
16223
- const arr = jsonFilter[key];
16224
- this.#parent.owner.fields.indexOf(key);
16225
-
16226
- //console.log(filterData);
16227
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
16228
- //v.filterData = null;
16229
- //console.log(v);
16230
- //var b = v.colnms;
16231
- v.colnms.forEach(colnm => {
16232
-
16233
- console.log(colnms, colnm);
16234
- if (colnms.includes(colnm)) {
16235
- console.log("==================");
16236
-
16237
- v.filterData = arr;
16238
- }
16239
- });
16240
- });
16241
- }
16242
-
16243
-
16244
- this.#parent.owner.scrollTo_V1(0);
16245
-
16246
- this.#parent.owner.paging.reset();
16247
- };
16248
16139
 
16249
16140
  /**
16250
16141
  *
@@ -17942,12 +17833,14 @@ class ngFiltering
17942
17833
  #owner;
17943
17834
  #isFiltering;
17944
17835
 
17945
- constructor (owner) {
17946
- this.#owner = owner;
17947
- this.#isFiltering = false;
17836
+ constructor(owner) {
17837
+ this.#owner = owner;
17838
+ this.#isFiltering = false;
17948
17839
 
17949
- $(this.#owner.shadowRoot).append($('<ng-filter-panel></ng-filter-panel>').hide());
17950
- }
17840
+ const filterPanel = document.createElement("ng-filter-panel"); // ✅ 필터 패널 생성
17841
+ filterPanel.style.display = "none"; // ✅ 숨김 처리
17842
+ this.#owner.shadowRoot.appendChild(filterPanel); // ✅ Shadow DOM 내부에 추가
17843
+ }
17951
17844
 
17952
17845
  initialize = () => {
17953
17846
  /**
@@ -17955,8 +17848,6 @@ class ngFiltering
17955
17848
  */
17956
17849
  this.#isFiltering = false;
17957
17850
  this.#owner.data.clearFilter();
17958
-
17959
- //this.#on();
17960
17851
  };
17961
17852
 
17962
17853
  isFiltering = () => {
@@ -17975,8 +17866,8 @@ class ngFiltering
17975
17866
  .map(el => el.dataset.bind ? { colnm: el.dataset.bind, data: [] } : null)
17976
17867
  .filter(Boolean); // ✅ `null` 제거
17977
17868
 
17978
- td.querySelector("ng-filter-button")?.remove();
17979
17869
  if (options.length > 0) {
17870
+ td.querySelector("ng-filter-button")?.remove();
17980
17871
 
17981
17872
  const filterButton = document.createElement("ng-filter-button");
17982
17873
  td.appendChild(filterButton);
@@ -18004,6 +17895,7 @@ class ngFiltering
18004
17895
 
18005
17896
  this.on();
18006
17897
 
17898
+ /**
18007
17899
  let jsonFilter = {};
18008
17900
  if (Array.isArray(oFilter)) {
18009
17901
  for (let key in oFilter[0]) {
@@ -18013,12 +17905,13 @@ class ngFiltering
18013
17905
  else {
18014
17906
  jsonFilter = oFilter;
18015
17907
  }
18016
-
18017
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
17908
+ */
18018
17909
 
18019
- //let filterData = [];
18020
-
18021
- console.log("==================", jsonFilter);
17910
+ let jsonFilter = Array.isArray(oFilter)
17911
+ ? Object.fromEntries(Object.keys(oFilter[0]).map(key => [key, [...new Set(oFilter.map(item => item[key]))]]))
17912
+ : oFilter;
17913
+
17914
+ console.log(oFilter, jsonFilter);
18022
17915
 
18023
17916
  this.#owner.data.clearFilter();
18024
17917
 
@@ -18030,8 +17923,6 @@ class ngFiltering
18030
17923
  for (let o of this.#owner.data.getValidData()) {
18031
17924
  if (o.v[idx] == null) continue;
18032
17925
 
18033
- //console.log(o.v[idx], typeof o.v[idx])
18034
-
18035
17926
  isNum = (typeof o.v[idx] === "number") ? true : false;
18036
17927
 
18037
17928
  break;
@@ -18088,82 +17979,12 @@ class ngFiltering
18088
17979
 
18089
17980
  return index;
18090
17981
  };
18091
-
18092
-
18093
-
18094
-
18095
-
18096
- #init = (option) => {
18097
-
18098
- let jsonOption = {};
18099
- if (Array.isArray(option)) {
18100
- for (let key in option[0]) {
18101
- jsonOption[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
18102
- }
18103
- }
18104
- else {
18105
- jsonOption = option;
18106
- }
18107
-
18108
- this.#owner.data.clearFilter();
18109
-
18110
- for (let key in jsonOption) {
18111
- const arr = jsonOption[key];
18112
- const idx = this.#owner.fields.indexOf(key);
18113
-
18114
- for (let o of this.#owner.data.getValidData()) {
18115
- if (o.v[idx] != null) {
18116
- if (typeof o.v[idx] === "number") {
18117
- for (var i = 0; i < arr.length; i++) {
18118
- arr[i] = Number(arr[i]);
18119
- }
18120
- }
18121
- break;
18122
- }
18123
- }
18124
-
18125
- this.#owner.data.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
18126
- }
18127
-
18128
-
18129
- this.#owner.data.refreshFilter();
18130
-
18131
- var colnms = [];
18132
- for (let key in jsonOption) {
18133
- colnms.push(key);
18134
- }
18135
- //var colnms = filterData.map(item => item.colnm);
18136
-
18137
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
18138
- v.filterData = null;
18139
- });
18140
-
18141
- for (let key in jsonOption) {
18142
- const arr = jsonOption[key];
18143
-
18144
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
18145
- //console.log(v.colnms);
18146
-
18147
- v.colnms.forEach(colnm => {
18148
- if (colnms.includes(colnm)) {
18149
- v.filterData = arr;
18150
- }
18151
- });
18152
- });
18153
- }
18154
-
18155
-
18156
- this.#owner.scrollTo_V1(0);
18157
-
18158
- this.#owner.paging.reset();
18159
- };
18160
17982
  }
18161
17983
 
18162
17984
  class ngFilterButton extends HTMLElement
18163
17985
  {
18164
17986
  #owner;
18165
17987
  #filterOptions;
18166
- #colnms;
18167
17988
 
18168
17989
  constructor () {
18169
17990
  super();
@@ -18172,15 +17993,8 @@ class ngFilterButton extends HTMLElement
18172
17993
  connectedCallback() {
18173
17994
  this.#owner = this.getRootNode().host;//this.closest("nine-grid");
18174
17995
 
18175
- $(this).off("click", this.#onClick);
18176
- $(this).on("click", this.#onClick);
18177
- };
18178
-
18179
- get colnms() {
18180
- return this.#colnms || [];
18181
- };
18182
- set colnms(v) {
18183
- this.#colnms = v;
17996
+ this.removeEventListener("click", this.#onClick);
17997
+ this.addEventListener("click", this.#onClick);
18184
17998
  };
18185
17999
 
18186
18000
  get filterOptions() {
@@ -18197,32 +18011,8 @@ class ngFilterButton extends HTMLElement
18197
18011
  e.stopPropagation();
18198
18012
 
18199
18013
  const panel = this.#owner.shadowRoot.querySelector('ng-filter-panel');
18200
-
18201
- //console.log(panel.isHidden);
18202
-
18203
- //panel.style.display = 'flex' : 'none';
18204
- //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
18205
-
18206
- if (panel.col === this.closest('th,td').dataset.col) {
18207
- panel.close();
18208
- }
18209
- else {
18210
- /**
18211
- var cell = e.target.closest("th,td");
18212
-
18213
- var l = $(e.target).offset().left - $(this.#owner).offset().left;// - $(panel).width() + $(e.target).width() + 1;
18214
- if (l < 0) l = 0;
18215
- if (l + $(panel).width() > $(this.#owner).width()) l = $(this.#owner).width() - $(panel).width() - 5;
18216
-
18217
-
18218
-
18219
- var t = $(cell).offset().top + $(cell).height()- $(this.#owner).offset().top;//$(e.target).offset().top + $(e.target).height() + 2;
18220
-
18221
- //$(panel).offset({left: l, top: t});
18222
- $(panel).css({left: l, top: t});
18223
- */
18224
- panel.open(this);
18225
- }
18014
+
18015
+ (panel.col === this.closest('th,td').dataset.col) ? panel.close() : panel.open(this);
18226
18016
  };
18227
18017
  }
18228
18018
 
@@ -219,115 +219,6 @@ export class ngData
219
219
  }
220
220
 
221
221
 
222
- /**
223
- * { "key1": [1,2,...], "key2": [1,2,...], ... }
224
- */
225
- setFilter = (oFilter) => {
226
-
227
- this.#owner.filtering.on();
228
-
229
-
230
- let jsonFilter = {};
231
- if (Array.isArray(oFilter)) {
232
-
233
- for (let key in oFilter[0]) {
234
- //console.log(`::::::${key}::::::`)
235
- //key = key.trim();
236
- //console.log(key);
237
- jsonFilter[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
238
- }
239
- }
240
- else {
241
- jsonFilter = oFilter;
242
- }
243
-
244
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
245
-
246
- //let filterData = [];
247
-
248
- console.log("==================", jsonFilter);
249
-
250
- this.clearFilter();
251
-
252
- for (let key in jsonFilter) {
253
- const arr = jsonFilter[key];
254
- const idx = this.#parent.owner.fields.indexOf(key);
255
-
256
- let isNum = false;
257
- for (let o of this.getValidData()) {
258
- if (o.v[idx] == null) continue;
259
-
260
- //console.log(o.v[idx], typeof o.v[idx])
261
-
262
- isNum = (typeof o.v[idx] === "number") ? true : false;
263
-
264
- break;
265
- }
266
-
267
- if (isNum) {
268
- for (var i = 0; i < arr.length; i++) {
269
- arr[i] = Number(arr[i]);
270
- }
271
- }
272
-
273
- /** filtering button 용 데이타 */
274
- /**
275
- filterData.push({
276
- "colnm" : key,
277
- "data" : arr,
278
- }); */
279
- //console.log(arr);
280
-
281
-
282
- //console.log(arr, idx, arr.nineBinarySearch(m.v[idx]));
283
-
284
- this.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
285
-
286
-
287
- //break;
288
-
289
-
290
- }
291
-
292
-
293
- this.refreshFilter();
294
-
295
- var colnms = [];
296
- for (let key in jsonFilter) {
297
- colnms.push(key);
298
- }
299
- //var colnms = filterData.map(item => item.colnm);
300
-
301
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
302
- v.filterData = null;
303
- });
304
-
305
- for (let key in jsonFilter) {
306
- const arr = jsonFilter[key];
307
- const idx = this.#parent.owner.fields.indexOf(key);
308
-
309
- //console.log(filterData);
310
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
311
- //v.filterData = null;
312
- //console.log(v);
313
- //var b = v.colnms;
314
- v.colnms.forEach(colnm => {
315
-
316
- console.log(colnms, colnm);
317
- if (colnms.includes(colnm)) {
318
- console.log("==================");
319
-
320
- v.filterData = arr;
321
- }
322
- });
323
- });
324
- }
325
-
326
-
327
- this.#parent.owner.scrollTo_V1(0);
328
-
329
- this.#parent.owner.paging.reset();
330
- };
331
222
 
332
223
  /**
333
224
  *
@@ -12,12 +12,14 @@ export class ngFiltering
12
12
  #owner;
13
13
  #isFiltering;
14
14
 
15
- constructor (owner) {
16
- this.#owner = owner;
17
- this.#isFiltering = false;
18
-
19
- $(this.#owner.shadowRoot).append($('<ng-filter-panel></ng-filter-panel>').hide());
20
- }
15
+ constructor(owner) {
16
+ this.#owner = owner;
17
+ this.#isFiltering = false;
18
+
19
+ const filterPanel = document.createElement("ng-filter-panel"); // ✅ 필터 패널 생성
20
+ filterPanel.style.display = "none"; // ✅ 숨김 처리
21
+ this.#owner.shadowRoot.appendChild(filterPanel); // ✅ Shadow DOM 내부에 추가
22
+ }
21
23
 
22
24
  initialize = () => {
23
25
  /**
@@ -25,8 +27,6 @@ export class ngFiltering
25
27
  */
26
28
  this.#isFiltering = false;
27
29
  this.#owner.data.clearFilter();
28
-
29
- //this.#on();
30
30
  };
31
31
 
32
32
  isFiltering = () => {
@@ -45,8 +45,8 @@ export class ngFiltering
45
45
  .map(el => el.dataset.bind ? { colnm: el.dataset.bind, data: [] } : null)
46
46
  .filter(Boolean); // ✅ `null` 제거
47
47
 
48
- td.querySelector("ng-filter-button")?.remove();
49
48
  if (options.length > 0) {
49
+ td.querySelector("ng-filter-button")?.remove();
50
50
 
51
51
  const filterButton = document.createElement("ng-filter-button");
52
52
  td.appendChild(filterButton);
@@ -74,6 +74,7 @@ export class ngFiltering
74
74
 
75
75
  this.on();
76
76
 
77
+ /**
77
78
  let jsonFilter = {};
78
79
  if (Array.isArray(oFilter)) {
79
80
  for (let key in oFilter[0]) {
@@ -83,12 +84,13 @@ export class ngFiltering
83
84
  else {
84
85
  jsonFilter = oFilter;
85
86
  }
86
-
87
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
87
+ */
88
88
 
89
- //let filterData = [];
90
-
91
- console.log("==================", jsonFilter);
89
+ let jsonFilter = Array.isArray(oFilter)
90
+ ? Object.fromEntries(Object.keys(oFilter[0]).map(key => [key, [...new Set(oFilter.map(item => item[key]))]]))
91
+ : oFilter;
92
+
93
+ console.log(oFilter, jsonFilter);
92
94
 
93
95
  this.#owner.data.clearFilter();
94
96
 
@@ -100,8 +102,6 @@ export class ngFiltering
100
102
  for (let o of this.#owner.data.getValidData()) {
101
103
  if (o.v[idx] == null) continue;
102
104
 
103
- //console.log(o.v[idx], typeof o.v[idx])
104
-
105
105
  isNum = (typeof o.v[idx] === "number") ? true : false;
106
106
 
107
107
  break;
@@ -158,82 +158,12 @@ export class ngFiltering
158
158
 
159
159
  return index;
160
160
  };
161
-
162
-
163
-
164
-
165
-
166
- #init = (option) => {
167
-
168
- let jsonOption = {};
169
- if (Array.isArray(option)) {
170
- for (let key in option[0]) {
171
- jsonOption[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
172
- }
173
- }
174
- else {
175
- jsonOption = option;
176
- }
177
-
178
- this.#owner.data.clearFilter();
179
-
180
- for (let key in jsonOption) {
181
- const arr = jsonOption[key];
182
- const idx = this.#owner.fields.indexOf(key);
183
-
184
- for (let o of this.#owner.data.getValidData()) {
185
- if (o.v[idx] != null) {
186
- if (typeof o.v[idx] === "number") {
187
- for (var i = 0; i < arr.length; i++) {
188
- arr[i] = Number(arr[i]);
189
- }
190
- }
191
- break;
192
- }
193
- }
194
-
195
- this.#owner.data.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
196
- }
197
-
198
-
199
- this.#owner.data.refreshFilter();
200
-
201
- var colnms = [];
202
- for (let key in jsonOption) {
203
- colnms.push(key);
204
- }
205
- //var colnms = filterData.map(item => item.colnm);
206
-
207
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
208
- v.filterData = null;
209
- });
210
-
211
- for (let key in jsonOption) {
212
- const arr = jsonOption[key];
213
-
214
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
215
- //console.log(v.colnms);
216
-
217
- v.colnms.forEach(colnm => {
218
- if (colnms.includes(colnm)) {
219
- v.filterData = arr;
220
- }
221
- });
222
- });
223
- }
224
-
225
-
226
- this.#owner.scrollTo_V1(0);
227
-
228
- this.#owner.paging.reset();
229
- };
230
161
  }
231
162
 
232
163
  class ngFilterButton extends HTMLElement
233
164
  {
234
165
  #owner;
235
166
  #filterOptions;
236
- #colnms;
237
167
 
238
168
  constructor () {
239
169
  super();
@@ -242,15 +172,8 @@ class ngFilterButton extends HTMLElement
242
172
  connectedCallback() {
243
173
  this.#owner = this.getRootNode().host;//this.closest("nine-grid");
244
174
 
245
- $(this).off("click", this.#onClick);
246
- $(this).on("click", this.#onClick);
247
- };
248
-
249
- get colnms() {
250
- return this.#colnms || [];
251
- };
252
- set colnms(v) {
253
- this.#colnms = v;
175
+ this.removeEventListener("click", this.#onClick);
176
+ this.addEventListener("click", this.#onClick);
254
177
  };
255
178
 
256
179
  get filterOptions() {
@@ -267,32 +190,8 @@ class ngFilterButton extends HTMLElement
267
190
  e.stopPropagation();
268
191
 
269
192
  const panel = this.#owner.shadowRoot.querySelector('ng-filter-panel');
270
-
271
- //console.log(panel.isHidden);
272
-
273
- //panel.style.display = 'flex' : 'none';
274
- //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
275
-
276
- if (panel.col === this.closest('th,td').dataset.col) {
277
- panel.close();
278
- }
279
- else {
280
- /**
281
- var cell = e.target.closest("th,td");
282
-
283
- var l = $(e.target).offset().left - $(this.#owner).offset().left;// - $(panel).width() + $(e.target).width() + 1;
284
- if (l < 0) l = 0;
285
- if (l + $(panel).width() > $(this.#owner).width()) l = $(this.#owner).width() - $(panel).width() - 5;
286
-
287
-
288
-
289
- var t = $(cell).offset().top + $(cell).height()- $(this.#owner).offset().top;//$(e.target).offset().top + $(e.target).height() + 2;
290
-
291
- //$(panel).offset({left: l, top: t});
292
- $(panel).css({left: l, top: t});
293
- */
294
- panel.open(this);
295
- }
193
+
194
+ (panel.col === this.closest('th,td').dataset.col) ? panel.close() : panel.open(this);
296
195
  };
297
196
  }
298
197
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.232.0",
4
+ "version": "6.234.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
package/src/etc/ngData.js CHANGED
@@ -219,115 +219,6 @@ export class ngData
219
219
  }
220
220
 
221
221
 
222
- /**
223
- * { "key1": [1,2,...], "key2": [1,2,...], ... }
224
- */
225
- setFilter = (oFilter) => {
226
-
227
- this.#owner.filtering.on();
228
-
229
-
230
- let jsonFilter = {};
231
- if (Array.isArray(oFilter)) {
232
-
233
- for (let key in oFilter[0]) {
234
- //console.log(`::::::${key}::::::`)
235
- //key = key.trim();
236
- //console.log(key);
237
- jsonFilter[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
238
- }
239
- }
240
- else {
241
- jsonFilter = oFilter;
242
- }
243
-
244
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
245
-
246
- //let filterData = [];
247
-
248
- console.log("==================", jsonFilter);
249
-
250
- this.clearFilter();
251
-
252
- for (let key in jsonFilter) {
253
- const arr = jsonFilter[key];
254
- const idx = this.#parent.owner.fields.indexOf(key);
255
-
256
- let isNum = false;
257
- for (let o of this.getValidData()) {
258
- if (o.v[idx] == null) continue;
259
-
260
- //console.log(o.v[idx], typeof o.v[idx])
261
-
262
- isNum = (typeof o.v[idx] === "number") ? true : false;
263
-
264
- break;
265
- }
266
-
267
- if (isNum) {
268
- for (var i = 0; i < arr.length; i++) {
269
- arr[i] = Number(arr[i]);
270
- }
271
- }
272
-
273
- /** filtering button 용 데이타 */
274
- /**
275
- filterData.push({
276
- "colnm" : key,
277
- "data" : arr,
278
- }); */
279
- //console.log(arr);
280
-
281
-
282
- //console.log(arr, idx, arr.nineBinarySearch(m.v[idx]));
283
-
284
- this.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
285
-
286
-
287
- //break;
288
-
289
-
290
- }
291
-
292
-
293
- this.refreshFilter();
294
-
295
- var colnms = [];
296
- for (let key in jsonFilter) {
297
- colnms.push(key);
298
- }
299
- //var colnms = filterData.map(item => item.colnm);
300
-
301
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
302
- v.filterData = null;
303
- });
304
-
305
- for (let key in jsonFilter) {
306
- const arr = jsonFilter[key];
307
- const idx = this.#parent.owner.fields.indexOf(key);
308
-
309
- //console.log(filterData);
310
- ninegrid.querySelectorAll("ng-filter-button").forEach(v => {
311
- //v.filterData = null;
312
- //console.log(v);
313
- //var b = v.colnms;
314
- v.colnms.forEach(colnm => {
315
-
316
- console.log(colnms, colnm);
317
- if (colnms.includes(colnm)) {
318
- console.log("==================");
319
-
320
- v.filterData = arr;
321
- }
322
- });
323
- });
324
- }
325
-
326
-
327
- this.#parent.owner.scrollTo_V1(0);
328
-
329
- this.#parent.owner.paging.reset();
330
- };
331
222
 
332
223
  /**
333
224
  *
@@ -12,12 +12,14 @@ export class ngFiltering
12
12
  #owner;
13
13
  #isFiltering;
14
14
 
15
- constructor (owner) {
16
- this.#owner = owner;
17
- this.#isFiltering = false;
18
-
19
- $(this.#owner.shadowRoot).append($('<ng-filter-panel></ng-filter-panel>').hide());
20
- }
15
+ constructor(owner) {
16
+ this.#owner = owner;
17
+ this.#isFiltering = false;
18
+
19
+ const filterPanel = document.createElement("ng-filter-panel"); // ✅ 필터 패널 생성
20
+ filterPanel.style.display = "none"; // ✅ 숨김 처리
21
+ this.#owner.shadowRoot.appendChild(filterPanel); // ✅ Shadow DOM 내부에 추가
22
+ }
21
23
 
22
24
  initialize = () => {
23
25
  /**
@@ -25,8 +27,6 @@ export class ngFiltering
25
27
  */
26
28
  this.#isFiltering = false;
27
29
  this.#owner.data.clearFilter();
28
-
29
- //this.#on();
30
30
  };
31
31
 
32
32
  isFiltering = () => {
@@ -45,8 +45,8 @@ export class ngFiltering
45
45
  .map(el => el.dataset.bind ? { colnm: el.dataset.bind, data: [] } : null)
46
46
  .filter(Boolean); // ✅ `null` 제거
47
47
 
48
- td.querySelector("ng-filter-button")?.remove();
49
48
  if (options.length > 0) {
49
+ td.querySelector("ng-filter-button")?.remove();
50
50
 
51
51
  const filterButton = document.createElement("ng-filter-button");
52
52
  td.appendChild(filterButton);
@@ -74,6 +74,7 @@ export class ngFiltering
74
74
 
75
75
  this.on();
76
76
 
77
+ /**
77
78
  let jsonFilter = {};
78
79
  if (Array.isArray(oFilter)) {
79
80
  for (let key in oFilter[0]) {
@@ -83,12 +84,13 @@ export class ngFiltering
83
84
  else {
84
85
  jsonFilter = oFilter;
85
86
  }
86
-
87
- //jsonFilter.doc_id = [2, 18, 20, 28, 36, 45, 46, 48, 56, 64, 73, 81, 83, 90];
87
+ */
88
88
 
89
- //let filterData = [];
90
-
91
- console.log("==================", jsonFilter);
89
+ let jsonFilter = Array.isArray(oFilter)
90
+ ? Object.fromEntries(Object.keys(oFilter[0]).map(key => [key, [...new Set(oFilter.map(item => item[key]))]]))
91
+ : oFilter;
92
+
93
+ console.log(oFilter, jsonFilter);
92
94
 
93
95
  this.#owner.data.clearFilter();
94
96
 
@@ -100,8 +102,6 @@ export class ngFiltering
100
102
  for (let o of this.#owner.data.getValidData()) {
101
103
  if (o.v[idx] == null) continue;
102
104
 
103
- //console.log(o.v[idx], typeof o.v[idx])
104
-
105
105
  isNum = (typeof o.v[idx] === "number") ? true : false;
106
106
 
107
107
  break;
@@ -158,82 +158,12 @@ export class ngFiltering
158
158
 
159
159
  return index;
160
160
  };
161
-
162
-
163
-
164
-
165
-
166
- #init = (option) => {
167
-
168
- let jsonOption = {};
169
- if (Array.isArray(option)) {
170
- for (let key in option[0]) {
171
- jsonOption[key] = Array.from(new Set(oFilter.map(item => item[key])));//oFilter.map(item => item[key]);
172
- }
173
- }
174
- else {
175
- jsonOption = option;
176
- }
177
-
178
- this.#owner.data.clearFilter();
179
-
180
- for (let key in jsonOption) {
181
- const arr = jsonOption[key];
182
- const idx = this.#owner.fields.indexOf(key);
183
-
184
- for (let o of this.#owner.data.getValidData()) {
185
- if (o.v[idx] != null) {
186
- if (typeof o.v[idx] === "number") {
187
- for (var i = 0; i < arr.length; i++) {
188
- arr[i] = Number(arr[i]);
189
- }
190
- }
191
- break;
192
- }
193
- }
194
-
195
- this.#owner.data.getValidData().filter(m => { return arr.nineBinarySearch(m.v[idx] || '') < 0; }).map(m => { m.__ng.filtered = true; });
196
- }
197
-
198
-
199
- this.#owner.data.refreshFilter();
200
-
201
- var colnms = [];
202
- for (let key in jsonOption) {
203
- colnms.push(key);
204
- }
205
- //var colnms = filterData.map(item => item.colnm);
206
-
207
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
208
- v.filterData = null;
209
- });
210
-
211
- for (let key in jsonOption) {
212
- const arr = jsonOption[key];
213
-
214
- this.#owner.shadowRoot.querySelectorAll("ng-filter-button").forEach(v => {
215
- //console.log(v.colnms);
216
-
217
- v.colnms.forEach(colnm => {
218
- if (colnms.includes(colnm)) {
219
- v.filterData = arr;
220
- }
221
- });
222
- });
223
- }
224
-
225
-
226
- this.#owner.scrollTo_V1(0);
227
-
228
- this.#owner.paging.reset();
229
- };
230
161
  }
231
162
 
232
163
  class ngFilterButton extends HTMLElement
233
164
  {
234
165
  #owner;
235
166
  #filterOptions;
236
- #colnms;
237
167
 
238
168
  constructor () {
239
169
  super();
@@ -242,15 +172,8 @@ class ngFilterButton extends HTMLElement
242
172
  connectedCallback() {
243
173
  this.#owner = this.getRootNode().host;//this.closest("nine-grid");
244
174
 
245
- $(this).off("click", this.#onClick);
246
- $(this).on("click", this.#onClick);
247
- };
248
-
249
- get colnms() {
250
- return this.#colnms || [];
251
- };
252
- set colnms(v) {
253
- this.#colnms = v;
175
+ this.removeEventListener("click", this.#onClick);
176
+ this.addEventListener("click", this.#onClick);
254
177
  };
255
178
 
256
179
  get filterOptions() {
@@ -267,32 +190,8 @@ class ngFilterButton extends HTMLElement
267
190
  e.stopPropagation();
268
191
 
269
192
  const panel = this.#owner.shadowRoot.querySelector('ng-filter-panel');
270
-
271
- //console.log(panel.isHidden);
272
-
273
- //panel.style.display = 'flex' : 'none';
274
- //console.log(panel.isHidden, panel.col, this.closest('th,td').dataset.col);
275
-
276
- if (panel.col === this.closest('th,td').dataset.col) {
277
- panel.close();
278
- }
279
- else {
280
- /**
281
- var cell = e.target.closest("th,td");
282
-
283
- var l = $(e.target).offset().left - $(this.#owner).offset().left;// - $(panel).width() + $(e.target).width() + 1;
284
- if (l < 0) l = 0;
285
- if (l + $(panel).width() > $(this.#owner).width()) l = $(this.#owner).width() - $(panel).width() - 5;
286
-
287
-
288
-
289
- var t = $(cell).offset().top + $(cell).height()- $(this.#owner).offset().top;//$(e.target).offset().top + $(e.target).height() + 2;
290
-
291
- //$(panel).offset({left: l, top: t});
292
- $(panel).css({left: l, top: t});
293
- */
294
- panel.open(this);
295
- }
193
+
194
+ (panel.col === this.closest('th,td').dataset.col) ? panel.close() : panel.open(this);
296
195
  };
297
196
  }
298
197