Browse Source

Pull request #3492: KERNEL-14316 chore:修复一些细节问题

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

* commit 'ef444688adf0ea65e989109e3e0263a7d21465b5':
  KERNEL-14316 fix:按需引入问题
  KERNEL-14316 chore:国际化
  KERNEL-14316 fix:demo报错
  KERNEL-14316 chore:重复的demo
  KERNEL-14316 fix:worker polyfill
es6
treecat-罗群 2 years ago
parent
commit
76847b4ed8
  1. 150
      packages/demo/src/case/combo/demo.bubble_combo.js
  2. 52
      packages/demo/src/case/combo/demo.editor_icon_check_combo.js
  3. 41
      packages/demo/src/case/combo/demo.icon_combo.js
  4. 40
      packages/demo/src/case/combo/demo.icon_text_value_combo.js
  5. 121
      packages/demo/src/case/combo/demo.search_text_value_combo.js
  6. 258
      packages/demo/src/case/combo/demo.text_value_combo.js
  7. 83
      packages/demo/src/case/combo/demo.text_value_down_list_combo.js
  8. 50
      packages/demo/src/case/combo/demo.text_vlaue_check_combo.js
  9. 8
      packages/demo/src/case/combo/index.js
  10. 35
      packages/demo/src/case/demo.calendar.js
  11. 53
      packages/demo/src/case/demo.click.effect.js
  12. 46
      packages/demo/src/case/demo.color_chooser.js
  13. 32
      packages/demo/src/case/demo.color_chooser_popup.js
  14. 36
      packages/demo/src/case/demo.segment.js
  15. 24
      packages/demo/src/case/editor/demo.clear_editor.js
  16. 48
      packages/demo/src/case/editor/demo.shelter_editor.js
  17. 28
      packages/demo/src/case/editor/demo.sign_editor.js
  18. 34
      packages/demo/src/case/editor/demo.simple_state_editor.js
  19. 34
      packages/demo/src/case/editor/demo.state_editor.js
  20. 5
      packages/demo/src/case/editor/index.js
  21. 15
      packages/demo/src/case/index.js
  22. 26
      packages/demo/src/case/item/demo.multi_select_item.js
  23. 24
      packages/demo/src/case/item/demo.single_select_item.js
  24. 24
      packages/demo/src/case/item/demo.single_select_radio_item.js
  25. 3
      packages/demo/src/case/item/index.js
  26. 28
      packages/demo/src/case/list/demo.lazy_loader.js
  27. 29
      packages/demo/src/case/list/demo.select_list.js
  28. 2
      packages/demo/src/case/list/index.js
  29. 30
      packages/demo/src/case/pager/demo.all_count_pager.js
  30. 54
      packages/demo/src/case/pager/demo.direction_pager.js
  31. 2
      packages/demo/src/case/pager/index.js
  32. 52
      packages/demo/src/case/pane/demo.list_pane.js
  33. 50
      packages/demo/src/case/pane/demo.multi_popup_view.js
  34. 39
      packages/demo/src/case/pane/demo.panel.js
  35. 50
      packages/demo/src/case/pane/demo.popup_panel.js
  36. 4
      packages/demo/src/case/pane/index.js
  37. 53
      packages/demo/src/case/tree/demo.display_tree.js
  38. 111
      packages/demo/src/case/tree/demo.level_tree.js
  39. 147
      packages/demo/src/case/tree/demo.simple_tree.js
  40. 3
      packages/demo/src/case/tree/index.js
  41. 29
      packages/demo/src/case/triggers/demo.editor_trigger.js
  42. 28
      packages/demo/src/case/triggers/demo.icon_trigger.js
  43. 29
      packages/demo/src/case/triggers/demo.select_text_trigger.js
  44. 29
      packages/demo/src/case/triggers/demo.text_trigger.js
  45. 4
      packages/demo/src/case/triggers/index.js
  46. 4
      packages/demo/src/demo/case/combo/demo.text_value_combo.js
  47. 1
      packages/fineui/package.json
  48. 7
      packages/fineui/src/base/pager/pager.js
  49. 7
      packages/fineui/src/case/pager/pager.detail.js
  50. 7
      packages/fineui/src/core/platform/web/config.js
  51. 31
      packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js
  52. 1
      packages/fineui/webpack/webpack.prod.js

150
packages/demo/src/case/combo/demo.bubble_combo.js

