gnui 1.0.9 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/js/gnui.esm.js +161 -24
  2. package/dist/js/gnui.js +161 -24
  3. package/dist/js/gnui.min.js +1 -1
  4. package/dist/styles/default.css +2 -2
  5. package/dist/styles/gpi.css +2 -2
  6. package/dist/styles/insights.css +2 -2
  7. package/dist/styles/nac.css +2 -2
  8. package/dist/styles/zt-nac.css +2 -2
  9. package/package.json +1 -1
  10. package/styleguide/category/COLOR/index.html +1 -1
  11. package/styleguide/category/COMPONENT/Alert(js)/index.html +1 -1
  12. package/styleguide/category/COMPONENT/Bignumber/index.html +1 -1
  13. package/styleguide/category/COMPONENT/Breadcrumb/index.html +1 -1
  14. package/styleguide/category/COMPONENT/Calendar(js)/index.html +1 -1
  15. package/styleguide/category/COMPONENT/Card/index.html +1 -1
  16. package/styleguide/category/COMPONENT/Chart(js)/index.html +1 -1
  17. package/styleguide/category/COMPONENT/Datagrid(js)/index.html +1 -1
  18. package/styleguide/category/COMPONENT/Growl(js)/index.html +1 -1
  19. package/styleguide/category/COMPONENT/JsonView(js)/index.html +1 -1
  20. package/styleguide/category/COMPONENT/Message(js)/index.html +1 -1
  21. package/styleguide/category/COMPONENT/Modal(js)/index.html +1 -1
  22. package/styleguide/category/COMPONENT/Pagination/index.html +1 -1
  23. package/styleguide/category/COMPONENT/Panel/index.html +1 -1
  24. package/styleguide/category/COMPONENT/Progressbar(js)/index.html +1 -1
  25. package/styleguide/category/COMPONENT/Tab(js)/index.html +1 -1
  26. package/styleguide/category/COMPONENT/Tagcloud(js)/index.html +1 -1
  27. package/styleguide/category/COMPONENT/Time(js)/index.html +1 -1
  28. package/styleguide/category/COMPONENT/Tooltip(js)/index.html +1 -1
  29. package/styleguide/category/COMPONENT/Tree(js)/index.html +1 -1
  30. package/styleguide/category/CONTROLS/Button(js)/index.html +1 -1
  31. package/styleguide/category/CONTROLS/Checkbox/index.html +1 -1
  32. package/styleguide/category/CONTROLS/Colorpicker(js)/index.html +1 -1
  33. package/styleguide/category/CONTROLS/Datepicker(js)/index.html +1 -1
  34. package/styleguide/category/CONTROLS/Dropdown(js)/index.html +1 -1
  35. package/styleguide/category/CONTROLS/File/index.html +1 -1
  36. package/styleguide/category/CONTROLS/Form/Control/index.html +1 -1
  37. package/styleguide/category/CONTROLS/Form/Field/index.html +1 -1
  38. package/styleguide/category/CONTROLS/Form/Plain/index.html +1 -1
  39. package/styleguide/category/CONTROLS/Input/index.html +1 -1
  40. package/styleguide/category/CONTROLS/MenuButton(js)/index.html +1 -1
  41. package/styleguide/category/CONTROLS/MultiText(js)/index.html +1 -1
  42. package/styleguide/category/CONTROLS/Picklist(js)/index.html +50 -1
  43. package/styleguide/category/CONTROLS/Radio/index.html +1 -1
  44. package/styleguide/category/CONTROLS/Select/index.html +1 -1
  45. package/styleguide/category/CONTROLS/SelectButton(js)/index.html +1 -1
  46. package/styleguide/category/CONTROLS/Slider/index.html +1 -1
  47. package/styleguide/category/CONTROLS/Switch(js)/index.html +1 -1
  48. package/styleguide/category/CONTROLS/SyntaxInput(js)/index.html +39 -1
  49. package/styleguide/category/CONTROLS/Textarea/index.html +1 -1
  50. package/styleguide/category/ELEMENTS/Box/index.html +1 -1
  51. package/styleguide/category/ELEMENTS/Icon/index.html +1 -1
  52. package/styleguide/category/ELEMENTS/Image/index.html +1 -1
  53. package/styleguide/category/ELEMENTS/List/index.html +1 -1
  54. package/styleguide/category/ELEMENTS/Table/index.html +1 -1
  55. package/styleguide/category/ELEMENTS/Tag/index.html +1 -1
  56. package/styleguide/category/ELEMENTS/Title/index.html +1 -1
  57. package/styleguide/category/LAYOUT/Container/index.html +1 -1
  58. package/styleguide/category/LAYOUT/Grid/index.html +1 -1
  59. package/styleguide/category/LAYOUT/Splitter(js)/index.html +1 -1
  60. package/styleguide/category/UTILITY/index.html +1 -1
  61. package/styleguide/category/Utils/index.html +1 -1
  62. package/styleguide/color.html +1 -1
  63. package/styleguide/index.html +1 -1
  64. package/styleguide/tag/javascript/index.html +88 -1
  65. package/styleguide/tag/v.0.1.0/index.html +88 -1
