Browse Source

Merge remote-tracking branch 'origin/es6' into es6

es6
Kobi 1 year ago
parent
commit
2b50b02d79
  1. 3
      package.json
  2. 2
      packages/fineui/package.json
  3. 15
      packages/fineui/src/base/combination/searcher.js
  4. 5
      packages/fineui/src/base/combination/switcher.js
  5. 8
      packages/fineui/src/core/2.base.js
  6. 2
      packages/fineui/src/core/constant/writable.var.js
  7. 2
      packages/fineui/src/core/func/alias.js
  8. 20
      packages/fineui/src/widget/multiselect/multiselect.combo.js
  9. 20
      packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js
  10. 21
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.js
  11. 21
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js
  12. 4
      packages/fineui/src/widget/multiselect/multiselect.popup.view.js
  13. 4
      packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js
  14. 2
      packages/fineui/src/widget/multitree/multi.tree.combo.js
  15. 3
      packages/fineui/typescript/base/base.ts
  16. 2
      packages/fineui/typescript/core/base.ts
  17. 5
      packages/fineui/typescript/core/controller/controller.masker.ts
  18. 14
      packages/fineui/typescript/core/func/alias.ts
  19. 1
      packages/fineui/typescript/core/platform/web/index.ts
  20. 4
      packages/fineui/typescript/router/router.ts

3
package.json

@ -15,7 +15,8 @@
"dev:demo": "pnpm --dir packages/demo dev", "dev:demo": "pnpm --dir packages/demo dev",
"dev:fineui": "pnpm --dir packages/fineui dev", "dev:fineui": "pnpm --dir packages/fineui dev",
"build": "pnpm --dir packages/fineui build", "build": "pnpm --dir packages/fineui build",
"build:demo": "pnpm --dir packages/demo build" "build:demo": "pnpm --dir packages/demo build",
"tsc": "pnpm --dir packages/fineui tsc"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.21.0", "@babel/cli": "^7.21.0",

2
packages/fineui/package.json