@ -1,150 +0,0 @@
import { shortcut, Widget, createWidget, makeArray } from "@/core";
import { BubbleCombo } from "@/case/combo/bubblecombo/combo.bubble";
@shortcut()
export class Func extends Widget {
static xtype = "demo.bubble_combo";
props = { baseCls: "demo-func" };
render() {
let self = this,
count = 1;
const combo1 = createWidget({
type: "bi.bubble_combo",
trigger: "click,hover",
el: {
type: "bi.button",
text: "测试",
height: 24,
},
popup: {
el: {
type: "bi.button_group",
items: makeArray(100, {
type: "bi.text_item",
height: 24,
text: "item",
}),
layouts: [
{
type: "bi.vertical",
}
],
},
maxHeight: 200,
},
});
const combo2 = createWidget({
type: "bi.bubble_combo",
direction: "right",
el: {
type: "bi.button",
text: "测试",
height: 24,
},
popup: {
type: "bi.text_bubble_bar_popup_view",
text: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字",
ref() {
self.popup = this;
},
},
listeners: [
{
eventName: BubbleCombo.EVENT_BEFORE_POPUPVIEW,
action() {
self.popup.populate(
count++ % 2 === 1
? "我的文字变少了"
: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字"
);
},
}
],
});
const combo3 = createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 25,
},
popup: {
type: "bi.text_bubble_bar_popup_view",
text: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字",
ref() {
self.popup = this;
},
},
listeners: [
{
eventName: BubbleCombo.EVENT_BEFORE_POPUPVIEW,
action() {
self.popup.populate(
count++ % 2 === 1
? "我的文字变少了"
: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字"
);
},
}
],
});
const combo4 = createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.button",
text: "测试",
height: 25,
},
popup: {
type: "bi.text_bubble_bar_popup_view",
text: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字",
ref() {
self.popup = this;
},
},
listeners: [
{
eventName: BubbleCombo.EVENT_BEFORE_POPUPVIEW,
action() {
self.popup.populate(
count++ % 2 === 1
? "我的文字变少了"
: "我有很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字很多文字"
);
},
}
],
});
createWidget({
type: "bi.absolute",
element: this,
items: [
{
el: combo1,
left: 150,
top: 10,
},
{
el: combo2,
left: 10,
bottom: 200,
},
{
el: combo3,
right: 10,
bottom: 10,
},
{
el: combo4,
right: 10,
top: 10,
}
],
});
}
}

52
packages/demo/src/case/combo/demo.editor_icon_check_combo.js

@ -1,52 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class TextValueCombo extends Widget {
static xtype = "demo.editor_icon_check_combo";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.editor_icon_check_combo",
ref() {
self.combo = this;
},
watermark: "默认值",
width: 200,
height: 24,
value: 2,
items: [
{
// text: "MVC-1",
value: "1",
},
{
// text: "MVC-2",
value: "2",
},
{
// text: "MVC-3",
value: "3",
}
],
},
{
type: "bi.button",
width: 90,
height: 25,
text: "setValue为空",
handler() {
self.combo.setValue();
},
}
],
vgap: 20,
};
}
}

41
packages/demo/src/case/combo/demo.icon_combo.js

@ -1,41 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class IconCombo extends Widget {
static xtype = "demo.icon_combo";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.icon_combo",
container: "body",
ref(_ref) {
self.refs = _ref;
},
value: "第二项",
items: [
{
value: "第一项",
iconCls: "close-font",
},
{
value: "第二项",
iconCls: "search-font",
},
{
value: "第三项",
iconCls: "copy-font",
}
],
}
],
vgap: 20,
};
}
}

40
packages/demo/src/case/combo/demo.icon_text_value_combo.js

@ -1,40 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class IconTextValueCombo extends Widget {
static xtype = "demo.icon_text_value_combo";
props = { baseCls: "" };
render() {
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.icon_text_value_combo",
text: "默认值",
// defaultIconCls: "next-page-h-font",
width: 300,
items: [
{
text: "MVC-1",
iconCls: "close-font",
value: 1,
},
{
text: "MVC-2",
iconCls: "date-font",
value: 2,
},
{
text: "MVC-3",
iconCls: "search-close-h-font",
value: 3,
}
],
}
],
vgap: 20,
};
}
}

121
packages/demo/src/case/combo/demo.search_text_value_combo.js

@ -1,121 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { shortcut, Widget, Msg, AllValueMultiTextValueCombo} from "@fui/core";
@shortcut()
export class SearchTextValueCombo extends Widget {
static xtype = "demo.search_text_value_combo";
props = { baseCls: "" };
render() {
let combo, searchCombo;
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.search_text_value_combo",
ref() {
combo = this;
},
warningTitle: "111",
text: "默认值",
value: 14,
width: 300,
items: [
{
text: "ABC-1",
iconCls: "date-font",
value: 1,
},
{
text: "BCD-2",
iconCls: "search-font",
value: 2,
},
{
text: "CDE-3",
iconCls: "pull-right-font",
value: 3,
},
{
text: "DEF-3",
iconCls: "pull-right-font",
value: 4,
},
{
text: "FEG-3",
iconCls: "pull-right-font",
value: 5,
},
{
text: "FGH-3",
iconCls: "pull-right-font",
value: 6,
},
{
text: "GHI-3",
iconCls: "pull-right-font",
value: 7,
},
{
text: "HIJ-3",
iconCls: "pull-right-font",
value: 8,
},
{
text: "IJK-3",
iconCls: "pull-right-font",
value: 9,
},
{
text: "JKL-3",
iconCls: "pull-right-font",
value: 10,
}
],
},
{
type: "bi.all_value_multi_text_value_combo",
items: CONSTANTS.ITEMS,
text: "提示文本",
width: 200,
value: {
type: 1,
value: ["1", "2", "柳州市城贸金属材料有限责任公司", "3"],
},
ref() {
searchCombo = this;
},
listeners: [
{
eventName: AllValueMultiTextValueCombo.EVENT_CONFIRM,
action() {
Msg.toast(JSON.stringify(searchCombo.getValue()));
},
}
],
},
{
type: "bi.button",
text: "setValue(3)",
width: 90,
height: 25,
handler() {
combo.setValue(11);
},
},
{
type: "bi.button",
text: "getValue()",
width: 90,
height: 25,
handler() {
Msg.toast(JSON.stringify(searchCombo.getValue()));
},
}
],
vgap: 20,
};
}
}

258
packages/demo/src/case/combo/demo.text_value_combo.js

