Browse Source

Pull request #3447: KERNEL-14316 chore: 引入rollup,修复一些细节 BUG

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit '07aec861b9c95b0b4c4d96a0838f58de1fd3b791':
  KERNEL-14316 chore: 修复 string 的一些细节 BUG
  KERNEL-14316 chore: 引入rollup,修复一些细节 BUG
es6
treecat-罗群 2 years ago
parent
commit
61ae2a6130
  1. 39
      rollup.config.js
  2. 2
      src/case/button/node/treenode.js
  3. 21
      src/core/func/string.js
  4. 1
      src/widget/dynamicdate/dynamicdate.combo.js

39
rollup.config.js

@ -0,0 +1,39 @@
const babel = require("@rollup/plugin-babel");
const alias = require("@rollup/plugin-alias");
const resolve = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
const path = require("path");
// import { fileURLToPath } from "url";
// import path from "path";
// const __dirname = path.dirname(fileURLToPath(import.meta.url));
const input = "src/index.js";
module.exports = [
{
input,
output: [
{
file: "dist/fineui.esm.js",
format: "esm",
sourcemap: true
}
],
plugins: [
alias({
entries: [
{ find: "@", replacement: path.resolve(__dirname, "src") }
]
}),
resolve(),
babel({
babelHelpers: "runtime",
presets: ["@babel/preset-env"],
plugins: [
["@babel/plugin-proposal-decorators", { legacy: true }]
]
}),
commonjs()
]
}
];

2
src/case/button/node/treenode.js

@ -169,7 +169,7 @@ export class FirstPlusGroupNode extends BasicTreeNode {
}
}
@shortcut
@shortcut()
export class MidPlusGroupNode extends BasicTreeNode {
static xtype = "bi.mid_plus_group_node";

21
src/core/func/string.js

@ -1,4 +1,4 @@
import {isString} from "../2.base";
import { isString, each } from "../2.base";
/**
* 判断字符串是否已指定的字符串开始
@ -11,6 +11,7 @@ export function startWith(str, startTag) {
if (startTag == null || startTag == "" || str.length === 0 || startTag.length > str.length) {
return false;
}
return str.substring(0, startTag.length) == startTag;
}
@ -24,6 +25,7 @@ export function endWith(str, endTag) {
if (endTag == null || endTag == "" || str.length === 0 || endTag.length > str.length) {
return false;
}
return str.substring(str.length - endTag.length) == endTag;
}
@ -34,11 +36,12 @@ export function endWith(str, endTag) {
* @return {String} 参数的值
*/
export function getQuery(str, name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`);
const r = str.substr(str.indexOf("?") + 1).match(reg);
if (r) {
return unescape(r[2]);
}
return null;
}
@ -58,16 +61,17 @@ export function appendQuery(str, paras) {
src += "?";
}
// 如果以问号结尾,说明没有其他参数
if (BI.endWith(src, "?") !== false) {
} else {
if (!src.endsWith("?")) {
src += "&";
}
BI._.each(paras, function (value, name) {
each(paras, (name, value) => {
if (typeof (name) === "string") {
src += name + "=" + value + "&";
src += `${name}=${value}&`;
}
});
src = src.substr(0, src.length - 1);
return src;
}
@ -89,11 +93,11 @@ export function replaceAll(str, s1, s2) {
* @returns {String} 以指定字符开头的字符串
*/
export function perfectStart(str, start) {
if (BI.startWith(str, start)) {
if (str.startsWith(start)) {
return str;
}
return start + str;
return start + str;
}
/**
@ -117,5 +121,6 @@ export function allIndexOf(str, sub) {
str = str.substring(loc + sub.length, str.length);
offset += loc + sub.length;
}
return location;
}

1
src/widget/dynamicdate/dynamicdate.combo.js

@ -28,7 +28,6 @@ export class DynamicDateCombo extends Single {
static EVENT_ERROR = "EVENT_ERROR";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW";
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW";
static Static = 1;
static Dynamic = 2;

Loading…
Cancel
Save