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.
- package/dist/js/gnui.esm.js +161 -24
- package/dist/js/gnui.js +161 -24
- package/dist/js/gnui.min.js +1 -1
- package/dist/styles/default.css +2 -2
- package/dist/styles/gpi.css +2 -2
- package/dist/styles/insights.css +2 -2
- package/dist/styles/nac.css +2 -2
- package/dist/styles/zt-nac.css +2 -2
- package/package.json +1 -1
- package/styleguide/category/COLOR/index.html +1 -1
- package/styleguide/category/COMPONENT/Alert(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Bignumber/index.html +1 -1
- package/styleguide/category/COMPONENT/Breadcrumb/index.html +1 -1
- package/styleguide/category/COMPONENT/Calendar(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Card/index.html +1 -1
- package/styleguide/category/COMPONENT/Chart(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Datagrid(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Growl(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/JsonView(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Message(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Modal(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Pagination/index.html +1 -1
- package/styleguide/category/COMPONENT/Panel/index.html +1 -1
- package/styleguide/category/COMPONENT/Progressbar(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tab(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tagcloud(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Time(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tooltip(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tree(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Button(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Checkbox/index.html +1 -1
- package/styleguide/category/CONTROLS/Colorpicker(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Datepicker(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Dropdown(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/File/index.html +1 -1
- package/styleguide/category/CONTROLS/Form/Control/index.html +1 -1
- package/styleguide/category/CONTROLS/Form/Field/index.html +1 -1
- package/styleguide/category/CONTROLS/Form/Plain/index.html +1 -1
- package/styleguide/category/CONTROLS/Input/index.html +1 -1
- package/styleguide/category/CONTROLS/MenuButton(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/MultiText(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Picklist(js)/index.html +50 -1
- package/styleguide/category/CONTROLS/Radio/index.html +1 -1
- package/styleguide/category/CONTROLS/Select/index.html +1 -1
- package/styleguide/category/CONTROLS/SelectButton(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Slider/index.html +1 -1
- package/styleguide/category/CONTROLS/Switch(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/SyntaxInput(js)/index.html +39 -1
- package/styleguide/category/CONTROLS/Textarea/index.html +1 -1
- package/styleguide/category/ELEMENTS/Box/index.html +1 -1
- package/styleguide/category/ELEMENTS/Icon/index.html +1 -1
- package/styleguide/category/ELEMENTS/Image/index.html +1 -1
- package/styleguide/category/ELEMENTS/List/index.html +1 -1
- package/styleguide/category/ELEMENTS/Table/index.html +1 -1
- package/styleguide/category/ELEMENTS/Tag/index.html +1 -1
- package/styleguide/category/ELEMENTS/Title/index.html +1 -1
- package/styleguide/category/LAYOUT/Container/index.html +1 -1
- package/styleguide/category/LAYOUT/Grid/index.html +1 -1
- package/styleguide/category/LAYOUT/Splitter(js)/index.html +1 -1
- package/styleguide/category/UTILITY/index.html +1 -1
- package/styleguide/category/Utils/index.html +1 -1
- package/styleguide/color.html +1 -1
- package/styleguide/index.html +1 -1
- package/styleguide/tag/javascript/index.html +88 -1
- package/styleguide/tag/v.0.1.0/index.html +88 -1
package/dist/js/gnui.esm.js
CHANGED
|
@@ -13714,8 +13714,10 @@ function commaNum(num) {
|
|
|
13714
13714
|
}
|
|
13715
13715
|
const JsonPath = jsonpath;
|
|
13716
13716
|
function interpolateURL(url, source) {
|
|
13717
|
-
let
|
|
13718
|
-
|
|
13717
|
+
let _source = Object.assign({}, source);
|
|
13718
|
+
let dmustach = new RegExp(/\{{([^{}]*)}}/gm);
|
|
13719
|
+
let result = url.replace(dmustach, (match, offset, string) => {
|
|
13720
|
+
let _tmp = Object.assign({}, _source);
|
|
13719
13721
|
let _fields = match.replace(/\{{|\}}/gm, '');
|
|
13720
13722
|
if (startsWith(_fields, '$') && isObject(source.root)) {
|
|
13721
13723
|
_tmp = JsonPath.query(_tmp.root, _fields);
|
|
@@ -13725,8 +13727,9 @@ function interpolateURL(url, source) {
|
|
|
13725
13727
|
_tmp = !isUndefined(_tmp[field]) ? _tmp[field] : _tmp;
|
|
13726
13728
|
});
|
|
13727
13729
|
}
|
|
13728
|
-
return !isObject(_tmp) ?
|
|
13730
|
+
return !isObject(_tmp) ? encodeURI(_tmp) : _tmp;
|
|
13729
13731
|
});
|
|
13732
|
+
return dmustach.test(result) ? interpolateURL(result, source) : result;
|
|
13730
13733
|
}
|
|
13731
13734
|
|
|
13732
13735
|
function style(element, name, value) {
|
|
@@ -15933,6 +15936,9 @@ class GNUIState {
|
|
|
15933
15936
|
}
|
|
15934
15937
|
let _selector = $(selector);
|
|
15935
15938
|
let _findComponent;
|
|
15939
|
+
if (!_selector) {
|
|
15940
|
+
return undefined;
|
|
15941
|
+
}
|
|
15936
15942
|
Object.values(this._componentMap).forEach((n) => {
|
|
15937
15943
|
// 동일한 selector 인지 비교
|
|
15938
15944
|
if (isEquals(n.uid, _selector) || isEquals(_selector.id, n.uid)) {
|
|
@@ -16002,11 +16008,12 @@ class GNUIState {
|
|
|
16002
16008
|
// component instance
|
|
16003
16009
|
class GNCoreInstance {
|
|
16004
16010
|
constructor(name, selector, options = {}) {
|
|
16011
|
+
var _a;
|
|
16005
16012
|
this.$name = name;
|
|
16006
16013
|
this.$selector = selector ? $(selector) : null;
|
|
16007
16014
|
this.$options = options;
|
|
16008
16015
|
// random uniqueId 생성
|
|
16009
|
-
this._uid = `${GN_CONSTANT.PREFIX}${new Date().getTime() + random(111, 999)}`;
|
|
16016
|
+
this._uid = ((_a = this.$selector) === null || _a === void 0 ? void 0 : _a.id) || `${GN_CONSTANT.PREFIX}${new Date().getTime() + random(111, 999)}`;
|
|
16010
16017
|
}
|
|
16011
16018
|
$reset() { }
|
|
16012
16019
|
$init(component, options) {
|
|
@@ -16655,7 +16662,7 @@ class Dropdown extends GNCoreInstance {
|
|
|
16655
16662
|
},
|
|
16656
16663
|
blur: (e) => {
|
|
16657
16664
|
// focus가 옮겨간 객체가 해당 컴포넌트가 아닌경우 close 수행
|
|
16658
|
-
if (!e.relatedTarget || !parents(e.relatedTarget, `#${this._uid}`).length) {
|
|
16665
|
+
if (!e.relatedTarget || (!parents(e.relatedTarget, `#${this._uid}`).length && !isEquals(e.relatedTarget, this.$el))) {
|
|
16659
16666
|
this._hidden.close();
|
|
16660
16667
|
}
|
|
16661
16668
|
},
|
|
@@ -16746,7 +16753,7 @@ class Dropdown extends GNCoreInstance {
|
|
|
16746
16753
|
return;
|
|
16747
16754
|
}
|
|
16748
16755
|
findAll('.dropdown-item', this.$el).forEach((option) => {
|
|
16749
|
-
if (!includes$1(data$1(option, 'value'), q) && !includes$1(text(find('.dropdown-text', option)), q)) {
|
|
16756
|
+
if (!includes$1(data$1(option, 'value').toUpperCase(), q.toUpperCase()) && !includes$1(text(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
|
|
16750
16757
|
css(option, 'display', 'none');
|
|
16751
16758
|
}
|
|
16752
16759
|
});
|
|
@@ -16904,6 +16911,21 @@ class Dropdown extends GNCoreInstance {
|
|
|
16904
16911
|
this.$options.value = this.$options.flatData[0];
|
|
16905
16912
|
}
|
|
16906
16913
|
}
|
|
16914
|
+
completed() {
|
|
16915
|
+
if (this.$options.value) {
|
|
16916
|
+
const options = findAll('select option', this.$el);
|
|
16917
|
+
if (isArray(this.$options.value)) {
|
|
16918
|
+
this.$options.value.forEach((value) => setValue(value, options));
|
|
16919
|
+
}
|
|
16920
|
+
else {
|
|
16921
|
+
setValue(this.$options.value, options);
|
|
16922
|
+
}
|
|
16923
|
+
}
|
|
16924
|
+
function setValue(value, options) {
|
|
16925
|
+
const opt = options.find(opt => opt.value === value.value);
|
|
16926
|
+
opt && attr(opt, 'selected', 'selected');
|
|
16927
|
+
}
|
|
16928
|
+
}
|
|
16907
16929
|
}
|
|
16908
16930
|
|
|
16909
16931
|
class Time extends GNCoreInstance {
|
|
@@ -17355,7 +17377,7 @@ const apexOptions = [
|
|
|
17355
17377
|
'xaxis',
|
|
17356
17378
|
'yaxis'
|
|
17357
17379
|
];
|
|
17358
|
-
// 기본 설정
|
|
17380
|
+
// 기본 설정 - overwrite 가능
|
|
17359
17381
|
const chartDefault = {
|
|
17360
17382
|
chart: {
|
|
17361
17383
|
toolbar: {
|
|
@@ -17363,7 +17385,7 @@ const chartDefault = {
|
|
|
17363
17385
|
}
|
|
17364
17386
|
}
|
|
17365
17387
|
};
|
|
17366
|
-
// 타입별 추가 설정
|
|
17388
|
+
// 타입별 추가 설정 - overwrite 불가
|
|
17367
17389
|
const typesDefault = {
|
|
17368
17390
|
line: {
|
|
17369
17391
|
chart: {
|
|
@@ -17569,7 +17591,7 @@ class Chart extends GNCoreInstance {
|
|
|
17569
17591
|
chartOptions[key] = value;
|
|
17570
17592
|
}
|
|
17571
17593
|
});
|
|
17572
|
-
const newOptions = merge(merge(chartOptions, typesDefault[this.$options.type] || {})
|
|
17594
|
+
const newOptions = merge(chartDefault, merge(chartOptions, typesDefault[this.$options.type] || {}));
|
|
17573
17595
|
if (!newOptions.theme) {
|
|
17574
17596
|
newOptions.theme = {
|
|
17575
17597
|
palette: 'palette4'
|
|
@@ -17615,6 +17637,7 @@ class Colorpicker extends GNCoreInstance {
|
|
|
17615
17637
|
};
|
|
17616
17638
|
this.config = {
|
|
17617
17639
|
name: this.$selector.name || this._uid,
|
|
17640
|
+
direction: undefined,
|
|
17618
17641
|
delegates: {
|
|
17619
17642
|
preview: '.active-color',
|
|
17620
17643
|
value: '.color-value'
|
|
@@ -17656,6 +17679,11 @@ class Colorpalette extends GNCoreInstance {
|
|
|
17656
17679
|
this.$options.parent = options.parent || this.$options.parent;
|
|
17657
17680
|
}
|
|
17658
17681
|
addClass(this.$el, 'is-active');
|
|
17682
|
+
const parentOptions = this.$options.parent.$options;
|
|
17683
|
+
const parentEl = this.$options.parent.$el;
|
|
17684
|
+
if (parentOptions.direction) {
|
|
17685
|
+
this._hidden.setPosition(parentOptions, parentEl, this.$el);
|
|
17686
|
+
}
|
|
17659
17687
|
},
|
|
17660
17688
|
hide: () => {
|
|
17661
17689
|
removeClass(this.$el, 'is-active');
|
|
@@ -17737,7 +17765,42 @@ class Colorpalette extends GNCoreInstance {
|
|
|
17737
17765
|
/* 컬러팔레트의 전체 너비 중 saturation 값에 따른 위치 설정 */
|
|
17738
17766
|
setSaturation: () => {
|
|
17739
17767
|
css(this.$options.delegates.pointer, 'left', Math.floor(this.$options.saturation / (100 / 180)));
|
|
17740
|
-
}
|
|
17768
|
+
},
|
|
17769
|
+
setPosition: (options, parentEl, currentEl) => {
|
|
17770
|
+
let _position = {
|
|
17771
|
+
top: 0,
|
|
17772
|
+
left: 0
|
|
17773
|
+
};
|
|
17774
|
+
const parentOffset = offset(parentEl);
|
|
17775
|
+
const currentOffset = offset(currentEl);
|
|
17776
|
+
switch (options.direction) {
|
|
17777
|
+
case 'top':
|
|
17778
|
+
_position = {
|
|
17779
|
+
left: parentOffset.left + 'px',
|
|
17780
|
+
top: (parentOffset.top - currentOffset.height - 2) + 'px',
|
|
17781
|
+
};
|
|
17782
|
+
break;
|
|
17783
|
+
case 'bottom':
|
|
17784
|
+
_position = {
|
|
17785
|
+
left: parentOffset.left + 'px',
|
|
17786
|
+
top: (parentOffset.bottom + 2) + 'px'
|
|
17787
|
+
};
|
|
17788
|
+
break;
|
|
17789
|
+
case 'right':
|
|
17790
|
+
_position = {
|
|
17791
|
+
left: (parentOffset.right + 2) + 'px',
|
|
17792
|
+
top: parentOffset.top + 'px'
|
|
17793
|
+
};
|
|
17794
|
+
break;
|
|
17795
|
+
case 'left':
|
|
17796
|
+
_position = {
|
|
17797
|
+
left: (parentOffset.left - currentOffset.width - 2) + 'px',
|
|
17798
|
+
top: parentOffset.top + 'px'
|
|
17799
|
+
};
|
|
17800
|
+
break;
|
|
17801
|
+
}
|
|
17802
|
+
css(currentEl, _position);
|
|
17803
|
+
},
|
|
17741
17804
|
};
|
|
17742
17805
|
this.config = {
|
|
17743
17806
|
hue: 360,
|
|
@@ -19155,18 +19218,19 @@ class Picklist extends GNCoreInstance {
|
|
|
19155
19218
|
constructor(name, selector, options = {}) {
|
|
19156
19219
|
super(name, selector, options);
|
|
19157
19220
|
this._hidden = {
|
|
19158
|
-
search: (e) => {
|
|
19221
|
+
search: (obj, e) => {
|
|
19159
19222
|
clearTimeout(this.$options.timer);
|
|
19160
19223
|
this.$options.timer = setTimeout(() => {
|
|
19161
|
-
this._hidden.filter($(e.target).value);
|
|
19224
|
+
this._hidden.filter(obj, $(e.target).value);
|
|
19162
19225
|
}, 300);
|
|
19163
19226
|
},
|
|
19164
|
-
filter: (q) => {
|
|
19227
|
+
filter: (obj, q) => {
|
|
19228
|
+
css(findAll('.dropdown-item', this.$el), 'display', 'block');
|
|
19165
19229
|
if (q === '') {
|
|
19166
|
-
|
|
19230
|
+
return;
|
|
19167
19231
|
}
|
|
19168
|
-
findAll(
|
|
19169
|
-
if (!includes$1(data$1(option, 'value'), q) && !includes$1(text(find('.dropdown-text', option)), q)) {
|
|
19232
|
+
findAll(`.picklist-${obj} .dropdown-item`, this.$el).forEach((option) => {
|
|
19233
|
+
if (!includes$1(data$1(option, 'value').toUpperCase(), q.toUpperCase()) && !includes$1(text(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
|
|
19170
19234
|
css(option, 'display', 'none');
|
|
19171
19235
|
}
|
|
19172
19236
|
});
|
|
@@ -19232,6 +19296,7 @@ class Picklist extends GNCoreInstance {
|
|
|
19232
19296
|
delete option.selected;
|
|
19233
19297
|
});
|
|
19234
19298
|
this.$options.onChange && this.$options.onChange.call(this, this.$options.data.source, this.$options.data.target); // user onChange event
|
|
19299
|
+
this.$options.onSort && this.$options.onSort.call(this, this.$options.data.source, this.$options.data.target); // user onSort event
|
|
19235
19300
|
},
|
|
19236
19301
|
move: (dir, selected = null) => {
|
|
19237
19302
|
dir = dir.replace('right', 'add').replace('left', 'remove').replace('down', 'add').replace('up', 'remove');
|
|
@@ -19262,6 +19327,7 @@ class Picklist extends GNCoreInstance {
|
|
|
19262
19327
|
this.$template.reRender(find('ul', this.$options.delegates.source), this._hidden.renderSub('source'));
|
|
19263
19328
|
this.$template.reRender(find('ul', this.$options.delegates.target), this._hidden.renderSub('target'));
|
|
19264
19329
|
this.$options.onChange && this.$options.onChange.call(this, this.$options.data.source, this.$options.data.target); // user onChange event
|
|
19330
|
+
this.$options.onTransfer && this.$options.onTransfer.call(this, this.$options.data.source, this.$options.data.target); // user onTransfer event
|
|
19265
19331
|
},
|
|
19266
19332
|
moveTo: (source, target, addArr) => {
|
|
19267
19333
|
isArray(addArr) &&
|
|
@@ -19287,6 +19353,10 @@ class Picklist extends GNCoreInstance {
|
|
|
19287
19353
|
};
|
|
19288
19354
|
this.config = {
|
|
19289
19355
|
name: this.$selector.name || this._uid,
|
|
19356
|
+
textSets: {
|
|
19357
|
+
sourceCaption: '',
|
|
19358
|
+
targetCaption: ''
|
|
19359
|
+
},
|
|
19290
19360
|
data: {
|
|
19291
19361
|
source: (() => {
|
|
19292
19362
|
return findAll('select.gn-source > option', this.$selector).map((option) => {
|
|
@@ -19304,11 +19374,15 @@ class Picklist extends GNCoreInstance {
|
|
|
19304
19374
|
source: '.picklist-source > .gn-dropdown',
|
|
19305
19375
|
target: '.picklist-target > .gn-dropdown'
|
|
19306
19376
|
},
|
|
19377
|
+
hasSourceSearch: false,
|
|
19378
|
+
hasTargetSearch: false,
|
|
19307
19379
|
orderable: true,
|
|
19308
19380
|
height: 150
|
|
19309
19381
|
};
|
|
19310
19382
|
this.events = {
|
|
19311
|
-
'onChange': true
|
|
19383
|
+
'onChange': true,
|
|
19384
|
+
'onSort': true,
|
|
19385
|
+
'onTransfer': true
|
|
19312
19386
|
};
|
|
19313
19387
|
this.methods = {
|
|
19314
19388
|
getSource() {
|
|
@@ -19351,12 +19425,43 @@ class Picklist extends GNCoreInstance {
|
|
|
19351
19425
|
createElement$1("div", { className: "picklist-source" },
|
|
19352
19426
|
(config.orderable === true || config.orderable === 'source') && renderControl('source'),
|
|
19353
19427
|
createElement$1("div", { className: "gn-dropdown is-opened" },
|
|
19354
|
-
|
|
19428
|
+
config.textSets.sourceCaption.length > 0 &&
|
|
19429
|
+
createElement$1("div", { className: "picklist-caption" }, config.textSets.sourceCaption),
|
|
19430
|
+
createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} },
|
|
19431
|
+
config.hasSourceSearch &&
|
|
19432
|
+
createElement$1("div", { className: "dropdown-search" },
|
|
19433
|
+
createElement$1("div", { className: "gn-control has-icon-right is-full" },
|
|
19434
|
+
createElement$1("span", { className: "gn-icon is-right" },
|
|
19435
|
+
createElement$1("i", { className: "fas fa-search" })),
|
|
19436
|
+
createElement$1("input", { type: "text", className: "gn-input is-full", placeholder: "search item", "on-keyup": this._hidden.search.bind(this, 'source') }))),
|
|
19437
|
+
this._hidden.renderSub('source')))),
|
|
19355
19438
|
renderControl(config.direction === 'vertical' ? 'cross' : 'vertical'),
|
|
19356
19439
|
createElement$1("div", { className: "picklist-target" },
|
|
19357
19440
|
(config.orderable === true || config.orderable === 'target') && renderControl('target'),
|
|
19358
19441
|
createElement$1("div", { className: "gn-dropdown is-opened" },
|
|
19359
|
-
|
|
19442
|
+
config.textSets.targetCaption.length > 0 &&
|
|
19443
|
+
createElement$1("div", { className: "picklist-caption" }, config.textSets.targetCaption),
|
|
19444
|
+
createElement$1("div", { className: "dropdown-items", style: config.height ? { height: getUnit('height', config.height), maxHeight: getUnit('height', config.height) } : {} },
|
|
19445
|
+
config.hasTargetSearch &&
|
|
19446
|
+
createElement$1("div", { className: "dropdown-search" },
|
|
19447
|
+
createElement$1("div", { className: "gn-control has-icon-right is-full" },
|
|
19448
|
+
createElement$1("span", { className: "gn-icon is-right" },
|
|
19449
|
+
createElement$1("i", { className: "fas fa-search" })),
|
|
19450
|
+
createElement$1("input", { type: "text", className: "gn-input is-full", placeholder: "search item", "on-keyup": this._hidden.search.bind(this, 'target') }))),
|
|
19451
|
+
this._hidden.renderSub('target')))));
|
|
19452
|
+
}
|
|
19453
|
+
beforeMount() {
|
|
19454
|
+
if (this.$options.height < 100) {
|
|
19455
|
+
this.$options.height = 100;
|
|
19456
|
+
}
|
|
19457
|
+
}
|
|
19458
|
+
completed() {
|
|
19459
|
+
if (this.$options.textSets.sourceCaption.length > 0) {
|
|
19460
|
+
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'))));
|
|
19461
|
+
}
|
|
19462
|
+
if (this.$options.textSets.targetCaption.length > 0) {
|
|
19463
|
+
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'))));
|
|
19464
|
+
}
|
|
19360
19465
|
}
|
|
19361
19466
|
}
|
|
19362
19467
|
|
|
@@ -21396,10 +21501,12 @@ class SyntaxInput extends GNCoreInstance {
|
|
|
21396
21501
|
this._hidden = {
|
|
21397
21502
|
update: (e) => {
|
|
21398
21503
|
if (this.$options.readonly) {
|
|
21399
|
-
e.preventDefault();
|
|
21504
|
+
e && e.preventDefault();
|
|
21400
21505
|
return;
|
|
21401
21506
|
}
|
|
21402
|
-
|
|
21507
|
+
if (e) {
|
|
21508
|
+
this.$options.value = $(e.target).value;
|
|
21509
|
+
}
|
|
21403
21510
|
// Handle final newlines (see article)
|
|
21404
21511
|
if (this.$options.value[this.$options.value.length - 1] == "\n") {
|
|
21405
21512
|
this.$options.value += " ";
|
|
@@ -21408,7 +21515,8 @@ class SyntaxInput extends GNCoreInstance {
|
|
|
21408
21515
|
this.$options.delegates.content.innerHTML = this.$options.value.replace(new RegExp("&", "g"), "&").replace(new RegExp("<", "g"), "<"); /* Global RegExp */
|
|
21409
21516
|
// Syntax Highlight
|
|
21410
21517
|
prism$1.highlightElement(this.$options.delegates.content);
|
|
21411
|
-
this._hidden.sync(e);
|
|
21518
|
+
e && this._hidden.sync(e);
|
|
21519
|
+
this.$options.onChange && this.$options.onChange.call(this, this.$options.value); // user onChange event
|
|
21412
21520
|
},
|
|
21413
21521
|
sync: (e) => {
|
|
21414
21522
|
this.$options.delegates.preview.scrollTop = e.target.scrollTop;
|
|
@@ -21435,6 +21543,20 @@ class SyntaxInput extends GNCoreInstance {
|
|
|
21435
21543
|
},
|
|
21436
21544
|
focus: () => {
|
|
21437
21545
|
this.$options.delegates.input.focus();
|
|
21546
|
+
},
|
|
21547
|
+
setValue: (value) => {
|
|
21548
|
+
this.$options.value = value;
|
|
21549
|
+
val(this.$options.delegates.input, this.$options.value);
|
|
21550
|
+
this._hidden.update();
|
|
21551
|
+
},
|
|
21552
|
+
getValue: () => {
|
|
21553
|
+
return this.$options.value;
|
|
21554
|
+
},
|
|
21555
|
+
disable: () => {
|
|
21556
|
+
this.$options.readonly = true;
|
|
21557
|
+
},
|
|
21558
|
+
enable: () => {
|
|
21559
|
+
this.$options.readonly = false;
|
|
21438
21560
|
}
|
|
21439
21561
|
};
|
|
21440
21562
|
this.config = {
|
|
@@ -21455,8 +21577,23 @@ class SyntaxInput extends GNCoreInstance {
|
|
|
21455
21577
|
usetab: false,
|
|
21456
21578
|
readonly: false
|
|
21457
21579
|
};
|
|
21458
|
-
this.events = {
|
|
21459
|
-
|
|
21580
|
+
this.events = {
|
|
21581
|
+
'onChange': true
|
|
21582
|
+
};
|
|
21583
|
+
this.methods = {
|
|
21584
|
+
setValue(value) {
|
|
21585
|
+
this._hidden.setValue(value);
|
|
21586
|
+
},
|
|
21587
|
+
getValue() {
|
|
21588
|
+
return this._hidden.getValue();
|
|
21589
|
+
},
|
|
21590
|
+
disable() {
|
|
21591
|
+
this._hidden.disable();
|
|
21592
|
+
},
|
|
21593
|
+
enable() {
|
|
21594
|
+
this._hidden.enable();
|
|
21595
|
+
}
|
|
21596
|
+
};
|
|
21460
21597
|
this.$init(this, options);
|
|
21461
21598
|
}
|
|
21462
21599
|
template(config) {
|