package/dist/js/gnui.js CHANGED
@@ -13780,8 +13780,10 @@
13780
13780
  }
13781
13781
  var JsonPath = jsonpath;
13782
13782
  function interpolateURL(url, source) {
13783
- var _tmp = __assign({}, source);
13784
- return url.replace(/\{{\s*[\w\.]+\s*}}/gm, function (match, offset, string) {
13783
+ var _source = __assign({}, source);
13784
+ var dmustach = new RegExp(/\{{([^{}]*)}}/gm);
13785
+ var result = url.replace(dmustach, function (match, offset, string) {
13786
+ var _tmp = __assign({}, _source);
13785
13787
  var _fields = match.replace(/\{{|\}}/gm, '');
13786
13788
  if (startsWith(_fields, '$') && isObject(source.root)) {
13787
13789
  _tmp = JsonPath.query(_tmp.root, _fields);
@@ -13791,8 +13793,9 @@
13791
13793
  _tmp = !isUndefined(_tmp[field]) ? _tmp[field] : _tmp;
13792
13794
  });
13793
13795
  }
13794
- return !isObject(_tmp) ? encodeURIComponent(_tmp) : _tmp;
13796
+ return !isObject(_tmp) ? encodeURI(_tmp) : _tmp;
13795
13797
  });
13798
+ return dmustach.test(result) ? interpolateURL(result, source) : result;
13796
13799
  }
13797
13800
 
13798
13801
  function style(element, name, value) {
@@ -16077,6 +16080,9 @@
16077
16080
  }
16078
16081
  var _selector = $(selector);
16079
16082
  var _findComponent;
