浏览代码

Expose `createTag` as an option

This is a replacement for the old `createSearchChoice` method which
allowed tags to be dynamically created with a custom data object.
Kevin Brown 10 年之前
父节点
当前提交
751fc63169

+ 6 - 0
dist/js/select2.amd.full.js

@@ -2579,6 +2579,12 @@ define('select2/data/tags',[
   function Tags (decorated, $element, options) {
     var tags = options.get('tags');
 
+    var createTag = options.get('createTag');
+
+    if (createTag !== undefined) {
+      this.createTag = createTag;
+    }
+
     decorated.call(this, $element, options);
 
     if ($.isArray(tags)) {

+ 6 - 0
dist/js/select2.amd.js

@@ -2579,6 +2579,12 @@ define('select2/data/tags',[
   function Tags (decorated, $element, options) {
     var tags = options.get('tags');
 
+    var createTag = options.get('createTag');
+
+    if (createTag !== undefined) {
+      this.createTag = createTag;
+    }
+
     decorated.call(this, $element, options);
 
     if ($.isArray(tags)) {

+ 6 - 0
dist/js/select2.full.js

@@ -12114,6 +12114,12 @@ define('select2/data/tags',[
   function Tags (decorated, $element, options) {
     var tags = options.get('tags');
 
+    var createTag = options.get('createTag');
+
+    if (createTag !== undefined) {
+      this.createTag = createTag;
+    }
+
     decorated.call(this, $element, options);
 
     if ($.isArray(tags)) {

文件差异内容过多而无法显示
+ 0 - 0
dist/js/select2.full.min.js


+ 6 - 0
dist/js/select2.js

@@ -3007,6 +3007,12 @@ define('select2/data/tags',[
   function Tags (decorated, $element, options) {
     var tags = options.get('tags');
 
+    var createTag = options.get('createTag');
+
+    if (createTag !== undefined) {
+      this.createTag = createTag;
+    }
+
     decorated.call(this, $element, options);
 
     if ($.isArray(tags)) {

文件差异内容过多而无法显示
+ 0 - 0
dist/js/select2.min.js


+ 6 - 0
src/js/select2/data/tags.js

@@ -4,6 +4,12 @@ define([
   function Tags (decorated, $element, options) {
     var tags = options.get('tags');
 
+    var createTag = options.get('createTag');
+
+    if (createTag !== undefined) {
+      this.createTag = createTag;
+    }
+
     decorated.call(this, $element, options);
 
     if ($.isArray(tags)) {

部分文件因为文件数量过多而无法显示