@ -1,258 +0,0 @@
/**
* Created by Dailer on 2017/7/11.
*/
import { shortcut, Widget, Label, VerticalLayout, TextValueCombo, Button, Selection } from "@fui/core";
@shortcut()
export class TextValueCombo extends Widget {
static xtype = "demo.text_value_combo";
props = {
baseCls: "",
};
render() {
let combo1, combo2;
const items = [
{
text: "MVC-1",
iconCls: "date-font",
value: 1,
},
{
text: "MVC-2",
iconCls: "search-font",
value: 2,
},
{
text: "MVC-3",
iconCls: "pull-right-font",
value: 3,
},
];
// 创建下拉框各种场景用例
return {
type: VerticalLayout.xtype,
vgap: 20,
hgap: 20,
items: [
this.createCombo("无初始值,带提示文字", {
type: TextValueCombo.xtype,
ref() {
combo1 = ref;
},
defaultText: "请选择",
width: 300,
items: items,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
}),
this.createCombo("自动根据value匹配text", {
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
value: 1,
items: items,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
}),
this.createCombo("无初始值,可以清空", {
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
items: items,
allowClear: true,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action() {
console.log(this.getValue());
},
},
],
}),
this.createCombo("有初始值,可以清空", {
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
value: 1,
items: items,
allowClear: true,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
}),
this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", {
type: TextValueCombo.xtype,
ref() {
self.combo = this;
},
width: 300,
text: "MVC-111",
value: 111,
items: items,
allowClear: true,
defaultText: "请选择",
warningTitle: "value值不合法",
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
}),
this.createCombo("无初始值,外部受控调用setValue", {
type: VerticalLayout.xtype,
items: [
{
type: TextValueCombo.xtype,
ref() {
combo1 = this;
},
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
},
{
el: {
type: Button.xtype,
text: "setValue(1)",
handler: function () {
combo1.setValue(1);
},
},
vgap: 10,
},
],
}),
this.createCombo("无初始值,外部受控调用setStatus", {
type: "bi.vertical",
items: [
{
type: TextValueCombo.xtype,
ref: function () {
combo2 = this;
},
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
},
{
el: {
type: Button.xtype,
text: "setStatus()",
handler: function () {
combo2.setStatus("error");
},
},
vgap: 10,
},
],
}),
this.createCombo("支持复选", {
type: VerticalLayout.xtype,
items: [
{
type: TextValueCombo.xtype,
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: Selection.Multi,
value: [1],
// allowSelectAll: false,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
},
],
}),
this.createCombo("支持复选,不要全选功能", {
type: VerticalLayout.xtype,
items: [
{
type: TextValueCombo.xtype,
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: Selection.Multi,
value: [1],
allowSelectAll: false,
listeners: [
{
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
},
},
],
},
],
}),
],
};
}
createCombo(text, combo) {
return {
type: VerticalLayout.xtype,
items: [
{
el: {
type: Label.xtype,
textAlign: "left",
text,
},
bgap: 10,
},
{
el: combo,
bgap: 10,
},
],
};
}
}

83
packages/demo/src/case/combo/demo.text_value_down_list_combo.js

@ -1,83 +0,0 @@
import { shortcut, Widget } from "@/core";
import { Msg } from "@/base";
@shortcut()
export class TextValueDownListCombo extends Widget {
static xtype = "demo.text_value_down_list_combo";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.text_value_down_list_combo",
width: 300,
ref(_ref) {
self.refs = _ref;
},
text: "默认值",
value: 11,
items: [
[
{
text: "属于",
value: 1,
cls: "dot-e-font",
},
{
text: "不属于",
value: 2,
cls: "dot-e-font",
}
],
[
{
el: {
text: "大于",
value: 3,
iconCls1: "dot-e-font",
},
value: 3,
children: [
{
text: "固定值",
value: 4,
cls: "dot-e-font",
},
{
text: "平均值",
value: 5,
cls: "dot-e-font",
}
],
}
]
],
},
{
type: "bi.button",
width: 90,
height: 25,
text: "setValue",
handler() {
self.refs.setValue(2);
},
},
{
type: "bi.button",
width: 90,
height: 25,
text: "getValue",
handler() {
Msg.alert("", JSON.stringify(self.refs.getValue()));
},
}
],
vgap: 20,
};
}
}

50
packages/demo/src/case/combo/demo.text_vlaue_check_combo.js

@ -1,50 +0,0 @@
import { Msg, shortcut, Widget } from "@fui/core";
@shortcut()
export class TextValueCheckCombo extends Widget {
static xtype = "demo.text_value_check_combo";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.text_value_check_combo",
ref () {
self.combo = this;
},
text: "默认值",
// value: 1,
width: 300,
items: [
{
text: "MVC-1",
value: 1,
},
{
text: "MVC-2",
value: 2,
},
{
text: "MVC-3",
value: 3,
}
],
},
{
type: "bi.button",
width: 90,
height: 25,
handler () {
Msg.alert("", JSON.stringify(self.combo.getValue()));
},
}
],
vgap: 20,
};
}
}

8
packages/demo/src/case/combo/index.js

@ -1,8 +0,0 @@
export * from "./demo.bubble_combo";
export * from "./demo.editor_icon_check_combo";
export * from "./demo.icon_combo";
export * from "./demo.icon_text_value_combo";
export * from "./demo.search_text_value_combo";
export * from "./demo.text_value_combo";
export * from "./demo.text_value_down_list_combo";
export * from "./demo.text_vlaue_check_combo";