@ -1,6 +1,6 @@
{ {
"name": "@fui/core", "name": "@fui/core",
"version": "3.0.20230606133653", "version": "3.0.20230615140705",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"module": "dist/lib/index.js", "module": "dist/lib/index.js",

15
packages/fineui/src/base/combination/searcher.js

@ -17,7 +17,8 @@ import {
BlankSplitChar, BlankSplitChar,
Events, Events,
EVENT_RESPONSE_TIME, EVENT_RESPONSE_TIME,
Func Func,
isFunction,
} from "@/core"; } from "@/core";
import { ButtonGroup } from "./group.button"; import { ButtonGroup } from "./group.button";
import { Maskers } from "@/base/0.base"; import { Maskers } from "@/base/0.base";
@ -127,7 +128,8 @@ export class Searcher extends Widget {
} }
_assertPopupView() { _assertPopupView() {
const { masker, popup, chooseType, isAutoSync, adapter } = this.options; const { masker, popup, chooseType, isAutoSync } = this.options;
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter;
if ((masker && !Maskers.has(this.getName())) || (masker === false && !this.popupView)) { if ((masker && !Maskers.has(this.getName())) || (masker === false && !this.popupView)) {
this.popupView = createWidget(popup, { this.popupView = createWidget(popup, {
type: SearcherView.xtype, type: SearcherView.xtype,
@ -213,7 +215,8 @@ export class Searcher extends Widget {
} }
_search() { _search() {
const { isAutoSearch, adapter, isAutoSync, onSearch } = this.options; const { isAutoSearch, isAutoSync, onSearch } = this.options;
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter;
const keyword = this.editor.getValue(); const keyword = this.editor.getValue();
if (keyword === "" || this._stop) { if (keyword === "" || this._stop) {
return; return;
@ -333,7 +336,8 @@ export class Searcher extends Widget {
} }
getValue() { getValue() {
const { isAutoSync, adapter, popup } = this.options; const { isAutoSync, popup } = this.options;
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter;
if (isAutoSync && adapter && adapter.getValue) { if (isAutoSync && adapter && adapter.getValue) {
return adapter.getValue(); return adapter.getValue();
} }
@ -350,7 +354,8 @@ export class Searcher extends Widget {
} }
populate(result, searchResult, keyword) { populate(result, searchResult, keyword) {
const { isAutoSync, adapter } = this.options; const { isAutoSync } = this.options;
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter;
this._assertPopupView(); this._assertPopupView();
this.popupView.populate(...arguments); this.popupView.populate(...arguments);
if (isAutoSync && adapter && adapter.getValue) { if (isAutoSync && adapter && adapter.getValue) {

5
packages/fineui/src/base/combination/switcher.js

@ -11,7 +11,7 @@ import {
isNull, isNull,
Events, Events,
Direction, Direction,
EVENT_RESPONSE_TIME EVENT_RESPONSE_TIME, isFunction
} from "@/core"; } from "@/core";
import { ButtonGroup } from "./group.button"; import { ButtonGroup } from "./group.button";
import { Maskers } from "@/base/0.base"; import { Maskers } from "@/base/0.base";
@ -188,7 +188,8 @@ export class Switcher extends Widget {
} }
_assertPopupView() { _assertPopupView() {
const { popup, adapter, masker, value, direction } = this.options; const { popup, masker, value, direction } = this.options;
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter;
if (!this._created) { if (!this._created) {
this.popupView = createWidget( this.popupView = createWidget(
popup, popup,

8
packages/fineui/src/core/2.base.js

@ -1227,19 +1227,19 @@ export function checkDateVoid(YY, MM, DD, minDate, maxDate) {
} else if (YY > maxDate[0]) { } else if (YY > maxDate[0]) {
back = ["y", 1]; back = ["y", 1];
} else if (YY >= minDate[0] && YY <= maxDate[0]) { } else if (YY >= minDate[0] && YY <= maxDate[0]) {
if (YY === minDate[0]) { if (YY == minDate[0]) {
if (MM < minDate[1]) { if (MM < minDate[1]) {
back = ["m"]; back = ["m"];
} else if (MM === minDate[1]) { } else if (MM == minDate[1]) {
if (DD < minDate[2]) { if (DD < minDate[2]) {
back = ["d"]; back = ["d"];
} }
} }
} }
if (YY === maxDate[0]) { if (YY == maxDate[0]) {
if (MM > maxDate[1]) { if (MM > maxDate[1]) {
back = ["m", 1]; back = ["m", 1];
} else if (MM === maxDate[1]) { } else if (MM == maxDate[1]) {
if (DD > maxDate[2]) { if (DD > maxDate[2]) {
back = ["d", 1]; back = ["d", 1];
} }

2
packages/fineui/src/core/constant/writable.var.js

@ -130,7 +130,7 @@ const getCacheItem = key => {
export let EVENT_BLUR = _global.localStorage ? getCacheItem("event.blur") : true; export let EVENT_BLUR = _global.localStorage ? getCacheItem("event.blur") : true;
export const setEventBlur = v => { export const setEventBlur = v => {
EVENT_BLUR = v; EVENT_BLUR = v;
Cache.setItem("event.blur", newVal); Cache.setItem("event.blur", v);
}; };
PropertyDescriptors["EVENT_BLUR"] = { PropertyDescriptors["EVENT_BLUR"] = {
enumerable: true, enumerable: true,

2
packages/fineui/src/core/func/alias.js

@ -456,7 +456,7 @@ export const htmlDecode = function(text) {
export const cjkEncodeDO = function(o) { export const cjkEncodeDO = function(o) {
if (isPlainObject(o)) { if (isPlainObject(o)) {
const result = {}; const result = {};
each(o, (v, k) => { each(o, (k, v) => {
if (!(typeof v === "string")) { if (!(typeof v === "string")) {
v = jsonEncode(v); v = jsonEncode(v);
} }

20
packages/fineui/src/widget/multiselect/multiselect.combo.js

@ -99,13 +99,8 @@ export class MultiSelectCombo extends Single {
height: toPix(o.height, o.simple ? 1 : 2), height: toPix(o.height, o.simple ? 1 : 2),
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter, itemFormatter: o.itemFormatter,
@ -185,8 +180,6 @@ export class MultiSelectCombo extends Single {
type: MultiSelectPopupView.xtype, type: MultiSelectPopupView.xtype,
ref() { ref() {
self.popup = this; self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
}, },
listeners: [ listeners: [
{ {
@ -269,13 +262,8 @@ export class MultiSelectCombo extends Single {
this.numberCounter = createWidget({ this.numberCounter = createWidget({
type: MultiSelectCheckSelectedSwitcher.xtype, type: MultiSelectCheckSelectedSwitcher.xtype,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),

20
packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js

@ -97,13 +97,8 @@ export class MultiSelectNoBarCombo extends Single {
height: toPix(o.height, o.simple ? 1 : 2), height: toPix(o.height, o.simple ? 1 : 2),
text: o.text, text: o.text,
defaultText: o.defaultText, defaultText: o.defaultText,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),
@ -185,8 +180,6 @@ export class MultiSelectNoBarCombo extends Single {
type: MultiSelectNoBarPopupView.xtype, type: MultiSelectNoBarPopupView.xtype,
ref() { ref() {
self.popup = this; self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
}, },
listeners: [ listeners: [
{ {
@ -272,13 +265,8 @@ export class MultiSelectNoBarCombo extends Single {
this.numberCounter = createWidget({ this.numberCounter = createWidget({
type: MultiSelectCheckSelectedSwitcher.xtype, type: MultiSelectCheckSelectedSwitcher.xtype,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),

21
packages/fineui/src/widget/multiselect/multiselect.insert.combo.js

@ -99,14 +99,8 @@ export class MultiSelectInsertCombo extends Single {
text: o.text, text: o.text,
watermark: o.watermark, watermark: o.watermark,
defaultText: o.defaultText, defaultText: o.defaultText,
// adapter: this.popup, adapter: () => {
masker: { return this.popup.getView();
offset: {
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),
@ -192,8 +186,6 @@ export class MultiSelectInsertCombo extends Single {
type: MultiSelectPopupView.xtype, type: MultiSelectPopupView.xtype,
ref() { ref() {
self.popup = this; self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
}, },
listeners: [ listeners: [
{ {
@ -276,13 +268,8 @@ export class MultiSelectInsertCombo extends Single {
this.numberCounter = createWidget({ this.numberCounter = createWidget({
type: MultiSelectCheckSelectedSwitcher.xtype, type: MultiSelectCheckSelectedSwitcher.xtype,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),

21
packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -93,14 +93,8 @@ export class MultiSelectInsertNoBarCombo extends Single {
type: MultiSelectInsertTrigger.xtype, type: MultiSelectInsertTrigger.xtype,
height: toPix(o.height, o.simple ? 1 : 2), height: toPix(o.height, o.simple ? 1 : 2),
text: o.text, text: o.text,
// adapter: this.popup, adapter: () => {
masker: { return this.popup.getView();
offset: {
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),
@ -178,8 +172,6 @@ export class MultiSelectInsertNoBarCombo extends Single {
type: MultiSelectNoBarPopupView.xtype, type: MultiSelectNoBarPopupView.xtype,
ref() { ref() {
self.popup = this; self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
}, },
listeners: [ listeners: [
{ {
@ -263,13 +255,8 @@ export class MultiSelectInsertNoBarCombo extends Single {
this.numberCounter = createWidget({ this.numberCounter = createWidget({
type: MultiSelectCheckSelectedSwitcher.xtype, type: MultiSelectCheckSelectedSwitcher.xtype,
masker: { adapter: () => {
offset: { return this.popup.getView();
left: 0,
top: 0,
right: 0,
bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1,
},
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemsCreator: bind(this._itemsCreator4Trigger, this), itemsCreator: bind(this._itemsCreator4Trigger, this),

4
packages/fineui/src/widget/multiselect/multiselect.popup.view.js

@ -98,4 +98,8 @@ export class MultiSelectPopupView extends Widget {
setDirection(direction, position) { setDirection(direction, position) {
this.popupView.setDirection(direction, position); this.popupView.setDirection(direction, position);
} }
getView() {
return this.popupView.getView();
}
} }

4
packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js

@ -93,4 +93,8 @@ export class MultiSelectNoBarPopupView extends Widget {
setDirection(direction, position) { setDirection(direction, position) {
this.popupView.setDirection(direction, position); this.popupView.setDirection(direction, position);
} }
getView() {
return this.popupView.getView();
}
} }

2
packages/fineui/src/widget/multitree/multi.tree.combo.js

@ -101,7 +101,7 @@ export class MultiTreeCombo extends Single {
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: { popup: {
type: "bi.multi_tree_popup_view", type: MultiTreePopup.xtype,
ref() { ref() {
self.popup = this; self.popup = this;
self.trigger.setAdapter(this); self.trigger.setAdapter(this);

3
packages/fineui/typescript/base/base.ts

@ -3,9 +3,12 @@ import { BroadcastController } from "../core/controller/controller.broadcast";
import { StyleLoaderManager } from "../core/loader/loader.style"; import { StyleLoaderManager } from "../core/loader/loader.style";
import { BubblesController } from "../core/controller/controller.bubbles"; import { BubblesController } from "../core/controller/controller.bubbles";
import { PopoverController } from "../core/controller/controller.popovers"; import { PopoverController } from "../core/controller/controller.popovers";
import { MaskersController } from "../core/controller/controller.masker";
export const Layers = new LayerController(); export const Layers = new LayerController();
export const Maskers = new MaskersController();
export const Bubbles = new BubblesController(); export const Bubbles = new BubblesController();
export const Broadcasts = new BroadcastController(); export const Broadcasts = new BroadcastController();

2
packages/fineui/typescript/core/base.ts

@ -400,6 +400,8 @@ export declare function getDate(...args: (number | string)[]): Date;
export declare function getTime(...args: any[]): number; export declare function getTime(...args: any[]): number;
export declare function clamp(number: number, lower: number, upper: number): number;
/** /**
* promise * promise
* @param obj * @param obj

5
packages/fineui/typescript/core/controller/controller.masker.ts

@ -0,0 +1,5 @@
import { LayerController } from "./controller.layer";
export declare class MaskersController extends LayerController {
}

14
packages/fineui/typescript/core/func/alias.ts

@ -1,3 +1,17 @@
export declare function jsonDecode(text: string): any; export declare function jsonDecode(text: string): any;
export declare function jsonEncode(json: any): any; export declare function jsonEncode(json: any): any;
export declare function contentFormat(cv: any, fmt: string): string;
export declare function htmlDecode(text: string): string;
export declare function htmlEncode(text: string): string;
export declare function getEncodeURL(urlTemplate: string, param: any): string;
export declare function encodeURIComponent(url: string): string;
export declare function decodeURIComponent(url: string): string;

1
packages/fineui/typescript/core/platform/web/index.ts

@ -3,3 +3,4 @@ export * as EventListener from "./eventListener";
export * as ResizeDetector from "./detectElementResize"; export * as ResizeDetector from "./detectElementResize";
export * from "./load"; export * from "./load";
export * as DOM from "./dom"; export * as DOM from "./dom";
export declare var $: any;

4
packages/fineui/typescript/router/router.ts

@ -1,3 +1,5 @@
import { Widget } from '../core/widget';
type Component = any type Component = any
type Dictionary<T> = { [key: string]: T } type Dictionary<T> = { [key: string]: T }
type ErrorHandler = (err: Error) => void type ErrorHandler = (err: Error) => void
@ -244,6 +246,6 @@ export declare class RouterWidget {
static xtype: string; static xtype: string;
} }
export declare class RouterView { export declare class RouterView extends Widget {
static xtype: string; static xtype: string;
} }

Loading…
Cancel
Save