Browse Source

Merge pull request #16365 in DEC/fineui from final/11.0 to persist/11.0

* commit 'e5ea6bb8c3261083d6c21ab5f6576f3f11b0b95b': (759 commits)
  chore: delete test file
  chore: test file
  fix: 补全一下,没修改全
  REPORT-63368 修复树组件展开后左边线对不齐问题
  auto upgrade version to 2.0.20220322093515
  无JIRA 补充类型
  auto upgrade version to 2.0.20220321104525
  feature: 支持align
  auto upgrade version to 2.0.20220321101434
  bugfix
  bi.table支持grid布局
  无JIRA任务 chore: 调整npmignore
  auto upgrade version to 2.0.20220317180458
  无jira任务 tab showIndex function v3
  无jira任务 tab showIndex function v2
  无jira任务 tab showIndex function v1
  无jira任务 tab showIndex function
  auto upgrade version to 2.0.20220316144457
  auto upgrade version to 2.0.20220316142521
  无JIRA任务 编号修改
  ...
master
superman 3 years ago
parent
commit
95ad6efc73
  1. 2
      .eslintrc
  2. 2
      .gitignore
  3. 7
      .npmignore
  4. 1
      babel.config.ie8.js
  5. 32
      bi.lessconfig.json
  6. 17
      changelog.md
  7. 26
      demo/app.js
  8. 6
      demo/js/base/tip/demo.toast.js
  9. 100
      demo/js/component/demo.form.js
  10. 4
      demo/js/config/component.js
  11. 48
      dist/fix/fix.compact.js
  12. 261
      dist/fix/fix.js
  13. 3903
      dist/fix/fix.proxy.js
  14. 72
      dist/fix/worker.compact.js
  15. BIN
      dist/font/iconfont.eot
  16. 1668
      dist/font/iconfont.svg
  17. BIN
      dist/font/iconfont.ttf
  18. BIN
      dist/font/iconfont.woff
  19. BIN
      dist/font/iconfont.woff2
  20. BIN
      dist/images/1x/background/marker.png
  21. BIN
      dist/images/1x/background/mask.png
  22. BIN
      dist/images/1x/background/wheel.png
  23. BIN
      dist/images/1x/icon/dark/tree_solid_collapse_1.png
  24. BIN
      dist/images/1x/icon/dark/tree_solid_collapse_2.png
  25. BIN
      dist/images/1x/icon/dark/tree_solid_collapse_3.png
  26. BIN
      dist/images/1x/icon/dark/tree_solid_collapse_4.png
  27. BIN
      dist/images/1x/icon/dark/tree_solid_collapse_5.png
  28. BIN
      dist/images/1x/icon/dark/tree_solid_expand_1.png
  29. BIN
      dist/images/1x/icon/dark/tree_solid_expand_2.png
  30. BIN
      dist/images/1x/icon/dark/tree_solid_expand_3.png
  31. BIN
      dist/images/1x/icon/dark/tree_solid_expand_4.png
  32. BIN
      dist/images/1x/icon/dark/tree_solid_expand_5.png
  33. BIN
      dist/images/1x/icon/dark/tree_solid_vertical_line_1.png
  34. BIN
      dist/images/1x/icon/dark/tree_solid_vertical_line_2.png
  35. BIN
      dist/images/1x/icon/dark/tree_solid_vertical_line_3.png
  36. BIN
      dist/images/1x/icon/dark/tree_solid_vertical_line_4.png
  37. BIN
      dist/images/1x/icon/tree_solid_collapse_1.png
  38. BIN
      dist/images/1x/icon/tree_solid_collapse_2.png
  39. BIN
      dist/images/1x/icon/tree_solid_collapse_3.png
  40. BIN
      dist/images/1x/icon/tree_solid_collapse_4.png
  41. BIN
      dist/images/1x/icon/tree_solid_collapse_5.png
  42. BIN
      dist/images/1x/icon/tree_solid_expand_1.png
  43. BIN
      dist/images/1x/icon/tree_solid_expand_2.png
  44. BIN
      dist/images/1x/icon/tree_solid_expand_3.png
  45. BIN
      dist/images/1x/icon/tree_solid_expand_4.png
  46. BIN
      dist/images/1x/icon/tree_solid_expand_5.png
  47. BIN
      dist/images/1x/icon/tree_solid_vertical_line_1.png
  48. BIN
      dist/images/1x/icon/tree_solid_vertical_line_2.png
  49. BIN
      dist/images/1x/icon/tree_solid_vertical_line_3.png
  50. BIN
      dist/images/1x/icon/tree_solid_vertical_line_4.png
  51. BIN
      dist/images/2x/background/marker.png
  52. BIN
      dist/images/2x/background/mask.png
  53. BIN
      dist/images/2x/background/wheel.png
  54. BIN
      dist/images/2x/icon/dark/tree_solid_collapse_1.png
  55. BIN
      dist/images/2x/icon/dark/tree_solid_collapse_2.png
  56. BIN
      dist/images/2x/icon/dark/tree_solid_collapse_3.png
  57. BIN
      dist/images/2x/icon/dark/tree_solid_collapse_4.png
  58. BIN
      dist/images/2x/icon/dark/tree_solid_collapse_5.png
  59. BIN
      dist/images/2x/icon/dark/tree_solid_expand_1.png
  60. BIN
      dist/images/2x/icon/dark/tree_solid_expand_2.png
  61. BIN
      dist/images/2x/icon/dark/tree_solid_expand_3.png
  62. BIN
      dist/images/2x/icon/dark/tree_solid_expand_4.png
  63. BIN
      dist/images/2x/icon/dark/tree_solid_expand_5.png
  64. BIN
      dist/images/2x/icon/dark/tree_solid_vertical_line_1.png
  65. BIN
      dist/images/2x/icon/dark/tree_solid_vertical_line_2.png
  66. BIN
      dist/images/2x/icon/dark/tree_solid_vertical_line_3.png
  67. BIN
      dist/images/2x/icon/dark/tree_solid_vertical_line_4.png
  68. BIN
      dist/images/2x/icon/tree_solid_collapse_1.png
  69. BIN
      dist/images/2x/icon/tree_solid_collapse_2.png
  70. BIN
      dist/images/2x/icon/tree_solid_collapse_3.png
  71. BIN
      dist/images/2x/icon/tree_solid_collapse_4.png
  72. BIN
      dist/images/2x/icon/tree_solid_collapse_5.png
  73. BIN
      dist/images/2x/icon/tree_solid_expand_1.png
  74. BIN
      dist/images/2x/icon/tree_solid_expand_2.png
  75. BIN
      dist/images/2x/icon/tree_solid_expand_3.png
  76. BIN
      dist/images/2x/icon/tree_solid_expand_4.png
  77. BIN
      dist/images/2x/icon/tree_solid_expand_5.png
  78. BIN
      dist/images/2x/icon/tree_solid_vertical_line_1.png
  79. BIN
      dist/images/2x/icon/tree_solid_vertical_line_2.png
  80. BIN
      dist/images/2x/icon/tree_solid_vertical_line_3.png
  81. BIN
      dist/images/2x/icon/tree_solid_vertical_line_4.png
  82. 3200
      dist/router.js
  83. 6
      examples/config-render.html
  84. 4
      examples/demo.worker.js
  85. 83
      examples/dev.html
  86. 6
      examples/effect.html
  87. 6
      examples/hooks.html
  88. 6
      examples/loader-context.html
  89. 6
      examples/resize.html
  90. 6
      examples/style.html
  91. 6
      examples/tab-context.html
  92. 6
      examples/test-id.html
  93. 97
      examples/useContext.html
  94. 6
      examples/virtual-group.html
  95. 6
      examples/visible.html
  96. 7
      examples/worker.html
  97. 419
      examples/响应式布局.html
  98. 8
      examples/插件设计.html
  99. 5
      i18n/i18n.cn.js
  100. 1
      index.html
  101. Some files were not shown because too many files have changed in this diff Show More