35
packages/demo/src/case/demo.calendar.js

@ -1,35 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.calendar";
props = { baseCls: "demo-func" };
render() {
const self = this;
const date = new Date();
return {
type: "bi.calendar",
ref() {
self.calendar = this;
},
logic: {
dynamic: false,
},
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate(),
};
}
mounted() {
const date = new Date();
this.calendar.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate(),
});
}
}

53
packages/demo/src/case/demo.click.effect.js

@ -1,53 +0,0 @@
import { shortcut, Widget, createItems } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.click_item_effect";
props = { baseCls: "demo-func" };
render() {
return {
type: "bi.vertical",
items: createItems(
[
{
text: "bi-list-item",
cls: "bi-list-item close-font",
},
{
text: "bi-list-item-simple",
cls: "bi-list-item-simple close-font",
},
{
text: "bi-list-item-effect",
cls: "bi-list-item-effect close-font",
},
{
text: "bi-list-item-active",
cls: "bi-list-item-active close-font",
},
{
text: "bi-list-item-active2",
cls: "bi-list-item-active2 close-font",
},
{
text: "bi-list-item-select",
cls: "bi-list-item-select close-font",
},
{
text: "bi-list-item-select2",
cls: "bi-list-item-select2 close-font",
}
],
{
type: "bi.icon_text_item",
logic: {
dynamic: true,
},
}
),
vgap: 10,
};
}
}

46
packages/demo/src/case/demo.color_chooser.js

@ -1,46 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.color_chooser";
props = { baseCls: "demo-func" };
render() {
return {
type: "bi.absolute",
items: [
{
el: {
type: "bi.color_chooser",
recommendColorsGetter() {
return ["#ffffff", "#9d775f", "#dd4b4b", "#ef8b07", "#fcc800"];
},
width: 24,
height: 24,
},
left: 100,
top: 250,
},
{
el: {
type: "bi.simple_color_chooser",
width: 30,
height: 24,
},
left: 400,
top: 250,
},
{
el: {
type: "bi.color_chooser",
width: 230,
height: 24,
},
left: 100,
top: 350,
}
],
};
}
}

32
packages/demo/src/case/demo.color_chooser_popup.js

@ -1,32 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.color_chooser_popup";
props = { baseCls: "demo-func" };
render() {
return {
type: "bi.absolute",
items: [
{
el: {
type: "bi.color_chooser_popup",
cls: "bi-card",
},
left: 100,
top: 250,
},
{
el: {
type: "bi.simple_color_chooser_popup",
cls: "bi-card",
},
left: 400,
top: 250,
}
],
};
}
}

36
packages/demo/src/case/demo.segment.js

@ -1,36 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.segment";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.horizontal",
element: this,
vgap: 20,
hgap: 30,
items: [
{
type: "bi.segment",
items: [
{
text: "较长的选项1",
value: 1,
},
{
text: "选项2",
value: 2,
},
{
text: "选项3",
value: 3,
}
],
}
],
});
}
}

24
packages/demo/src/case/editor/demo.clear_editor.js

@ -1,24 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class ClearEditor extends Widget {
static xtype = "demo.clear_editor";
props = { baseCls: "" };
render() {
return {
type: "bi.horizontal_auto",
items: [
{
type: "bi.clear_editor",
cls: "bi-border",
width: 300,
watermark: "这个是带清除按钮的",
value: 123,
}
],
vgap: 20,
};
}
}

48
packages/demo/src/case/editor/demo.shelter_editor.js

@ -1,48 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class ClearEditor extends Widget {
static xtype = "demo.shelter_editor";
props = { baseCls: "" };
render() {
const editor = createWidget({
type: "bi.shelter_editor",
cls: "bi-border",
validationChecker(v) {
return v != "a";
},
watermark: "可以设置标记的输入框",
value: "这是一个遮罩",
keyword: "z",
});
createWidget({
type: "bi.vertical",
element: this,
hgap: 30,
vgap: 20,
bgap: 50,
items: [editor],
});
createWidget({
type: "bi.absolute",
element: this,
items: [
{
el: {
type: "bi.button",
text: "focus",
height: 25,
handler() {
editor.focus();
},
},
right: 10,
left: 10,
bottom: 10,
}
],
});
}
}

28
packages/demo/src/case/editor/demo.sign_editor.js

@ -1,28 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class SignEditor extends Widget {
static xtype = "demo.sign_editor";
props = { baseCls: "" };
render() {
const editor = createWidget({
type: "bi.sign_editor",
cls: "bi-border bi-focus-shadow",
validationChecker(v) {
return v != "abc";
},
watermark: "可以设置标记的输入框",
text: "这是一个标记,点击它即可进行输入",
});
editor.setValue(2);
createWidget({
type: "bi.vertical",
element: this,
hgap: 30,
vgap: 20,
items: [editor],
});
}
}

34
packages/demo/src/case/editor/demo.simple_state_editor.js

@ -1,34 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class SimpleStateEditor extends Widget {
static xtype = "demo.simple_state_editor";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_adapt",
items: [
{
type: "bi.simple_state_editor",
ref() {
self.editor = this;
},
cls: "bi-border",
width: 300,
}
],
vgap: 20,
};
}
mounted() {
const self = this;
setTimeout(() => {
self.editor.setState(["*", "*"]);
}, 1000);
}
}

34
packages/demo/src/case/editor/demo.state_editor.js