16083
+ if (!_selector) {
16084
+ return undefined;
16085
+ }
16080
16086
  Object.values(this._componentMap).forEach(function (n) {
16081
16087
  // 동일한 selector 인지 비교
16082
16088
  if (isEquals(n.uid, _selector) || isEquals(_selector.id, n.uid)) {
@@ -16149,11 +16155,12 @@
16149
16155
  var GNCoreInstance = /** @class */ (function () {
16150
16156
  function GNCoreInstance(name, selector, options) {
16151
16157
  if (options === void 0) { options = {}; }
16158
+ var _a;
16152
16159
  this.$name = name;
16153
16160
  this.$selector = selector ? $(selector) : null;
16154
16161
  this.$options = options;
16155
16162
  // random uniqueId 생성
16156
- this._uid = "" + GN_CONSTANT.PREFIX + (new Date().getTime() + random(111, 999));
16163
+ this._uid = ((_a = this.$selector) === null || _a === void 0 ? void 0 : _a.id) || "" + GN_CONSTANT.PREFIX + (new Date().getTime() + random(111, 999));
16157
16164
  }
16158
16165
  GNCoreInstance.prototype.$reset = function () { };
16159
16166
  GNCoreInstance.prototype.$init = function (component, options) {
@@ -16826,7 +16833,7 @@
16826
16833
  },
16827
16834
  blur: function (e) {
16828
16835
  // focus가 옮겨간 객체가 해당 컴포넌트가 아닌경우 close 수행
16829
- if (!e.relatedTarget || !parents(e.relatedTarget, "#" + _this._uid).length) {
16836
+ if (!e.relatedTarget || (!parents(e.relatedTarget, "#" + _this._uid).length && !isEquals(e.relatedTarget, _this.$el))) {
16830
16837
  _this._hidden.close();
16831
16838
  }
16832
16839
  },
@@ -16917,7 +16924,7 @@
16917
16924
  return;
16918
16925
  }
16919
16926
  findAll('.dropdown-item', _this.$el).forEach(function (option) {
16920
- if (!includes$1(data$1(option, 'value'), q) && !includes$1(text(find('.dropdown-text', option)), q)) {
16927
+ if (!includes$1(data$1(option, 'value').toUpperCase(), q.toUpperCase()) && !includes$1(text(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
16921
16928
  css(option, 'display', 'none');
16922
16929
  }
16923
16930
  });
@@ -17076,6 +17083,21 @@
17076
17083
  this.$options.value = this.$options.flatData[0];
17077
17084
  }
17078
17085
  };
17086
+ Dropdown.prototype.completed = function () {
17087
+ if (this.$options.value) {
17088
+ var options_1 = findAll('select option', this.$el);
17089
+ if (isArray(this.$options.value)) {
17090
+ this.$options.value.forEach(function (value) { return setValue(value, options_1); });
17091
+ }
17092
+ else {
17093
+ setValue(this.$options.value, options_1);
17094
+ }
17095
+ }
17096
+ function setValue(value, options) {
17097
+ var opt = options.find(function (opt) { return opt.value === value.value; });
17098
+ opt && attr(opt, 'selected', 'selected');
17099
+ }
17100
+ };
17079
17101
  return Dropdown;
17080
17102
  }(GNCoreInstance));
17081
17103
 
@@ -17538,7 +17560,7 @@
17538
17560
  'xaxis',
17539
17561
  'yaxis'
17540
17562
  ];
17541
- // 기본 설정
17563
+ // 기본 설정 - overwrite 가능
17542
17564
  var chartDefault = {
17543
17565
  chart: {
17544
17566
  toolbar: {
@@ -17546,7 +17568,7 @@
17546
17568
  }
17547
17569
  }
17548
17570
  };
17549
- // 타입별 추가 설정
17571
+ // 타입별 추가 설정 - overwrite 불가
17550
17572
  var typesDefault = {
17551
17573
  line: {
17552
17574
  chart: {
@@ -17755,7 +17777,7 @@
17755
17777
  chartOptions[key] = value;
17756
17778
  }
17757
17779
  });
17758
- var newOptions = merge(merge(chartOptions, typesDefault[this.$options.type] || {}), chartDefault);
17780
+ var newOptions = merge(chartDefault, merge(chartOptions, typesDefault[this.$options.type] || {}));
17759
17781
  if (!newOptions.theme) {
17760
17782
  newOptions.theme = {
17761
17783
  palette: 'palette4'
@@ -17804,6 +17826,7 @@
17804
17826
  };
17805
17827
  _this.config = {
17806
17828
  name: _this.$selector.name || _this._uid,
17829
+ direction: undefined,
17807
17830
  delegates: {
17808
17831
  preview: '.active-color',
17809
17832
  value: '.color-value'
@@ -17849,6 +17872,11 @@
17849
17872
  _this.$options.parent = options.parent || _this.$options.parent;
17850
17873
  }
17851
17874
  addClass(_this.$el, 'is-active');
17875
+ var parentOptions = _this.$options.parent.$options;
17876
+ var parentEl = _this.$options.parent.$el;
17877
+ if (parentOptions.direction) {
17878
+ _this._hidden.setPosition(parentOptions, parentEl, _this.$el);
17879
+ }
17852
17880
  },
17853
17881
  hide: function () {
17854
17882
  removeClass(_this.$el, 'is-active');
@@ -17930,7 +17958,42 @@
17930
17958
  /* 컬러팔레트의 전체 너비 중 saturation 값에 따른 위치 설정 */
17931
17959
  setSaturation: function () {
17932
17960
  css(_this.$options.delegates.pointer, 'left', Math.floor(_this.$options.saturation / (100 / 180)));
17933
- }
17961
+ },
17962
+ setPosition: function (options, parentEl, currentEl) {
17963
+ var _position = {
17964
+ top: 0,
17965
+ left: 0
17966
+ };
17967
+ var parentOffset = offset(parentEl);
17968
+ var currentOffset = offset(currentEl);
17969
+ switch (options.direction) {
17970
+ case 'top':
17971
+ _position = {
17972
+ left: parentOffset.left + 'px',
17973
+ top: (parentOffset.top - currentOffset.height - 2) + 'px',
17974
+ };
17975
+ break;
17976
+ case 'bottom':
17977
+ _position = {
17978
+ left: parentOffset.left + 'px',
17979
+ top: (parentOffset.bottom + 2) + 'px'
17980
+ };
17981
+ break;
17982
+ case 'right':
17983
+ _position = {
17984
+ left: (parentOffset.right + 2) + 'px',
17985
+ top: parentOffset.top + 'px'
17986
+ };
17987
+ break;
17988
+ case 'left':
17989
+ _position = {
17990
+ left: (parentOffset.left - currentOffset.width - 2) + 'px',
17991
+ top: parentOffset.top + 'px'
17992
+ };
17993
+ break;
17994
+ }
17995
+ css(currentEl, _position);
17996
+ },
17934
17997
  };
17935
17998
  _this.config = {
17936
17999
  hue: 360,
@@ -19404,18 +19467,19 @@
19404
19467
  if (options === void 0) { options = {}; }
19405
19468
  var _this = _super.call(this, name, selector, options) || this;
19406
19469
  _this._hidden = {
19407
- search: function (e) {
19470
+ search: function (obj, e) {
19408
19471
  clearTimeout(_this.$options.timer);
19409
19472
  _this.$options.timer = setTimeout(function () {
19410
- _this._hidden.filter($(e.target).value);
19473
+ _this._hidden.filter(obj, $(e.target).value);
19411
19474
  }, 300);
19412
19475
  },
19413
- filter: function (q) {
19476
+ filter: function (obj, q) {
19477
+ css(findAll('.dropdown-item', _this.$el), 'display', 'block');
19414
19478
  if (q === '') {
19415
- css(findAll('.dropdown-item', _this.$el), 'display', 'block');
19479
+ return;
19416
19480
  }
19417
- findAll('.dropdown-item', _this.$el).forEach(function (option) {
19418
- if (!includes$1(data$1(option, 'value'), q) && !includes$1(text(find('.dropdown-text', option)), q)) {
19481
+ findAll(".picklist-" + obj + " .dropdown-item", _this.$el).forEach(function (option) {
19482
+ if (!includes$1(data$1(option, 'value').toUpperCase(), q.toUpperCase()) && !includes$1(text(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
19419
19483
  css(option, 'display', 'none');
19420
19484
  }
19421
19485
  });
@@ -19481,6 +19545,7 @@
19481
19545
  delete option.selected;
19482
19546
  });
19483
19547
  _this.$options.onChange && _this.$options.onChange.call(_this, _this.$options.data.source, _this.$options.data.target); // user onChange event
19548
+ _this.$options.onSort && _this.$options.onSort.call(_this, _this.$options.data.source, _this.$options.data.target); // user onSort event
19484
19549
  },
19485
19550
  move: function (dir, selected) {
19486
19551
  if (selected === void 0) { selected = null; }
@@ -19512,6 +19577,7 @@
19512
19577
  _this.$template.reRender(find('ul', _this.$options.delegates.source), _this._hidden.renderSub('source'));
19513
19578
  _this.$template.reRender(find('ul', _this.$options.delegates.target), _this._hidden.renderSub('target'));
19514
19579
  _this.$options.onChange && _this.$options.onChange.call(_this, _this.$options.data.source, _this.$options.data.target); // user onChange event
19580
+ _this.$options.onTransfer && _this.$options.onTransfer.call(_this, _this.$options.data.source, _this.$options.data.target); // user onTransfer event
19515
19581
  },
19516
19582
  moveTo: function (source, target, addArr) {
19517
19583
  isArray(addArr) &&
@@ -19537,6 +19603,10 @@
19537
19603
  };
19538
19604
  _this.config = {
19539
19605
  name: _this.$selector.name || _this._uid,
19606
+ textSets: {
19607
+ sourceCaption: '',
19608
+ targetCaption: ''
19609
+ },
19540
19610
  data: {
19541
19611
  source: (function () {
19542
19612
  return findAll('select.gn-source > option', _this.$selector).map(function (option) {
@@ -19554,11 +19624,15 @@
19554
19624
  source: '.picklist-source > .gn-dropdown',
19555
19625
  target: '.picklist-target > .gn-dropdown'
19556
19626
  },
19627
+ hasSourceSearch: false,
19628
+ hasTargetSearch: false,
19557
19629
  orderable: true,
19558
19630
  height: 150
19559
19631
  };
19560
19632
  _this.events = {
19561
- 'onChange': true
19633
+ 'onChange': true,
19634
+ 'onSort': true,
19635
+ 'onTransfer': true
19562
19636
  };
19563
19637
  _this.methods = {
19564
19638
  getSource: function () {
@@ -19603,12 +19677,43 @@
19603
19677
  createElement$1("div", { className: "picklist-source" },
19604
19678
  (config.orderable === true || config.orderable === 'source') && renderControl('source'),
19605
19679
  createElement$1("div", { className: "gn-dropdown is-opened" },
19606
- createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} }, this._hidden.renderSub('source')))),
19680
+ config.textSets.sourceCaption.length > 0 &&
19681
+ createElement$1("div", { className: "picklist-caption" }, config.textSets.sourceCaption),
19682
+ createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} },
19683
+ config.hasSourceSearch &&
19684
+ createElement$1("div", { className: "dropdown-search" },
19685
+ createElement$1("div", { className: "gn-control has-icon-right is-full" },
19686
+ createElement$1("span", { className: "gn-icon is-right" },
19687
+ createElement$1("i", { className: "fas fa-search" })),
19688
+ createElement$1("input", { type: "text", className: "gn-input is-full", placeholder: "search item", "on-keyup": this._hidden.search.bind(this, 'source') }))),
19689
+ this._hidden.renderSub('source')))),
19607
19690
  renderControl(config.direction === 'vertical' ? 'cross' : 'vertical'),
19608
19691
  createElement$1("div", { className: "picklist-target" },
19609
19692
  (config.orderable === true || config.orderable === 'target') && renderControl('target'),
19610
19693
  createElement$1("div", { className: "gn-dropdown is-opened" },
19611
- createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} }, this._hidden.renderSub('target')))));
19694
+ config.textSets.targetCaption.length > 0 &&
19695
+ createElement$1("div", { className: "picklist-caption" }, config.textSets.targetCaption),
19696
+ createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} },
19697
+ config.hasTargetSearch &&
19698
+ createElement$1("div", { className: "dropdown-search" },
19699
+ createElement$1("div", { className: "gn-control has-icon-right is-full" },
19700
+ createElement$1("span", { className: "gn-icon is-right" },
19701
+ createElement$1("i", { className: "fas fa-search" })),
19702
+ createElement$1("input", { type: "text", className: "gn-input is-full", placeholder: "search item", "on-keyup": this._hidden.search.bind(this, 'target') }))),
19703
+ this._hidden.renderSub('target')))));
19704
+ };
19705
+ Picklist.prototype.beforeMount = function () {
19706
+ if (this.$options.height < 100) {
19707
+ this.$options.height = 100;
19708
+ }
19709
+ };
19710
+ Picklist.prototype.completed = function () {
19711
+ if (this.$options.textSets.sourceCaption.length > 0) {
19712
+ style(find('.picklist-source .dropdown-items', this.$el), 'height', getUnit('height', getNumber(this.$options.height) - getNumber(style(find('.picklist-source .picklist-caption', this.$el), 'height'))));
19713
+ }
19714
+ if (this.$options.textSets.targetCaption.length > 0) {
19715
+ style(find('.picklist-target .dropdown-items', this.$el), 'height', getUnit('height', getNumber(this.$options.height) - getNumber(style(find('.picklist-target .picklist-caption', this.$el), 'height'))));
19716
+ }
19612
19717
  };