2
.eslintrc

@ -29,6 +29,8 @@
"files": ["src/*.js","src/**/*.js", "demo/*.js", "demo/**/*.js", "i18n/**/*.js", "i18n/*.js", "test/**/*.js", "test/*.js"],
"extends": "plugin:@fui/es5",
"rules": {
"no-param-reassign": "off",
"quotes": [2, "double"],
"comma-dangle": ["error", "never"] // 多行对象字面量中要求拖尾逗号
}
}, {

2
.gitignore vendored

@ -8,4 +8,4 @@ unit.test.statistic.json
package-lock.json
yarn.lock
*.tgz
dist/
dist/

7
.npmignore

@ -1,7 +1,6 @@
*
!src/less/*.less
!src/less/lib/*.less
!src/less/resource/*.less
!public/less/*.less
!src/less/**/*
!dist/lib/*.d.ts
!dist/lib/**/*.d.ts
!dist/font.css
@ -37,3 +36,5 @@
!babel.config.js
!babel.config.ie8.js
!.eslintrc
!dist/2.0/jsy.min.css
!dist/2.0/bi.min.css

1
babel.config.ie8.js

@ -1 +0,0 @@
module.exports = require('@fui/babel-preset-fineui').configs.ie8;

32
bi.lessconfig.json

@ -0,0 +1,32 @@
{
"@color-primary": "#2C60DB",
"@color-green-100": "#3FC47B",
"@color-light-blue-100": "#19B8EA",
"@color-orange-100": "#FAAA39",
"@color-red-100": "#E65251",
"@color-black": "#000A19",
"@color-light-gray": "#ECEEF3",
"@color-light-gray-theme-dark": "#292F45",
"@border-color-dark-line": "#2E3A4D",
"@color-sliver-theme-dark": "#363E55",
"@border-color-disabled": "#E7E8EB",
"@color-bi-background-active-radio": "transparent",
"@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-background-disabled-active-radio-content": "#D0D4DA",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#D0D4DA",
"@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479",
"@color-bi-background-tooltip-success": "#2E3A4D",
"@color-bi-text-header-background": "#647185",
"@color-bi-border-tooltip-success": "#2E3A4D",
"@color-bi-background-toast-success": "#FFFFFF",
"@color-bi-background-toast-warning": "#FFFFFF",
"@color-bi-background-toast-error": "#FFFFFF",
"@color-bi-background-toast-normal": "#FFFFFF",
"@color-bi-color-toast-success": "#3FC47B",
"@color-bi-color-toast-warning": "#FAAA39",
"@color-bi-color-toast-error": "#E65251",
"@color-bi-color-toast-normal": "#2C60DB",
"@color-bi-color-toast-text": "#000A19"
}

17
changelog.md

@ -1,6 +1,23 @@
# 更新日志
2.0(2022-01)
- 提供自定义表单
2.0(2021-12)
- 新增Context组件
- toast支持closable属性,可控制是否显示关闭按钮
- 新增气泡弹框控件
- BI.point支持widget添加埋点
- childContext废弃,替换成provide
- 支持BI.useContext获取上下文环境
- BI.Msg.alert支持message传json格式
- 支持BI.config(function(){})进行系统配置
2.0(2021-11)
- 限制了复选下拉框一次粘贴添加值个数最大2000
2.0(2021-10)
- combo增加window.blur事件触发隐藏
2.0(2021-09)
- 支持自动watch
- 支持h函数传递left、right,优化left_right_vertical_adapt布局的jsx写法

26
demo/app.js

@ -40,7 +40,7 @@ BI.$(function () {
height: 100
}, {
type: "bi.router_view",
name: 'home',
name: 'tool-buttons',
deps: 1
}]
});
@ -49,12 +49,6 @@ BI.$(function () {
path: '',
components: {
default: function () {
return Promise.resolve({
type: "bi.label",
text: 'default'
});
},
home: function () {
return Promise.resolve({
type: "bi.label",
text: 'home'
@ -73,11 +67,19 @@ BI.$(function () {
}, {
name: 'tables',
path: 'tables/:id',
component: function () {
return Promise.resolve({
type: "bi.label",
text: 'tables'
});
components: {
default: function () {
return Promise.resolve({
type: "bi.label",
text: 'table-view'
});
},
"tool-buttons": function () {
return Promise.resolve({
type: "bi.label",
text: '预览按钮',
});
},
}
}]
}];

6
demo/js/base/tip/demo.toast.js

@ -10,7 +10,9 @@ Demo.Toast = BI.inherit(BI.Widget, {
text: "简单Toast测试(success)",
height: 30,
handler: function () {
BI.Msg.toast("这是一条简单的数据");
BI.Msg.toast("这是一条简单的数据", {
level: "success"
});
}
}
}, {
@ -20,7 +22,7 @@ Demo.Toast = BI.inherit(BI.Widget, {
height: 30,
handler: function () {
BI.Msg.toast("这是一条很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的数据", {
level: "normal"
});
}
}

100
demo/js/component/demo.form.js

@ -0,0 +1,100 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2022/1/11
*/
Demo.Form = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-form"
},
render: function () {
var widget = BI.createWidget({
type: "bi.custom_form",
width: 300,
labelWidth: 100,
items: [{
validate: function (v) {
return v !== "a" && v !== "";
},
tip: function (v) {
if (BI.isEmpty(v)) {
return "不能为空";
}
return "不合法格式"
},
label: "E-mail",
el: {
type: 'bi.text_editor',
watermark: "输入a报错",
allowBlank: true,
}
}, {
validate: function (v) {
return BI.isNotEmptyArray(v);
},
tip: function () {
return "不能为空";
},
label: "性别",
el: {
type: 'bi.text_value_combo',
text: "请选择",
items: [{
text: "男",
value: 1
}, {
text: "女",
value: 2
}]
}
}, {
validate: function (v) {
return v !== "";
},
tip: function () {
return "不能为空";
},
label: "姓名",
el: {
type: 'bi.text_editor',
watermark: "输入姓名",
allowBlank: true,
}
}, {
validate: function (v) {
return v !== "";
},
tip: function () {
return "不能为空";
},
label: "姓名",
el: {
type: 'bi.textarea_editor',
cls: 'bi-border',
watermark: "输入简介",
allowBlank: true,
height: 200,
}
}],
layout: {
type: "bi.vertical",
vgap: 30
}
});
return {
type: "bi.vertical",
hgap: 200,
vgap: 10,
items: [widget, {
type: "bi.button",
text: "提交",
handler: function () {
widget.validate();
console.log(widget.getValue());
}
}]
};
}
});
BI.shortcut("demo.form", Demo.Form);

4
demo/js/config/component.js

@ -20,4 +20,8 @@ Demo.COMPONENT_CONFIG = [{
pId: 5,
text: "bi.tree_value_chooser_pane",
value: "demo.tree_value_chooser_pane"
}, {
pId: 5,
text: "demo.form",
value: "demo.form"
}];

48
dist/fix/fix.compact.js vendored

@ -55,6 +55,8 @@
Fix.Model.target = target = targetStack.pop();
}
BI.Model = Fix.Model;
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
@ -97,23 +99,17 @@
}
}
// _.each(["populate", "addItems", "prependItems"], function (name) {
// var old = BI.Loader.prototype[name];
// BI.Loader.prototype[name] = function () {
// BI.Widget.pushContext(this);
// try {
// var result = old.apply(this, arguments);
// } catch (e) {
// console.error(e);
// }
// BI.Widget.popContext();
// return result;
// };
// });
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var workerMode = BI.Providers.getProvider("bi.provider.system").getWorkerMode();
if (workerMode && this._worker) {
return;
}
if (this.store) {
pushTarget(this.store);
return true;
}
if (this._store) {
var store = findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) {
pushTarget(store);
@ -146,22 +142,20 @@
needPop && popTarget();
};
var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () {
var needPop = false;
if (_global.Fix && this._store) {
needPop = true;
pushTarget(this.store);
var __initWatch = BI.Widget.prototype.__initWatch;
BI.Widget.prototype.__initWatch = function () {
__initWatch.apply(this, arguments);
var workerMode = BI.Providers.getProvider("bi.provider.system").getWorkerMode();
if (workerMode && this._worker) {
return;
}
_render.apply(this, arguments);
if (_global.Fix && this._store) {
if (this._store) {
initWatch(this, this.watch);
}
needPop && popTarget();
};
var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () {
var unMount = BI.Widget.prototype.__destroy;
BI.Widget.prototype.__destroy = function () {
try {
unMount.apply(this, arguments);
} catch (e) {
@ -183,7 +177,7 @@
delete this.__cacheStore;
};
_.each(["__afterRender", "_mount", "__afterMount"], function (name) {
_.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store);

261
dist/fix/fix.js vendored

@ -90,12 +90,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
}
var bailRE = /[^\w.$]/;
// const bailRE = /[^\w.$]/
function parsePath(path) {
if (bailRE.test(path)) {
return;
}
// 正常表达式比较慢,能不要的就不要了
// if (bailRE.test(path)) {
// return
// }
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
@ -134,8 +135,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
setImmediate(nextTickHandler);
};
} else if (typeof MessageChannel !== 'undefined' && (isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
var channel = new MessageChannel();
var port = channel.port2;
channel.port1.onmessage = nextTickHandler;
@ -144,18 +145,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
};
} else
/* istanbul ignore next */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick(cb, ctx) {
var _resolve = void 0;
@ -294,7 +295,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (isIE9Below) {
var VBClassPool = {};
window.execScript([// jshint ignore:line
'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码
'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码
].join('\n'), 'VBScript');
var VBMediator = function VBMediator(instance, accessors, name, value) {
@ -310,7 +311,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// jshint ignore:line
var buffer = [];
buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用
'\tEnd Function');
'\tEnd Function');
//添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好
var uniq = {
$vbthis: true,
@ -330,12 +331,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
uniq[name] = true;
buffer.push(
//由于不知对方会传入什么,因此set, let都用上
'\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter
'\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回
'\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property');
//由于不知对方会传入什么,因此set, let都用上
'\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter
'\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回
'\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property');
}
for (name in properties) {
@ -353,7 +354,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
className = makeHashCode('VBClass');
window.parseVB('Class ' + className + body);
window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数
'\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n'));
'\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n'));
VBClassPool[body] = className;
}
var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品
@ -537,10 +538,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (this.active) {
var value = this.get();
if (value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
_.isObject(value) && options && options.refresh || this.deep) {
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
_.isObject(value) && options && options.refresh || this.deep) {
// set new value
var oldValue = this.value;
this.value = value;
@ -578,7 +579,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
remove(this.vm._watchers, this);
remove(this.vm && this.vm._watchers, this);
var i = this.deps.length;
while (i--) {
this.deps[i].removeSub(this);
@ -903,6 +904,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return target;
}
function freeze() {
return Object.freeze.apply(null, arguments);
}
/**
* Delete a property and trigger change if necessary.
*/
@ -975,7 +980,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
options = options || {};
options.user = true;
var exps = void 0;
if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) {
if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && expOrFn.indexOf("*") < 0) {
var watcher = new Watcher(model, expOrFn, cb, options);
if (options.immediate) {
cb(watcher.value);
@ -1016,45 +1021,96 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (_.has(operators, exp)) {
return;
}
//a.**或a.*形式
if (/^[1-9a-zA-Z.]+(\*\*$|\*$)/.test(exp) || exp === "**") {
var isGlobal = /\*\*$/.test(exp);
if (isGlobal) {
//a.**的形式
exp = exp.replace(".**", "");
} else {
//a.*的形式
exp = exp.replace(".*", "");
if (exp.indexOf("*") >= 0) {
//a.**或a.*形式
if (/^[1-9a-zA-Z.]+(\*\*$|\*$)/.test(exp) || exp === "**" || exp === "*") {
var isGlobal = exp.indexOf("**") >= 0;
if (isGlobal) {
//a.**的形式
exp = exp.replace(".**", "");
} else {
//a.*的形式
exp = exp.replace(".*", "");
}
var getter = exp === "**" || exp === "*" ? function (m) {
return m;
} : parsePath(exp);
var v = getter.call(model, model);
var _dep = new Dep();
if (isGlobal) {
(v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(_dep);
} else {
(v.__ob__._deps || (v.__ob__._deps = [])).push(_dep);
}
var _w = new Watcher(model, function () {
_dep.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
_w.teardown();
v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, _dep);
v.__ob__._deps && remove(v.__ob__._deps, _dep);
});
return;
}
var getter = exp === "**" ? function (m) {
return m;
} : parsePath(exp);
var v = getter.call(model, model);
var dep = new Dep();
if (isGlobal) {
(v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(dep);
} else {
(v.__ob__._deps || (v.__ob__._deps = [])).push(dep);
// **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了
if (/^(\*\*\.)+[1-9a-zA-Z]+(\.\*\*$)/.test(exp)) {
//先获取到能获取到的对象
var _paths = exp.split(".");
var _currentModel = model[_paths[1]];
exp = _paths[1] + ".**";
//补全路径
var _parent = _currentModel.__ob__.parent,
_root = _currentModel.__ob__;
while (_parent) {
exp = '*.' + exp;
_root = _parent;
_parent = _parent.parent;
}
var _regStr = routeToRegExp(exp);
var _dep2 = new Dep();
_root._globalDeps || (_root._globalDeps = {});
if (_.isArray(_root._globalDeps[_regStr])) {
_root._globalDeps[_regStr].push(_dep2);
} else {
_root._globalDeps[_regStr] = [_dep2];
}
var _w2 = new Watcher(_currentModel, function () {
_dep2.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
if (_root._globalDeps) {
remove(_root._globalDeps[_regStr], _dep2);
if (_root._globalDeps[_regStr].length === 0) {
delete _root._globalDeps[_regStr];
_w2.teardown();
}
}
});
return;
}
var w = new Watcher(model, function () {
dep.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
w.teardown();
v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, dep);
v.__ob__._deps && remove(v.__ob__._deps, dep);
});
return;
}
// **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了
if (/^(\*\*\.)+[1-9a-zA-Z]+(\.\*\*$)/.test(exp)) {
// 再有结尾有*的就不支持了
if (exp[exp.length - 1] === "*") {
throw new Error('not support');
}
//其他含有*的情况,如*.a,*.*.a,a.*.a
var currentModel = model;
//先获取到能获取到的对象
var paths = exp.split(".");
var currentModel = model[paths[1]];
exp = paths[1] + ".**";
for (var _i = 0, len = paths.length; _i < len; _i++) {
if (paths[_i] === "*") {
break;
}
currentModel = model[paths[_i]];
}
exp = exp.substr(exp.indexOf("*"));
//补全路径
var parent = currentModel.__ob__.parent,
root = currentModel.__ob__;
@ -1064,77 +1120,26 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
parent = parent.parent;
}
var regStr = routeToRegExp(exp);
var _dep = new Dep();
var dep = new Dep();
root._globalDeps || (root._globalDeps = {});
if (_.isArray(root._globalDeps[regStr])) {
root._globalDeps[regStr].push(_dep);
root._globalDeps[regStr].push(dep);
} else {
root._globalDeps[regStr] = [_dep];
root._globalDeps[regStr] = [dep];
}
var _w = new Watcher(currentModel, function () {
_dep.depend();
var w = new Watcher(currentModel, function () {
dep.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
if (root._globalDeps) {
remove(root._globalDeps[regStr], _dep);
remove(root._globalDeps[regStr], dep);
if (root._globalDeps[regStr].length === 0) {
delete root._globalDeps[regStr];
_w.teardown();
}
}
});
return;
}
if (/\*\*$|\*$/.test(exp)) {
throw new Error('not support');
}
//其他含有*的情况,如*.a,*.*.a,a.*.a
if (/\*/.test(exp)) {
var _currentModel = model;
//先获取到能获取到的对象
var _paths = exp.split(".");
for (var _i = 0, len = _paths.length; _i < len; _i++) {
if (_paths[_i] === "*") {
break;
}
_currentModel = model[_paths[_i]];
}
exp = exp.substr(exp.indexOf("*"));
//补全路径
var _parent = _currentModel.__ob__.parent,
_root = _currentModel.__ob__;
while (_parent) {
exp = '*.' + exp;
_root = _parent;
_parent = _parent.parent;
}
var _regStr = routeToRegExp(exp);
var _dep2 = new Dep();
_root._globalDeps || (_root._globalDeps = {});
if (_.isArray(_root._globalDeps[_regStr])) {
_root._globalDeps[_regStr].push(_dep2);
} else {
_root._globalDeps[_regStr] = [_dep2];
}
var _w2 = new Watcher(_currentModel, function () {
_dep2.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
if (_root._globalDeps) {
remove(_root._globalDeps[_regStr], _dep2);
if (_root._globalDeps[_regStr].length === 0) {
delete _root._globalDeps[_regStr];
_w2.teardown();
w.teardown();
}
}
});
@ -1420,12 +1425,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var context = this.context;
var inject = this.inject;
var childContext = this.childContext;
var provide = this.provide;
var watch$$1 = this.watch;
var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(inject || []).concat(context || []);
var mixins = this.mixins;
defineProps(this, keys);
// deprecated
childContext && defineContext(this, childContext);
provide && defineContext(this, provide);
this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this.init();
@ -1515,6 +1523,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.notify = notify;
exports.defineReactive = defineReactive;
exports.set = set;
exports.freeze = freeze;
exports.del = del;
exports.Watcher = Watcher;
exports.pushTarget = pushTarget;

3903
dist/fix/fix.proxy.js vendored

File diff suppressed because it is too large Load Diff

72
dist/fix/worker.compact.js vendored

@ -1,10 +1,17 @@
;(function () {
var contexts = {};
var init = false;
var WORKER;
BI.useWorker = function (wk) {
WORKER = wk;
var enableWorker = function () {
if (init) {
return init;
}
// 开启Worker模式
BI.config("bi.provider.system", function (provider) {
provider.setWorkerMode(true);
});
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {
this.$destroyWorker = createWorker.call(this);
@ -46,7 +53,16 @@
console.error(e);
}
};
init = postMessage;
return postMessage;
};
BI.useWorker = function (wk) {
if (!_global.Worker || !_global.Proxy) {
return;
}
var postMessage = enableWorker();
WORKER = wk;
if (WORKER) {
WORKER.addEventListener("message", function (e) {
var data = e.data;
@ -72,7 +88,7 @@
name: name,
eventType: "create",
options: options,
watches: BI.map(this.watch, function (key) {
watches: BI.map(this.$watch || this.watch, function (key) {
return key;
})
});
@ -101,57 +117,7 @@
eventType: "destroy"
});
};
} else {
this.store = BI.Models.getModel(modelType, options);
this.store && (this.store._widget = this);
if (this.store instanceof Fix.Model) {
this.model = this.store.model;
} else {
this.model = this.store;
}
initWatch(this, this.watch);
return function () {
this.store && BI.isFunction(this.store.destroy) && this.store.destroy();
BI.each(this._watchers, function (i, unwatches) {
unwatches = BI.isArray(unwatches) ? unwatches : [unwatches];
BI.each(unwatches, function (j, unwatch) {
unwatch();
});
});
this._watchers && (this._watchers = []);
if (this.store) {
this.store._parent && (this.store._parent = null);
this.store._widget && (this.store._widget = null);
this.store = null;
}
};
}
}
}
function initWatch (vm, watch) {
vm._watchers || (vm._watchers = []);
for (var key in watch) {
var handler = watch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i]));
}
} else {
vm._watchers.push(createWatcher(vm, key, handler));
}
}
}
function createWatcher (vm, keyOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
}
options = options || {};
return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, {
store: vm.store
}));
}
}());

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