@ -1,34 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class StateEditor extends Widget {
static xtype = "demo.state_editor";
props = { baseCls: "" };
render() {
const self = this;
return {
type: "bi.horizontal_adapt",
items: [
{
type: "bi.state_editor",
ref() {
self.editor = this;
},
cls: "bi-border",
width: 300,
}
],
vgap: 20,
};
}
mounted() {
const self = this;
setTimeout(() => {
self.editor.setState(["*", "*"]);
}, 1000);
}
}

5
packages/demo/src/case/editor/index.js

@ -1,5 +0,0 @@
export * from "./demo.clear_editor";
export * from "./demo.shelter_editor";
export * from "./demo.sign_editor";
export * from "./demo.simple_state_editor";
export * from "./demo.state_editor";

15
packages/demo/src/case/index.js

@ -1,15 +0,0 @@
// export * from "./combo";
// export * from "./editor";
// export * from "./item";
// export * from "./list";
// export * from "./pager";
// export * from "./pane";
// export * from "./tree";
// export * from "./triggers";
export const caseComponent = {};
// export * from "./demo.calendar";
// export * from "./demo.click.effect";
// export * from "./demo.color_chooser";
// export * from "./demo.color_chooser_popup";
// export * from "./demo.segment";

26
packages/demo/src/case/item/demo.multi_select_item.js

@ -1,26 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.multi_select_item";
props = { baseCls: "demo-func" };
render() {
return {
type: "bi.vertical",
items: [
{
type: "bi.label",
height: 30,
text: "复选item",
},
{
type: "bi.multi_select_item",
text: "复选项",
}
],
hgap: 300,
};
}
}

24
packages/demo/src/case/item/demo.single_select_item.js

@ -1,24 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Items extends Widget {
static xtype = "demo.single_select_item";
render() {
return {
type: "bi.vertical",
items: [
{
type: "bi.label",
height: 30,
text: "单选item",
},
{
type: "bi.single_select_item",
text: "单选项",
}
],
hgap: 300,
};
}
}

24
packages/demo/src/case/item/demo.single_select_radio_item.js

@ -1,24 +0,0 @@
import { shortcut, Widget } from "@/core";
@shortcut()
export class Items extends Widget {
static xtype = "demo.single_select_radio_item";
render() {
return {
type: "bi.vertical",
items: [
{
type: "bi.label",
height: 30,
text: "单选item",
},
{
type: "bi.single_select_radio_item",
text: "单选项",
}
],
hgap: 300,
};
}
}

3
packages/demo/src/case/item/index.js

@ -1,3 +0,0 @@
export * from "./demo.multi_select_item";
export * from "./demo.single_select_item";
export * from "./demo.single_select_radio_item";

28
packages/demo/src/case/list/demo.lazy_loader.js

@ -1,28 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { shortcut, Widget } from "@fui/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.lazy_loader";
props = { baseCls: "demo-func" };
render() {
const self = this;
createWidget({
type: "bi.lazy_loader",
element: this,
el: {
layouts: [
{
type: "bi.left",
hgap: 5,
}
],
},
items: createItems(deepClone(CONSTANTS.ITEMS), {
type: "bi.button",
}),
});
}
}

29
packages/demo/src/case/list/demo.select_list.js

@ -1,29 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { shortcut, Widget, createWidget, createItems, deepClone, Selection } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.select_list";
props = { baseCls: "demo-func" };
render() {
const self = this;
createWidget({
type: "bi.select_list",
toolbar: {
type: "bi.multi_select_bar",
iconWrapperWidth: 26,
},
element: this,
el: {
el: {
chooseType: Selection.Multi,
},
},
items: createItems(deepClone(CONSTANTS.SIMPLE_ITEMS), {
type: "bi.multi_select_item",
}),
});
}
}

2
packages/demo/src/case/list/index.js

@ -1,2 +0,0 @@
export * from "./demo.lazy_loader";
export * from "./demo.select_list";

30
packages/demo/src/case/pager/demo.all_count_pager.js

@ -1,30 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.all_count_pager";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.vertical",
hgap: 200,
vgap: 50,
element: this,
items: [
{
type: "bi.label",
height: 30,
text: " (测试条件:总页数为3)",
},
{
type: "bi.all_count_pager",
pages: 3,
curr: 1,
count: 1000,
}
],
});
}
}

54
packages/demo/src/case/pager/demo.direction_pager.js

@ -1,54 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.direction_pager";
props = { baseCls: "demo-func" };
mounted() {
this.pager.populate();
}
render() {
const self = this;
createWidget({
type: "bi.vertical",
hgap: 200,
vgap: 50,
element: this,
items: [
{
type: "bi.direction_pager",
ref(_ref) {
self.pager = _ref;
},
horizontal: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev(v) {
return v > 1;
},
hasNext() {
return true;
},
firstPage: 1,
},
vertical: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev(v) {
return v > 1;
},
hasNext() {
return true;
},
firstPage: 1,
},
}
],
});
}
}

2
packages/demo/src/case/pager/index.js

@ -1,2 +0,0 @@
export * from "./demo.all_count_pager";
export * from "./demo.direction_pager";

52
packages/demo/src/case/pane/demo.list_pane.js

