fix: 初始化

This commit is contained in:
jiaojinfeng
2023-05-30 19:27:03 +08:00
commit 28db653900
4436 changed files with 500218 additions and 0 deletions

View File

@ -0,0 +1,27 @@
/* eslint-disable no-unused-vars */
function cascadeSourceOne(options) {
return [
{ text: "级联t1-1", value: "1-1" },
{ text: "级联t1-2", value: "1-2" },
{ text: "级联t1-3", value: "1-3" }
];
}
function cascadeSourceTwo(options) {
var value = (options || "") + "::";
return [
{ text: value + "级联t2-1", value: value + "2-1" },
{ text: value + "级联t2-2", value: value + "2-2" },
{ text: value + "级联t2-3", value: value + "2-3" }
];
}
function cascadeSourceThree(options) {
var value = (options || "") + "::";
return [
{ text: value + "级联t3-1", value: value + "3-1" },
{ text: value + "级联t3-2", value: value + "3-2" },
{ text: value + "级联t3-3", value: value + "3-3" }
];
}

View File

@ -0,0 +1,67 @@
var control_order = [// eslint-disable-line
{
text: "基础元件",
expand: false,
children: [
"label",
"textbox",
"hidden",
"textarea",
"date",
"button",
"select",
"textvalue",
"radiogroup",
"checkboxgroup",
"link",
"multipleselectlabel"
]
},
{
text: "文本元件",
expand: true,
children: [
"textbox",
"hidden",
"textarea",
"contenteditable",
"date"
]
},
{
text: "选择元件",
expand: false,
children: [
"select",
"textvalue",
"radiogroup",
"checkboxgroup"
]
},
{
text: "按钮元件",
expand: true,
children: [
"button",
"datactrls"
// "data-insert",
// "data-remove"
]
},
{
text: "上传元件",
expand: true,
children: [
"image",
"file",
]
},
{
text: "自定义元件",
expand: false,
children: [
"newTextbox",
"newLabel"
]
}
];

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
// eslint-disable-next-line no-unused-vars
var dataset_1 = [
[
{ value: "第二行开始" },
{ value: "01:01:01" },
{ value: "第二行结束" }
],
[
{ value: "第二行开始" },
{ value: "02:02:02" },
//{ value: "01:01:01" },
{ value: "第二行结束" }
],
[
{ value: "第三行开始" },
//{ value: "01:01:01" },
{ value: "02:02:02" },
//{ value: "03:03:03" },
{ value: "第三行结束" }
],
[
{ value: "第四行开始" },
//{ value: "01:01:01" },
//{ value: "02:02:02" },
//{ value: "03:03:03" },
{ value: "04:04:04" },
{ value: "第四行结束" }
],
[
{ value: "第五行开始" },
//{ value: "01:01:01" },
//{ value: "02:02:02" },
//{ value: "03:03:03" },
{ value: "05:05:05" },
{ value: "第五行结束" }
],
[
{ value: "第六行开始" },
//{ value: "01:01:01" },
//{ value: "02:02:02" },
//{ value: "03:03:03" },
{ value: "05:05:05" },
{ value: "第六行结束" }
]
];
// eslint-disable-next-line no-unused-vars
var dataset_2 = [
["dataset_2_lable_1", "2020-02-20"],
["dataset_2_lable_2", "2020-04-20"]
];

View File

@ -0,0 +1,49 @@
/* eslint-disable no-unused-vars */
function onLinkClick(item) {
console.dir({
id: this.attr("id"),
text: item.text,
value: item.value
});
}
function onCheckValue(value) {
var n = Math.floor(Math.random() * 10);
return !(n % 2);
}
function onMulLabelClick(value, update) {
var items = [{
text: "碧玉妆成一树高",
value: "1"
}, {
text: "万条垂下绿丝绦",
value: "2"
}, {
text: "不知细叶谁裁出",
value: "3"
}, {
text: "二月春风似剪刀",
value: "4"
}];
setTimeout(function () {
update(items);
}, 1000);
}
function onFillDynamicData(row, index, callback) {
var length = row.length,
item;
for (var i = 0; i < length; i++) {
item = row[i];
item.value = "11:11:11";
}
setTimeout(function () {
callback(row);
}, 1000);
}

View File

@ -0,0 +1,9 @@
/* eslint-disable no-unused-vars */
/* global jQuery $ */
function getMenuOrder() {
var order = [];
//order = $.extend(true, [], $.formbuilder.config.menu.order);
order.push(["permission-action"]);
return order;
}

View File

@ -0,0 +1,17 @@
/* global jQuery */
(function ($) {
"use strict";
$.formbuilder.menucontrol["permission-action"] = {
options: {
name: null,
value: false,
text: "no target test",
image: "permission-action.png"
},
type: "button",
property: false,
fn: function ($elems, grid) {
alert("exe no target test menu button");
}
};
})(jQuery);

View File