1668
dist/font/iconfont.svg vendored

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 424 KiB

After

Width:  |  Height:  |  Size: 607 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

BIN
dist/images/1x/background/marker.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

BIN
dist/images/1x/background/mask.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

BIN
dist/images/1x/background/wheel.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
dist/images/1x/icon/dark/tree_solid_collapse_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

BIN
dist/images/1x/icon/dark/tree_solid_collapse_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

BIN
dist/images/1x/icon/dark/tree_solid_collapse_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

BIN
dist/images/1x/icon/dark/tree_solid_collapse_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

BIN
dist/images/1x/icon/dark/tree_solid_collapse_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

BIN
dist/images/1x/icon/dark/tree_solid_expand_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
dist/images/1x/icon/dark/tree_solid_expand_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

BIN
dist/images/1x/icon/dark/tree_solid_expand_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
dist/images/1x/icon/dark/tree_solid_expand_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

BIN
dist/images/1x/icon/dark/tree_solid_expand_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

BIN
dist/images/1x/icon/dark/tree_solid_vertical_line_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

BIN
dist/images/1x/icon/dark/tree_solid_vertical_line_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
dist/images/1x/icon/dark/tree_solid_vertical_line_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

BIN
dist/images/1x/icon/dark/tree_solid_vertical_line_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