@ -1,52 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import {
ListPane,
MultiSelectItem,
ButtonGroup,
VerticalLayout,
shortcut,
Widget,
createItems,
deepClone,
} from "@fui/core";
@shortcut()
export class ListPaneDemo extends Widget {
static xtype = "demo.list_pane";
props = { baseCls: "demo-func" };
render() {
const self = this;
return {
type: ListPane.xtype,
ref() {
self.pane = this;
},
itemsCreator(op, callback) {
setTimeout(() => {
callback(
createItems(deepClone(CONSTANTS.ITEMS), {
type: MultiSelectItem.xtype,
height: 25,
})
);
}, 2000);
},
el: {
type: ButtonGroup.xtype,
layouts: [
{
type: VerticalLayout.xtype,
},
],
},
};
}
mounted() {
this.pane.populate();
}
}

50
packages/demo/src/case/pane/demo.multi_popup_view.js

@ -1,50 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { AbsoluteLayout, Combo, TextButton, MultiPopupView, ButtonGroup, VerticalLayout, MultiSelectItem, shortcut, Widget, createItems, deepClone } from "@fui/core"
@shortcut()
export class MultiPopupViewDemo extends Widget {
static xtype = "demo.multi_popup_view";
props = { baseCls: "demo-func" };
render() {
const self = this;
return {
type: AbsoluteLayout.xtype,
items: [
{
el: {
type: Combo.xtype,
width: 200,
height: 30,
el: {
type: TextButton.xtype,
text: "点击",
cls: "bi-border",
height: 30,
},
popup: {
type: MultiPopupView.xtype,
el: {
type: ButtonGroup.xtype,
layouts: [
{
type: VerticalLayout.xtype,
}
],
items: createItems(deepClone(CONSTANTS.ITEMS), {
type: MultiSelectItem.xtype,
height: 25,
}),
},
},
},
}
],
};
}
}

39
packages/demo/src/case/pane/demo.panel.js

@ -1,39 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { Panel, Button, ButtonGroup, VerticalLayout, MultiSelectItem, shortcut, Widget, createItems, deepClone } from "@fui/core"
@shortcut()
export class PanelDemo extends Widget {
static xtype = "demo.panel";
props = { baseCls: "demo-func" };
render() {
const self = this;
return {
type: Panel.xtype,
title: "title",
titleButtons: [
{
type: Button.xtype,
text: "操作",
}
],
el: {
type: ButtonGroup.xtype,
layouts: [
{
type: VerticalLayout.xtype,
}
],
items: createItems(deepClone(CONSTANTS.ITEMS), {
type: MultiSelectItem.xtype,
height: 25,
}),
},
};
}
}

50
packages/demo/src/case/pane/demo.popup_panel.js

@ -1,50 +0,0 @@
import { CONSTANTS } from "@/config/constant";
import { createItems, deepClone, AbsoluteLayout, Combo, TextButton, PopupPanel, ButtonGroup, VerticalLayout, MultiSelectItem, shortcut, Widget } from "@fui/core"
@shortcut()
export class PopupPanelDemo extends Widget {
static xtype = "demo.popup_panel";
props = { baseCls: "demo-func" };
render() {
const self = this;
return {
type: AbsoluteLayout.xtype,
items: [
{
el: {
type: Combo.xtype,
width: 200,
height: 30,
el: {
type: TextButton.xtype,
text: "点击",
cls: "bi-border",
height: 30,
},
popup: {
type: PopupPanel.xtype,
el: {
type: ButtonGroup.xtype,
layouts: [
{
type: VerticalLayout.xtype,
}
],
items: createItems(deepClone(CONSTANTS.ITEMS), {
type: MultiSelectItem.xtype,
height: 25,
}),
},
},
},
}
],
};
}
}

4
packages/demo/src/case/pane/index.js

@ -1,4 +0,0 @@
export * from "./demo.list_pane";
export * from "./demo.multi_popup_view";
export * from "./demo.panel";
export * from "./demo.popup_panel";

53
packages/demo/src/case/tree/demo.display_tree.js

@ -1,53 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.display_tree";
props = { baseCls: "demo-func" };
render() {
const tree = createWidget({
type: "bi.display_tree",
element: this,
});
tree.initTree([
{
id: 1,
text: "第一项",
open: true,
},
{
id: 2,
text: "第二项",
},
{
id: 11,
pId: 1,
text: "子项1(共2个)",
open: true,
},
{
id: 111,
pId: 11,
text: "子子项1",
},
{
id: 112,
pId: 11,
text: "子子项2",
},
{
id: 12,
pId: 1,
text: "子项2",
},
{
id: 13,
pId: 1,
text: "子项3",
}
]);
}
}

111
packages/demo/src/case/tree/demo.level_tree.js

@ -1,111 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
import { Msg } from "@/base";
@shortcut()
export class Func extends Widget {
static xtype = "demo.level_tree";
props = { baseCls: "demo-func" };
render() {
const tree = createWidget({
type: "bi.level_tree",
chooseType: 0,
items: [
{
id: 1,
text: "第一项",
value: 1,
isParent: true,
},
{
id: 2,
text: "第二项",
value: 2,
isParent: true,
},
{
id: 3,
text: "第三项",
value: 1,
isParent: true,
open: true,
},
{
id: 4,
text: "第四项",
value: 1,
},
{
id: 11,
pId: 1,
text: "子项1",
value: 11,
},
{
id: 12,
pId: 1,
text: "子项2",
value: 12,
},
{
id: 13,
pId: 1,
text: "子项3",
value: 13,
},
{
id: 111,
pId: 11,
text: "子项1-1",
value: 111,
},
{
id: 21,
pId: 2,
text: "子项1",
value: 21,
},
{
id: 31,
pId: 3,
text: "子项1",
value: 31,
},
{
id: 32,
pId: 3,
text: "子项2",
value: 32,
},
{
id: 33,
pId: 3,
text: "子项3",
value: 33,
}
],
});
createWidget({
type: "bi.vtape",
element: this,
items: [
{
el: tree,
},
{
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler() {
Msg.alert("", tree.getValue());
},
},
}
],
});
}
}