19613
19718
  return Picklist;
19614
19719
  }(GNCoreInstance));
@@ -21670,10 +21775,12 @@
21670
21775
  _this._hidden = {
21671
21776
  update: function (e) {
21672
21777
  if (_this.$options.readonly) {
21673
- e.preventDefault();
21778
+ e && e.preventDefault();
21674
21779
  return;
21675
21780
  }
21676
- _this.$options.value = $(e.target).value;
21781
+ if (e) {
21782
+ _this.$options.value = $(e.target).value;
21783
+ }
21677
21784
  // Handle final newlines (see article)
21678
21785
  if (_this.$options.value[_this.$options.value.length - 1] == "\n") {
21679
21786
  _this.$options.value += " ";
@@ -21682,7 +21789,8 @@
21682
21789
  _this.$options.delegates.content.innerHTML = _this.$options.value.replace(new RegExp("&", "g"), "&amp;").replace(new RegExp("<", "g"), "&lt;"); /* Global RegExp */
21683
21790
  // Syntax Highlight
21684
21791
  prism$1.highlightElement(_this.$options.delegates.content);
21685
- _this._hidden.sync(e);
21792
+ e && _this._hidden.sync(e);
21793
+ _this.$options.onChange && _this.$options.onChange.call(_this, _this.$options.value); // user onChange event
21686
21794
  },
21687
21795
  sync: function (e) {
21688
21796
  _this.$options.delegates.preview.scrollTop = e.target.scrollTop;
@@ -21709,6 +21817,20 @@
21709
21817
  },
21710
21818
  focus: function () {
21711
21819
  _this.$options.delegates.input.focus();
21820
+ },
21821
+ setValue: function (value) {
21822
+ _this.$options.value = value;
21823
+ val(_this.$options.delegates.input, _this.$options.value);
21824
+ _this._hidden.update();
21825
+ },
21826
+ getValue: function () {
21827
+ return _this.$options.value;
21828
+ },
21829
+ disable: function () {
21830
+ _this.$options.readonly = true;
21831
+ },
21832
+ enable: function () {
21833
+ _this.$options.readonly = false;
21712
21834
  }
21713
21835
  };
21714
21836
  _this.config = {
@@ -21729,8 +21851,23 @@
21729
21851
  usetab: false,
21730
21852
  readonly: false
21731
21853
  };
21732
- _this.events = {};
21733
- _this.methods = {};
21854
+ _this.events = {
21855
+ 'onChange': true
21856
+ };
21857
+ _this.methods = {
21858
+ setValue: function (value) {
21859
+ this._hidden.setValue(value);
21860
+ },
21861
+ getValue: function () {
21862
+ return this._hidden.getValue();
21863
+ },
21864
+ disable: function () {
21865
+ this._hidden.disable();
21866
+ },
21867
+ enable: function () {
21868
+ this._hidden.enable();
21869
+ }
21870
+ };
21734
21871
  _this.$init(_this, options);
21735
21872
  return _this;
21736
21873
  }