BIN
dist/images/1x/icon/tree_solid_collapse_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

BIN
dist/images/1x/icon/tree_solid_collapse_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

BIN
dist/images/1x/icon/tree_solid_collapse_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

BIN
dist/images/1x/icon/tree_solid_collapse_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

BIN
dist/images/1x/icon/tree_solid_collapse_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

BIN
dist/images/1x/icon/tree_solid_expand_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

BIN
dist/images/1x/icon/tree_solid_expand_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

BIN
dist/images/1x/icon/tree_solid_expand_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
dist/images/1x/icon/tree_solid_expand_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

BIN
dist/images/1x/icon/tree_solid_expand_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

BIN
dist/images/1x/icon/tree_solid_vertical_line_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
dist/images/1x/icon/tree_solid_vertical_line_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
dist/images/1x/icon/tree_solid_vertical_line_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

BIN
dist/images/1x/icon/tree_solid_vertical_line_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

BIN
dist/images/2x/background/marker.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

BIN
dist/images/2x/background/mask.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

BIN
dist/images/2x/background/wheel.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
dist/images/2x/icon/dark/tree_solid_collapse_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

BIN
dist/images/2x/icon/dark/tree_solid_collapse_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

BIN
dist/images/2x/icon/dark/tree_solid_collapse_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