@ -0,0 +1,199 @@
/* global $ _*/
// eslint-disable-next-line no-unused-vars
var newLabel = {
title: "label",
icon: "label.png",
cache: {
indent: []
},
design: function () {
return $("<label class='" + this.className.container + "'>" + this.options.value + "</label>");
},
applying: function () {
return this.design();
},
view: function () {
return this.design();
},
getValue: function () {
return this.options.value;
},
className: {
container: "formbuilder-control-label",
vertical: "formbuilder-control-label-vertical",
space: "formbuilder-control-label-space"
},
options: {
label: "",
value: "中文标签\nEnglish",
className: ""
},
property: {
height: {
hidden: false
},
value: {
text: "value",
type: "textarea",
after: ["font-size", "text-align", "text-vertical-align", "width", "height", "line-height", "indent"],
update: function (value, position, options) {
var items = value.split("\n"),
html = [],
textV = options["word-vertical"],
self = this;
this.cache.indent = [];
_.each(items, function (item) {
var trimString,
tempString,
signString = "[--]",
splitArray,
leftTrim,
rightTrim;
if (textV) {
item = _.map(item.split(""), function (char) {
return char + "<br/>";
});
item = item.join("");
}
//计算缩进量
trimString = $.trim(item);
tempString = item.replace(trimString, signString);
splitArray = tempString.split(signString);
leftTrim = splitArray[0] ? splitArray[0].length : 0;
rightTrim = splitArray[1] ? splitArray[1].length : 0;
self.cache.indent.push({ left: leftTrim, right: rightTrim });
item = tempString.replace(/ /g, "<span class='" + self.className.space + "'></span>")
.replace(signString, trimString);
html.push("<p>" + item + "</p>");
});
this.elem.html(html.join(""));
textV ? this.elem.addClass(this.className.vertical) : this.elem.removeClass(this.className.vertical);
}
},
"text-vertical-align": {
text: "text-vertical-align",
type: "buttons",
order: 2004,
updateInLoad: true,
source: [
{
name: "top",
text: "vertical-align-top",
image: "text-align-top.png",
selected: true
},
{
name: "middle",
text: "vertical-align-middle",
image: "text-align-middle.png",
selected: false
},
{
name: "bottom",
text: "vertical-align-bottom",
image: "text-align-bottom.png",
selected: false
}
],
update: function (value) {
this.container.find("p").css("vertical-align", value);
}
},
"word-vertical": {
text: "word-vertical",
type: "bool",
after: ["value"],
updateInLoad: false,
source: {
text: "word-vertical",
image: "word-vertical.png"
},
update: function (value, position, options) { }
},
"font-size": {
text: "font-size",
order: 2001,
type: "combox",
after: "vertical-align",
updateInLoad: true,
source: $.formbuilder["FONT-SIZE"],
conver: function (value) {
value = value || "";
return value;
},
update: function (value) {
this.elem.find("p").css("font-size", value + "px");
}
},
"line-height": {
text: "line-height",
type: "text",
updateInLoad: true,
order: 2006,
update: function (value, position, options) {
if (value) {
this.elem.find("p").css("line-height", value + "px");
}
}
},
"indent": {
text: "indent",
type: "text",
updateInLoad: true,
order: 2007,
conver: function (value) {
if (isNaN(value) === false) {
return Number(value);
}
return value;
},
update: function (value, position, options) {
if (!value) {
return;
}
var self = this,
$space = this.elem.find("." + this.className.space),
$p = this.elem.find("p");
$p.css({
"text-align": "left",
"padding-left": "0"
});
$space.css({
"margin-left": 0,
"text-align": "left"
});
if (_.isNumber(value)) {
$space.css("margin-left", value + "px");
}
else if (value === "auto") {
this.container.width("100%");
this.elem.width("100%");
//强制调整容器宽度为100%
this.options.width = "100%";
$p.each(function (i) {
var indent;
indent = self.cache.indent[i];
if (indent) {
if (indent.left > 0 && indent.right === 0) {
$(this).css("text-align", "right");
}
else if (indent.left > 0 && indent.right > 0) {
$(this).css("padding-left", Math.floor(indent.left / (indent.left + indent.right) * 100) + "%");
}
}
});
}
}
}
}
};

View File

@ -0,0 +1,88 @@
/* global $ */
// 自定义扩展一个新的工具栏元件 newTextbox
var newTextbox = {// eslint-disable-line
title: "newtextbox",
icon: "text.png",
design: function () {
var textbox = $("<input />")
.attr({
type: this.options.type,
name: this.options.name,
placeholder: this.options.placeholder,
"data-regex": this.options.regex,
})
.addClass(this.className)
.val(this.options.value);
this.container.append(textbox);
return textbox;
},
applying: function () {
var elem = this.design();
elem.removeAttr("readonly");
return elem;
},
getValue: function () {
return this.elem.val() || "";
},
setValue: function (value) {
this.options.value = value;
},
updateEvent: function () {
return [{
name: "change",
filter: ""
}];
},
className: "formbuilder-control-textbox",
options: {
label: "",
required: false,
placeholder: "",
name: "",
value: "",
type: "text",
className: "",
width: 60,
regex: ""
},
property: {
"name": {
"text": "name",
"type": "textbox",
update: function (value) {
this.elem.attr("name", value);
}
},
"placeholder": {
"text": "placeholder",
"type": "textbox",
update: function (value) {
this.elem.attr("placeholder", value);
}
},
"regex": {
"text": "regex",
"type": "textbox",
},
value: {
"text": "value",
type: "textbox",
update: function (value) {
this.elem.val(value);
}
},
width: {
width: "width",
type: "textbox",
source: {
readonly: true
},
update: function (value) {
this.elem.width(value);
}
}
}
};