147
packages/demo/src/case/tree/demo.simple_tree.js

@ -1,147 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
import { Msg } from "@/base";
@shortcut()
export class Func extends Widget {
static xtype = "demo.simple_tree";
props = { baseCls: "demo-func" };
render() {
// value值一定要是字符串
const tree = createWidget({
type: "bi.simple_tree",
items: [
{
id: 1,
text: "第一项",
value: "1",
},
{
id: 2,
text: "第二项",
value: "2",
},
{
id: 3,
text: "第三项",
value: "3",
open: true,
},
{
id: 11,
pId: 1,
text: "子项1",
value: "11",
},
{
id: 12,
pId: 1,
text: "子项2",
value: "12",
},
{
id: 13,
pId: 1,
text: "子项3",
value: "13",
},
{
id: 31,
pId: 3,
text: "子项1",
value: "31",
},
{
id: 32,
pId: 3,
text: "子项2",
value: "32",
},
{
id: 33,
pId: 3,
text: "子项3",
value: "33",
}
],
value: ["31", "32", "33"],
});
// tree.populate([{
// id: 1,
// text: "第一项",
// value: "1"
// }, {
// id: 2,
// text: "第二项",
// value: "2"
// }, {
// id: 3,
// text: "第三项",
// value: "3",
// open: true
// }, {
// id: 11,
// pId: 1,
// text: "子项1",
// value: "11"
// }, {
// id: 12,
// pId: 1,
// text: "子项2",
// value: "12"
// }, {
// id: 13,
// pId: 1,
// text: "子项3",
// value: "13"
// }, {
// id: 31,
// pId: 3,
// text: "子项1",
// value: "31"
// }, {
// id: 32,
// pId: 3,
// text: "子项2",
// value: "32"
// }, {
// id: 33,
// pId: 3,
// text: "子项3",
// value: "33"
// }], "z");
createWidget({
type: "bi.vtape",
element: this,
items: [
{
el: tree,
},
{
height: 30,
el: {
type: "bi.button",
height: 30,
text: "setValue(['31', '32', '33'])",
handler() {
tree.setValue(["31", "32", "33"]);
},
},
},
{
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler() {
Msg.alert("", JSON.stringify(tree.getValue()));
},
},
}
],
});
}
}

3
packages/demo/src/case/tree/index.js

@ -1,3 +0,0 @@
export * from "./demo.display_tree";
export * from "./demo.level_tree";
export * from "./demo.simple_tree";

29
packages/demo/src/case/triggers/demo.editor_trigger.js

@ -1,29 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.editor_trigger";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.vertical",
element: this,
items: [
{
type: "bi.label",
text: "输入框加图标的trigger",
},
{
type: "bi.editor_trigger",
watermark: "这是水印",
width: 200,
height: 24,
}
],
hgap: 20,
vgap: 20,
});
}
}

28
packages/demo/src/case/triggers/demo.icon_trigger.js

@ -1,28 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.icon_trigger";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.vertical",
element: this,
items: [
{
type: "bi.label",
text: "只有一个图标的trigger",
},
{
type: "bi.icon_trigger",
width: 30,
height: 24,
}
],
hgap: 20,
vgap: 20,
});
}
}

29
packages/demo/src/case/triggers/demo.select_text_trigger.js

@ -1,29 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.select_text_trigger";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.vertical",
element: this,
items: [
{
type: "bi.label",
text: "可被选择的trigger",
},
{
type: "bi.select_text_trigger",
text: "这是一个简单的trigger",
width: 200,
height: 24,
}
],
hgap: 20,
vgap: 20,
});
}
}

29
packages/demo/src/case/triggers/demo.text_trigger.js

@ -1,29 +0,0 @@
import { shortcut, Widget, createWidget } from "@/core";
@shortcut()
export class Func extends Widget {
static xtype = "demo.text_trigger";
props = { baseCls: "demo-func" };
render() {
createWidget({
type: "bi.vertical",
element: this,
items: [
{
type: "bi.label",
text: "文本加图标的trigger",
},
{
type: "bi.text_trigger",
text: "这是一个简单的trigger",
width: 200,
height: 24,
}
],
hgap: 20,
vgap: 20,
});
}
}

4
packages/demo/src/case/triggers/index.js

@ -1,4 +0,0 @@
export * from "./demo.editor_trigger";
export * from "./demo.icon_trigger";
export * from "./demo.select_text_trigger";
export * from "./demo.text_trigger";

4
packages/demo/src/demo/case/combo/demo.text_value_combo.js