BIN
dist/images/2x/icon/dark/tree_solid_collapse_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

BIN
dist/images/2x/icon/dark/tree_solid_collapse_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

BIN
dist/images/2x/icon/dark/tree_solid_expand_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

BIN
dist/images/2x/icon/dark/tree_solid_expand_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

BIN
dist/images/2x/icon/dark/tree_solid_expand_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

BIN
dist/images/2x/icon/dark/tree_solid_expand_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

BIN
dist/images/2x/icon/dark/tree_solid_expand_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
dist/images/2x/icon/dark/tree_solid_vertical_line_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
dist/images/2x/icon/dark/tree_solid_vertical_line_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

BIN
dist/images/2x/icon/dark/tree_solid_vertical_line_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

BIN
dist/images/2x/icon/dark/tree_solid_vertical_line_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

BIN
dist/images/2x/icon/tree_solid_collapse_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

BIN
dist/images/2x/icon/tree_solid_collapse_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

BIN
dist/images/2x/icon/tree_solid_collapse_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

BIN
dist/images/2x/icon/tree_solid_collapse_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

BIN
dist/images/2x/icon/tree_solid_collapse_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

BIN
dist/images/2x/icon/tree_solid_expand_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

BIN
dist/images/2x/icon/tree_solid_expand_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