@ -19,9 +19,9 @@ export class TextValueComboDemo extends Widget {
}; };
render() { render() {
var combo1, combo2; let combo, combo1, combo2;
var items = [ const items = [
{ {
text: "MVC-1", text: "MVC-1",
iconCls: "date-font", iconCls: "date-font",

1
packages/fineui/package.json

@ -12,6 +12,7 @@
"**/*.less", "**/*.less",
"src/**/*.js", "src/**/*.js",
"dist/es/index.js", "dist/es/index.js",
"dist/es/core/element/index.js",
"dist/es/core/system.js", "dist/es/core/system.js",
"dist/es/core/platform/web/config.js", "dist/es/core/platform/web/config.js",
"dist/es/core/platform/web/jquery/*.js", "dist/es/core/platform/web/jquery/*.js",

7
packages/fineui/src/base/pager/pager.js

@ -13,7 +13,8 @@ import {
Controller, Controller,
Events, Events,
MIN, MIN,
MAX MAX,
i18nText
} from "@/core"; } from "@/core";
import { Label } from "../single"; import { Label } from "../single";
import { ButtonGroup } from "../combination"; import { ButtonGroup } from "../combination";
@ -54,8 +55,8 @@ export class Pager extends Widget {
jump: emptyFn, // 分页的回调函数 jump: emptyFn, // 分页的回调函数
first: false, // 是否显示首页 first: false, // 是否显示首页
last: false, // 是否显示尾页 last: false, // 是否显示尾页
prev: BI.i18nText("BI-Previous_Page"), prev: i18nText("BI-Previous_Page"),
next: BI.i18nText("BI-Next_Page"), next: i18nText("BI-Next_Page"),
firstPage: 1, firstPage: 1,
lastPage: () => lastPage: () =>

7
packages/fineui/src/case/pager/pager.detail.js

@ -12,7 +12,8 @@ import {
Controller, Controller,
Events, Events,
MIN, MIN,
MAX MAX,
i18nText
} from "@/core"; } from "@/core";
import { Label, ButtonGroup } from "@/base"; import { Label, ButtonGroup } from "@/base";
@ -52,8 +53,8 @@ export class DetailPager extends Widget {
first: false, // 是否显示首页 first: false, // 是否显示首页
last: false, // 是否显示尾页 last: false, // 是否显示尾页
prev: BI.i18nText("BI-Previous_Page"), prev: i18nText("BI-Previous_Page"),
next: BI.i18nText("BI-Next_Page"), next: i18nText("BI-Next_Page"),
firstPage: 1, firstPage: 1,
lastPage() { lastPage() {

7
packages/fineui/src/core/platform/web/config.js

@ -17,7 +17,8 @@ import { FlexCenterLayout, FlexHorizontalLayout, VerticalLayout,
FlexWrapperVerticalLayout FlexWrapperVerticalLayout
} from "@/core/wrapper"; } from "@/core/wrapper";
import { SystemProvider } from "@/core/system"; import { SystemProvider } from "@/core/system";
import { ImageRadio, ImageCheckbox } from "@/base";
import { HalfButton } from "@/case";
// 工程配置 // 工程配置
// 注册布局 // 注册布局
@ -309,7 +310,7 @@ configWidget("bi.table", ob => {
configWidget("bi.radio", ob => { configWidget("bi.radio", ob => {
if (isIE() && getIEVersion() <= 9) { if (isIE() && getIEVersion() <= 9) {
return extend({}, ob, { type: "bi.image_radio" }); return extend({}, ob, { type: ImageRadio.xtype });
} }
return ob; return ob;
@ -317,7 +318,7 @@ configWidget("bi.radio", ob => {
configWidget("bi.checkbox", ob => { configWidget("bi.checkbox", ob => {
if (isIE() && getIEVersion() <= 9) { if (isIE() && getIEVersion() <= 9) {
return extend({}, ob, { type: "bi.image_checkbox" }); return extend({}, ob, { type: ImageCheckbox.xtype });
} }
return ob; return ob;

31
packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js

@ -2,12 +2,13 @@
* 用于 jquery worker 环境或者 V8 引擎的 polyfill * 用于 jquery worker 环境或者 V8 引擎的 polyfill
*/ */
import { _global } from "@/core/0.foundation"; import { _global } from "@/core/0.foundation";
if (!_global.window) {
_global.window = _global;
const document = (_global.document = {});
const fakeElement = Object.create(document);
Object.assign(document, { // const _global = globalThis;
const document = {};
const fakeElement = Object.create(document);
Object.assign(document, {
parentNode: null, parentNode: null,
nodeType: 9, nodeType: 9,
head: fakeElement, head: fakeElement,
@ -65,9 +66,9 @@ if (!_global.window) {
removeEventListener() { removeEventListener() {
return null; return null;
}, },
}); });
Object.assign(fakeElement, { Object.assign(fakeElement, {
nodeType: 1, nodeType: 1,
style: {}, style: {},
ownerDocument: document, ownerDocument: document,
@ -77,5 +78,19 @@ if (!_global.window) {
toString() { toString() {
return "FakeElement"; return "FakeElement";
}, },
}); });
function polyfillProps(key, obj) {
_global[key] = _global[key] || obj;
if (typeof obj === "object") {
try {
Object.assign(_global[key], obj);
} catch(err) {
// _global[key] 可能只有 get 方法
}
}
} }
_global.window = _global;
polyfillProps("XMLHttpRequest", function () {});
polyfillProps("document", document);

1
packages/fineui/webpack/webpack.prod.js

@ -19,6 +19,7 @@ module.exports = merge(common, {
entry: { entry: {
"fineui.min": attachments.fineui, "fineui.min": attachments.fineui,
"fineui.worker.min": attachments.fineuiForWorker, "fineui.worker.min": attachments.fineuiForWorker,
"fineui.worker": attachments.fineuiForWorker
}, },
output: { output: {

Loading…
Cancel
Save