BIN
dist/images/2x/icon/tree_solid_expand_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

BIN
dist/images/2x/icon/tree_solid_expand_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

BIN
dist/images/2x/icon/tree_solid_expand_5.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

BIN
dist/images/2x/icon/tree_solid_vertical_line_1.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
dist/images/2x/icon/tree_solid_vertical_line_2.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

BIN
dist/images/2x/icon/tree_solid_vertical_line_3.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

BIN
dist/images/2x/icon/tree_solid_vertical_line_4.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

3200
dist/router.js vendored

File diff suppressed because it is too large Load Diff

6
examples/config-render.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

4
examples/demo.worker.js

@ -1,6 +1,6 @@
if (this.importScripts) {
importScripts("../dist/fineui_without_jquery_polyfill.js");
BI.initWorker();
importScripts("https://fanruan.design/fineui/fineui_without_jquery_polyfill.js");
BI.useInWorker();
}
var Model = BI.inherit(Fix.Model, {
state: function () {

83
examples/dev.html

@ -2,67 +2,90 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<!-- <script src="../dist/2.0/fineui.js"></script>-->
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<script src="http://localhost:9001/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
var Model = BI.inherit(Fix.Model, {
// tab上下文环境测试
var Model = BI.inherit(BI.Model, {
state: function () {
return {
columnSize: [200, "fill"]
expand: false
};
},
childContext: ["text"],
computed: {
text: function () {
return this.model.expand ? "text-yes" : "text-not";
}
},
actions: {
toggle: function () {
this.model.expand = !this.model.expand;
}
}
});
BI.model("demo.model", Model);
var Child = BI.inherit(BI.Widget, {
render: function () {
var label;
var context = BI.useContext();
setInterval(function () {
context.toggle();
}, 1000);
// BI.watch(context, "expand", function () {
// label.setText(context.model.text);
// });
return {
type: "bi.label",
ref: function (_ref) {
label = _ref;
},
effect: function (w) {
w.setText(context.model.text);
},
text: function () {
return context.model.text;
}
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
height: 200,
width: 600
},
_store: function () {
return BI.Models.getModel("demo.model");
},
setup: function () {
var child;
var store = BI.useStore();
return function () {
return {
type: "bi.htape",
columnSize: function () {
return store.model.columnSize;
},
type: "bi.vertical",
vgap: 20,
items: [{
type: "bi.label",
css: {
background: "#eee"
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, {
type: "bi.center_adapt",
css: {
background: "#e0e0e0"
},
items: [{
type: "bi.button",
text: "点击",
handler: function () {
store.model.columnSize = [300, "fill"]
}
}]
}]
};
};
}
});
BI.shortcut("demo.hooks", Widget);
BI.shortcut("demo.parent", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.hooks"
type: "demo.parent"
},
top: 100,
left: 100

6
examples/effect.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/hooks.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/loader-context.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/resize.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/style.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/tab-context.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/test-id.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

97
examples/useContext.html

@ -0,0 +1,97 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
// tab上下文环境测试
var Model = BI.inherit(BI.Model, {
state: function () {
return {
expand: false
};
},
childContext: ["text"],
computed: {
text: function () {
return this.model.expand ? "text-yes" : "text-not";
}
},
actions: {
toggle: function () {
this.model.expand = !this.model.expand;
}
}
});
BI.model("demo.model", Model);
var Child = BI.inherit(BI.Widget, {
render: function () {
var label;
var context = BI.useContext();
setInterval(function () {
context.toggle();
}, 1000);
// BI.watch(context, "expand", function () {
// label.setText(context.model.text);
// });
return {
type: "bi.label",
ref: function (_ref) {
label = _ref;
},
effect: function (w) {
w.setText(context.model.text);
},
text: function () {
return context.model.text;
}
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model");
},
setup: function () {
var child;
var store = BI.useStore();
return function () {
return {
type: "bi.vertical",
vgap: 20,
items: [{
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}]
};
};
}
});
BI.shortcut("demo.parent", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.parent"
},
top: 100,
left: 100
}],
element: "#wrapper"
});
</script>
</body>
</html>

6
examples/virtual-group.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

6
examples/visible.html

@ -2,8 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

7
examples/worker.html

@ -2,9 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="../dist/2.0/fineui.js"></script>
<script src="../dist/fix/worker.compact.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
<script src="demo.worker.js"></script>
</head>
<body>

419
examples/响应式布局.html

@ -0,0 +1,419 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>PullRequest | Code Review as a Service</title>
<meta
name="description"
content="PullRequest is a platform for code review, built for teams of all sizes. We have thousands of on-demand reviewers and they are backed by best-in-class automation tools. Because code quality is important."
/>
<meta name="theme-color" content="#28557a" />
<link
rel="stylesheet"
type="text/css"
href="https://fanruan.design/fineui/2.0/fineui_without_normalize.css"
/>
<!-- <script src="../dist/2.0/fineui.js"></script>-->
<script src="https://fanruan.design/fineui/2.0/fineui.js"></script>
<style>
*,
:after,
:before {
box-sizing: border-box;
}
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, segoe ui, Roboto,
helvetica neue, Arial, noto sans, liberation sans, sans-serif,
apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
height: 100vh;
background-color: #fff;
}
#wrapper {
height: 100vh;
}
.nav {
box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%);
}
.nav-logo {
background-image: url(https://qn.wangchuan.cc/pullrequest-logo.svg);
background-repeat: no-repeat;
background-position: 50%;
background-size: contain;
}
.image {
background-image: url(https://qn.wangchuan.cc/hero-graphic.png);
background-repeat: no-repeat;
background-size: contain;
}
.demo {
cursor: pointer;
border-radius: 3px;
font-weight: 600;
color: #fff;
background: #4aa4e0 linear-gradient(180deg, #65b2e5, #4aa4e0) repeat-x;
border: 1px solid #4aa4e0;
}
.signup {
cursor: pointer;
border-radius: 3px;
font-weight: 600;
color: #4aa4e0;
border: 1px solid #4aa4e0;
}
.wave {
background-image: url(https://qn.wangchuan.cc/wave.png);
background-size: cover;
background-repeat: repeat-x;
}
</style>
</head>
<body>
<div id="wrapper"></div>
<script>
BI.config("bi.provider.system", function (provider) {
provider.setResponsiveMode(true);
});
var Widget = BI.inherit(BI.Widget, {
props: {},
render: function () {
return [
{
type: "bi.vertical",
items: [
{
el: {
type: "bi.vertical_adapt",
cls: "nav",
css: {
position: "fixed",
left: 0,
right: 0,
zIndex: 1000,
},
height: 62,
hgap: 16,
items: [
{
type: "bi.layout",
cls: "nav-logo",
width: 185,
height: 46,
},
],
},
},
{
tgap: 112,
el: {
type: "bi.center_adapt",
columnSize: ["fill", "fill"],
vgap: 24,
items: [
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
el: {
type: "bi.text",
css: {
fontSize: "24px",
fontWeight: "700",
color: "#092353",
},
text: "Code Review as a Service",
},
},
{
el: {
type: "bi.text",
css: {
fontSize: "16px",
lineHeight: "24px",
color: "#28557a",
},
text: "Increase velocity and reduce technical debt through quality code review by expert engineers backed by best-in-class automation.",
},
tgap: 24,
bgap: 24,
},
{
el: {
type: "bi.vertical_adapt",
vgap: 16,
items: [
{
el: {
type: "bi.label",
hgap: 24,
height: 48,
cls: "demo",
text: "Schedule demo",
},
},
{
el: {
type: "bi.label",
hgap: 24,
height: 48,
cls: "signup",
text: "Sign up",
},
lgap: 30,
rgap: 15,
},
],
},
},
],
},
},
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
el: {
type: "bi.vertical",
items: [
{
type: "bi.img",
attributes: {
width: 595,
},
css: {
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/hero-graphic.png",
width: "auto",
height: "auto",
},
],
},
},
],
},
},
],
},
},
{
type: "bi.layout",
cls: "wave",
height: 112,
},
{
el: {
type: "bi.center_adapt",
columnSize: ["fill"],
css: {
background: "#f5fbff",
},
hgap: 0.1,
vgap: 64,
items: [
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
type: "bi.text",
lineHeight: 30,
css: {
fontSize: "22px",
color: "#092353",
},
text: "Empower your development team with the help of world-class engineers. ",
},
{
type: "bi.text",
lineHeight: 24,
css: {
fontSize: "16px",
color: "#28557a",
},
text: "PullRequest provides on-demand code review by world-class engineers, built for teams of any size. We review within your tools to catch security threats, stop crashes, and fix performance issues before they reach production.",
},
],
},
},
],
},
},
{
el: {
type: "bi.center_adapt",
columnSize: ["fill", "fill"],
vgap: 48,
items: [
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
el: {
type: "bi.text",
css: {
fontSize: "24px",
fontWeight: "700",
color: "#092353",
},
text: "Move fast and reduce cycle times.",
},
},
{
el: {
type: "bi.text",
css: {
fontSize: "16px",
lineHeight: "24px",
color: "#28557a",
},
text: "Save time reviewing code so you can focus on shipping new features.",
},
tgap: 24,
bgap: 24,
},
],
},
},
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
el: {
type: "bi.vertical",
items: [
{
type: "bi.img",
attributes: {
width: 595,
},
css: {
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/velocity.png",
width: "auto",
height: "auto",
},
],
},
},
],
},
},
],
},
},
{
el: {
type: "bi.center_adapt",
css: {
background: "#f5fbff",
},
columnSize: ["fill", "fill"],
vgap: 48,
items: [
{
el: {
type: "bi.vertical",
hgap: 15,
items: [
{
el: {
type: "bi.vertical",
items: [
{
type: "bi.img",
attributes: {
width: 595,
},
css: {
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/secure.png",
width: "auto",
height: "auto",
},
],
},
},
],
},
},
{
el: {
type: "bi.vertical",
rgap: 15,
lgap: 0.1,
items: [
{
el: {
type: "bi.text",
css: {
fontSize: "24px",
fontWeight: "700",
color: "#092353",
},
text: "Secure your codebase.",
},
},
{
el: {
type: "bi.text",
css: {
fontSize: "16px",
lineHeight: "24px",
color: "#28557a",
},
text: "Deliver high quality code with an extra line of defense to prevent security vulnerabilities and other fatal flaws.",
},
tgap: 24,
bgap: 24,
},
],
},
},
],
},
},
],
},
];
},
});
BI.shortcut("demo.responsive", Widget);
BI.createWidget({
type: "demo.responsive",
element: "#wrapper",
});
</script>
</body>
</html>

8
examples/插件设计.html

@ -2,10 +2,10 @@
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />-->
<!-- <script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>-->
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css" />
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
</head>
<body>
<div id="wrapper"></div>

5
i18n/i18n.cn.js

@ -197,5 +197,8 @@ BI.i18n = {
"BI-Basic_Year_Month_Range_Error": "请选择{R1}年{R2}月-{R3}年{R4}月的日期",
"BI-Basic_Year_Quarter_Range_Error": "请选择{R1}年{R2}季度-{R3}年{R4}季度的日期",
"BI-Basic_Search_And_Patch_Paste": "搜索,支持批量粘贴、粘贴值通过换行识别",
"BI-Basic_Recommend_Color": "推荐色"
"BI-Basic_Recommend_Color": "推荐色",
"BI-Basic_Too_Much_Value_Get_Two_Thousand": "粘贴的值过多,只能识别出前2000个值",
"BI-Basic_Open": "开",
"BI-Basic_Close": "关",
};

1
index.html

@ -11,5 +11,4 @@
<div id="wrapper"></div>
</body>
<script src="./dist/demo.js"></script>
<script src="./dist/router.js"></script>
</html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save