From d223741f4c4eba5208e02301e12952d897b3d90a Mon Sep 17 00:00:00 2001 From: Xc Date: Sun, 26 Mar 2023 20:17:59 +0800 Subject: [PATCH] map --- lib/components/actionBtn/index.json | 9 - lib/components/actionBtnPanel/index.json | 9 - lib/components/actionTabPanel/index.json | 7 - lib/components/detail/index.json | 9 - lib/components/entityPicker/index.d.ts | 9 - lib/components/entityPicker/index.js | 30 -- lib/components/entityPicker/web.d.ts | 11 - lib/components/entityPicker/web.js | 28 -- lib/components/filter/locales/zh_CN.json | 23 -- lib/components/filter/web.js | 4 +- lib/components/foreignKeyFilter/index.d.ts | 7 - lib/components/foreignKeyFilter/index.js | 88 ------ .../foreignKeyFilter/locales/zh_CN.json | 16 - lib/components/foreignKeyFilter/web.d.ts | 21 -- lib/components/foreignKeyFilter/web.js | 112 ------- .../foreignKeyFilter/web.module.less | 4 - lib/components/icon/index.json | 3 - lib/components/list/index.json | 9 - lib/components/map/location/index.d.ts | 8 + lib/components/map/location/index.js | 13 + lib/components/map/location/web.module.less | 0 lib/components/map/map/index.d.ts | 13 + lib/components/map/map/index.js | 69 +++++ lib/components/map/map/web.module.less | 3 + lib/components/query/index.d.ts | 6 - lib/components/query/index.js | 79 ----- lib/components/query/utils.d.ts | 21 -- lib/components/query/utils.js | 35 --- lib/components/query/web.d.ts | 20 -- lib/components/query/web.js | 279 ------------------ lib/components/queryFilter/index.d.ts | 6 - lib/components/queryFilter/index.js | 25 -- lib/components/queryFilter/web.d.ts | 23 -- lib/components/queryFilter/web.js | 145 --------- lib/components/refAttr/index.d.ts | 2 +- lib/components/refAttr/index.js | 12 +- lib/components/refAttr/web.pc.d.ts | 2 +- lib/components/refAttr/web.pc.js | 14 +- lib/components/upsert/web.pc.js | 4 +- lib/miniprogram_npm/ec-canvas/ec-canvas.json | 4 - .../lin-ui/action-sheet/index.json | 8 - lib/miniprogram_npm/lin-ui/album/index.json | 5 - .../lin-ui/arc-popup/index.json | 6 - lib/miniprogram_npm/lin-ui/avatar/index.json | 6 - lib/miniprogram_npm/lin-ui/badge/index.json | 6 - lib/miniprogram_npm/lin-ui/button/index.json | 6 - .../lin-ui/calendar/components/day/index.json | 3 - .../calendar/components/header/index.json | 3 - .../calendar/components/mounth/index.json | 6 - .../lin-ui/calendar/index.json | 10 - .../lin-ui/capsule-bar/index.json | 3 - lib/miniprogram_npm/lin-ui/card/index.json | 4 - .../lin-ui/checkbox-group/index.json | 7 - .../lin-ui/checkbox/index.json | 6 - lib/miniprogram_npm/lin-ui/circle/index.json | 4 - .../lin-ui/collapse-item/index.json | 7 - .../lin-ui/collapse/index.json | 5 - .../lin-ui/combined-tabs/index.json | 7 - .../lin-ui/countdown/index.json | 6 - lib/miniprogram_npm/lin-ui/counter/index.json | 6 - .../lin-ui/custom-tab-bar/index.json | 3 - lib/miniprogram_npm/lin-ui/dialog/index.json | 6 - .../lin-ui/error-tip/index.json | 6 - .../lin-ui/form-item/index.json | 6 - lib/miniprogram_npm/lin-ui/form/index.json | 6 - .../lin-ui/grid-item/index.json | 6 - lib/miniprogram_npm/lin-ui/grid/index.json | 6 - lib/miniprogram_npm/lin-ui/icon/index.json | 6 - .../lin-ui/image-clipper-tools/index.json | 4 - .../lin-ui/image-clipper/index.json | 4 - .../lin-ui/image-picker/index.json | 7 - .../lin-ui/index-anchor/index.json | 6 - .../lin-ui/index-list/index.json | 4 - lib/miniprogram_npm/lin-ui/input/index.json | 7 - lib/miniprogram_npm/lin-ui/list/index.json | 8 - lib/miniprogram_npm/lin-ui/loading/index.json | 6 - .../lin-ui/loadmore/index.json | 6 - lib/miniprogram_npm/lin-ui/mask/index.json | 6 - lib/miniprogram_npm/lin-ui/message/index.json | 6 - .../lin-ui/notice-bar/index.json | 8 - lib/miniprogram_npm/lin-ui/picker/index.json | 7 - lib/miniprogram_npm/lin-ui/popup/index.json | 4 - lib/miniprogram_npm/lin-ui/price/index.json | 4 - .../lin-ui/progress/index.json | 4 - .../lin-ui/radio-group/index.json | 7 - lib/miniprogram_npm/lin-ui/radio/index.json | 4 - lib/miniprogram_npm/lin-ui/rate/index.json | 6 - .../lin-ui/search-bar/index.json | 7 - .../lin-ui/segment-item/index.json | 4 - lib/miniprogram_npm/lin-ui/segment/index.json | 8 - .../lin-ui/skeleton/index.json | 4 - .../lin-ui/slide-view/index.json | 5 - lib/miniprogram_npm/lin-ui/spin/index.json | 6 - .../lin-ui/status-show/index.json | 6 - lib/miniprogram_npm/lin-ui/step/index.json | 6 - lib/miniprogram_npm/lin-ui/steps/index.json | 7 - .../lin-ui/sticky-item/index.json | 4 - lib/miniprogram_npm/lin-ui/sticky/index.json | 4 - lib/miniprogram_npm/lin-ui/switch/index.json | 4 - lib/miniprogram_npm/lin-ui/tab-bar/index.json | 7 - .../lin-ui/tabpanel/index.json | 4 - lib/miniprogram_npm/lin-ui/tabs/index.json | 8 - lib/miniprogram_npm/lin-ui/tag/index.json | 6 - .../lin-ui/textarea/index.json | 7 - lib/miniprogram_npm/lin-ui/toast/index.json | 7 - .../lin-ui/transition/index.json | 7 - .../lin-ui/water-flow/index.json | 7 - lib/miniprogram_npm/popover/popover-item.json | 4 - lib/miniprogram_npm/popover/popover.json | 4 - lib/types/Filter.d.ts | 4 +- lib/utils/locate.d.ts | 4 + lib/utils/locate.js | 65 ++++ package.json | 1 + src/components/filter/web.tsx | 4 +- src/components/map/location/index.tsx | 38 +++ src/components/map/location/web.module.less | 0 src/components/map/map/index.tsx | 85 ++++++ src/components/map/map/web.module.less | 3 + src/components/refAttr/index.ts | 10 +- src/components/refAttr/web.pc.tsx | 18 +- src/components/upsert/web.pc.tsx | 4 +- src/types/Filter.ts | 4 +- src/utils/locate.ts | 45 +++ 123 files changed, 387 insertions(+), 1473 deletions(-) delete mode 100644 lib/components/actionBtn/index.json delete mode 100644 lib/components/actionBtnPanel/index.json delete mode 100644 lib/components/actionTabPanel/index.json delete mode 100644 lib/components/detail/index.json delete mode 100644 lib/components/entityPicker/index.d.ts delete mode 100644 lib/components/entityPicker/index.js delete mode 100644 lib/components/entityPicker/web.d.ts delete mode 100644 lib/components/entityPicker/web.js delete mode 100644 lib/components/filter/locales/zh_CN.json delete mode 100644 lib/components/foreignKeyFilter/index.d.ts delete mode 100644 lib/components/foreignKeyFilter/index.js delete mode 100644 lib/components/foreignKeyFilter/locales/zh_CN.json delete mode 100644 lib/components/foreignKeyFilter/web.d.ts delete mode 100644 lib/components/foreignKeyFilter/web.js delete mode 100644 lib/components/foreignKeyFilter/web.module.less delete mode 100644 lib/components/icon/index.json delete mode 100644 lib/components/list/index.json create mode 100644 lib/components/map/location/index.d.ts create mode 100644 lib/components/map/location/index.js create mode 100644 lib/components/map/location/web.module.less create mode 100644 lib/components/map/map/index.d.ts create mode 100644 lib/components/map/map/index.js create mode 100644 lib/components/map/map/web.module.less delete mode 100644 lib/components/query/index.d.ts delete mode 100644 lib/components/query/index.js delete mode 100644 lib/components/query/utils.d.ts delete mode 100644 lib/components/query/utils.js delete mode 100644 lib/components/query/web.d.ts delete mode 100644 lib/components/query/web.js delete mode 100644 lib/components/queryFilter/index.d.ts delete mode 100644 lib/components/queryFilter/index.js delete mode 100644 lib/components/queryFilter/web.d.ts delete mode 100644 lib/components/queryFilter/web.js delete mode 100644 lib/miniprogram_npm/ec-canvas/ec-canvas.json delete mode 100644 lib/miniprogram_npm/lin-ui/action-sheet/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/album/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/arc-popup/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/avatar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/badge/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/button/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/calendar/components/day/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/calendar/components/header/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/calendar/components/mounth/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/calendar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/capsule-bar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/card/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/checkbox-group/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/checkbox/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/circle/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/collapse-item/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/collapse/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/combined-tabs/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/countdown/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/counter/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/custom-tab-bar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/dialog/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/error-tip/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/form-item/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/form/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/grid-item/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/grid/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/icon/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/image-clipper-tools/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/image-clipper/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/image-picker/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/index-anchor/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/index-list/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/input/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/list/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/loading/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/loadmore/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/mask/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/message/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/notice-bar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/picker/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/popup/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/price/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/progress/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/radio-group/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/radio/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/rate/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/search-bar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/segment-item/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/segment/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/skeleton/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/slide-view/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/spin/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/status-show/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/step/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/steps/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/sticky-item/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/sticky/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/switch/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/tab-bar/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/tabpanel/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/tabs/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/tag/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/textarea/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/toast/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/transition/index.json delete mode 100644 lib/miniprogram_npm/lin-ui/water-flow/index.json delete mode 100644 lib/miniprogram_npm/popover/popover-item.json delete mode 100644 lib/miniprogram_npm/popover/popover.json create mode 100644 lib/utils/locate.d.ts create mode 100644 lib/utils/locate.js create mode 100644 src/components/map/location/index.tsx create mode 100644 src/components/map/location/web.module.less create mode 100644 src/components/map/map/index.tsx create mode 100644 src/components/map/map/web.module.less create mode 100644 src/utils/locate.ts diff --git a/lib/components/actionBtn/index.json b/lib/components/actionBtn/index.json deleted file mode 100644 index 4bf9f4ab..00000000 --- a/lib/components/actionBtn/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-dialog": "../../miniprogram_npm/lin-ui/dialog/index", - "l-button": "../../miniprogram_npm/lin-ui/button/index", - "popover": "../../miniprogram_npm/popover/popover", - "popover-item": "../../miniprogram_npm/popover/popover-item" - } -} \ No newline at end of file diff --git a/lib/components/actionBtnPanel/index.json b/lib/components/actionBtnPanel/index.json deleted file mode 100644 index 4bf9f4ab..00000000 --- a/lib/components/actionBtnPanel/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-dialog": "../../miniprogram_npm/lin-ui/dialog/index", - "l-button": "../../miniprogram_npm/lin-ui/button/index", - "popover": "../../miniprogram_npm/popover/popover", - "popover-item": "../../miniprogram_npm/popover/popover-item" - } -} \ No newline at end of file diff --git a/lib/components/actionTabPanel/index.json b/lib/components/actionTabPanel/index.json deleted file mode 100644 index 3ae0d416..00000000 --- a/lib/components/actionTabPanel/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "oak-icon": "../../icon/index", - "l-dialog": "../../miniprogram_npm/lin-ui/dialog/index" - } -} diff --git a/lib/components/detail/index.json b/lib/components/detail/index.json deleted file mode 100644 index 4bf9f4ab..00000000 --- a/lib/components/detail/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-dialog": "../../miniprogram_npm/lin-ui/dialog/index", - "l-button": "../../miniprogram_npm/lin-ui/button/index", - "popover": "../../miniprogram_npm/popover/popover", - "popover-item": "../../miniprogram_npm/popover/popover-item" - } -} \ No newline at end of file diff --git a/lib/components/entityPicker/index.d.ts b/lib/components/entityPicker/index.d.ts deleted file mode 100644 index 011193ed..00000000 --- a/lib/components/entityPicker/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; -export default _default; diff --git a/lib/components/entityPicker/index.js b/lib/components/entityPicker/index.js deleted file mode 100644 index e49e4bc1..00000000 --- a/lib/components/entityPicker/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = OakComponent({ - entity: function () { - var entity = this.props.entity; - return entity; - }, - formData: function (_a) { - var _b = _a.data, data = _b === void 0 ? [] : _b; - var title = this.props.title; - return { - rows: data.map(function (ele) { return ({ - id: ele.id, - title: title(ele) - }); }), - }; - }, - isList: true, - data: { - open: false, - }, - properties: { - entity: String, - multiple: Boolean, - onSelect: Function, - title: Function, - titleLabel: String, - }, - methods: {}, -}); diff --git a/lib/components/entityPicker/web.d.ts b/lib/components/entityPicker/web.d.ts deleted file mode 100644 index 9dfbdc6e..00000000 --- a/lib/components/entityPicker/web.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -import { WebComponentProps } from '../../types/Page'; -import { ED } from '../../types/AbstractComponent'; -export default function Render(props: WebComponentProps; - onSelect: (rows: ED[keyof ED]['Schema'][]) => void; - multiple: boolean; - titleLabel: string; -}, {}>): JSX.Element; diff --git a/lib/components/entityPicker/web.js b/lib/components/entityPicker/web.js deleted file mode 100644 index 9754c917..00000000 --- a/lib/components/entityPicker/web.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var jsx_runtime_1 = require("react/jsx-runtime"); -var antd_1 = require("antd"); -function Render(props) { - var _a = props.data, oakLoading = _a.oakLoading, rows = _a.rows, onSelect = _a.onSelect, titleLabel = _a.titleLabel, _b = _a.multiple, multiple = _b === void 0 ? false : _b; - var t = props.methods.t; - var columns = [{ - dataIndex: 'title', - title: titleLabel, - }]; - return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: rows, rowKey: "id", rowSelection: { - type: multiple ? 'checkbox' : 'radio', - // onSelect: (record) => { - // onSelect(record); - // }, - onChange: function (selectedRowKeys, selectedRows, info) { - onSelect(selectedRows); - }, - }, onRow: !multiple ? function (record) { - return { - onClick: function (event) { - onSelect([record]); - }, // 点击行 - }; - } : undefined, columns: columns }) })); -} -exports.default = Render; diff --git a/lib/components/filter/locales/zh_CN.json b/lib/components/filter/locales/zh_CN.json deleted file mode 100644 index 95206b78..00000000 --- a/lib/components/filter/locales/zh_CN.json +++ /dev/null @@ -1,23 +0,0 @@ - -{ - "placeholder": { - "input": "请输入", - "select": "请选择" - }, - "attr": { - "id": "编号", - "$$createAt$$": "创建时间", - "$$updateAt$$": "更新时间", - "$$deleteAt$$": "删除时间", - "$$seq$$": "序号", - "$text": "全文检索" - }, - "tip": { - "yes": "是", - "no": "否", - "unselected": "未选" - }, - "op": { - "$includes": "包含" - } -} \ No newline at end of file diff --git a/lib/components/filter/web.js b/lib/components/filter/web.js index ce8591fc..d590745f 100644 --- a/lib/components/filter/web.js +++ b/lib/components/filter/web.js @@ -264,10 +264,10 @@ function Render(props) { (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); } if (op && ['$in', '$nin'].includes(op)) { - V = ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: true, entityIds: _value, pickerDef: column.refProps, onChange: function (ids) { console.log(ids, '这里等测试到了再写(Xc)'); } })); + V = ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: true, entityIds: _value, pickerRender: column.refProps, onChange: function (ids) { console.log(ids, '这里等测试到了再写(Xc)'); } })); } else { - V = ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: false, entityIds: _value, pickerDef: column.refProps, onChange: function (id) { console.log(id, '这里等测试到了再写(Xc)'); } })); + V = ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: false, entityIds: _value, pickerRender: column.refProps, onChange: function (id) { console.log(id, '这里等测试到了再写(Xc)'); } })); } break; } diff --git a/lib/components/foreignKeyFilter/index.d.ts b/lib/components/foreignKeyFilter/index.d.ts deleted file mode 100644 index 16ec53c6..00000000 --- a/lib/components/foreignKeyFilter/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; -export default _default; diff --git a/lib/components/foreignKeyFilter/index.js b/lib/components/foreignKeyFilter/index.js deleted file mode 100644 index 873dd474..00000000 --- a/lib/components/foreignKeyFilter/index.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var relation_1 = require("oak-domain/lib/store/relation"); -var utils_1 = require("../filter/utils"); -exports.default = OakComponent({ - entity: function () { - var entity = this.props.entity; - return entity; - }, - isList: true, - data: { - open: false, - }, - properties: { - entity: String, - column: Object, - formItem: Boolean, - }, - methods: { - getNamedFilter: function (name) { - if (this.state.oakFullpath) { - var filter = this.getFilterByName(name); - return filter; - } - }, - getRefByAttr: function (entity, field) { - if (!this.state.oakFullpath) { - return; - } - var dataSchema = this.features.cache.getSchema(); - var attrs = field.split('.'); - var idx = 0; - var _entity = entity; - var attr; - var attrType; - var attribute; - var entityI18n = entity; - var attrI18n; - while (idx <= attrs.length - 1) { - attr = attrs[idx]; - attrI18n = attr; - var relation = (0, relation_1.judgeRelation)(dataSchema, _entity, attr); - if (relation === 1) { - var attributes = (0, utils_1.getAttributes)(dataSchema[_entity].attributes); - attribute = attributes[attr]; - attrType = attribute.type; - if (attrType === 'ref') { - attrI18n = attribute.ref; - } - } - else if (relation === 2) { - // entity entityId - var ref = attr; - _entity = ref; - entityI18n = ref; - } - else if (typeof relation === 'string') { - var ref = relation; - _entity = ref; - entityI18n = ref; - } - idx++; - } - return { - entity: _entity, - attr: attr, - attrType: attrType, - entityI18n: entityI18n, - attrI18n: attrI18n, - attribute: attribute, - }; - }, - getEntityData: function (entity, ids) { - var _a; - var column = this.props.column; - var projection = ((_a = column === null || column === void 0 ? void 0 : column.refProps) === null || _a === void 0 ? void 0 : _a.projection) || { id: 1, name: 1 }; - var entityData = this.features.cache.get(entity, { - data: projection, - filter: { - id: { - $in: ids, - }, - }, - }, true); - return entityData; - }, - }, -}); diff --git a/lib/components/foreignKeyFilter/locales/zh_CN.json b/lib/components/foreignKeyFilter/locales/zh_CN.json deleted file mode 100644 index 0f730531..00000000 --- a/lib/components/foreignKeyFilter/locales/zh_CN.json +++ /dev/null @@ -1,16 +0,0 @@ - -{ - "placeholder": { - "input": "请输入", - "select": "请选择" - }, - "attr": { - "id": "编号", - "$$createAt$$": "创建时间", - "$$updateAt$$": "更新时间", - "$$deleteAt$$": "删除时间", - "$$seq$$": "序号" - }, - "closed": "关闭", - "select": "请选择" -} \ No newline at end of file diff --git a/lib/components/foreignKeyFilter/web.d.ts b/lib/components/foreignKeyFilter/web.d.ts deleted file mode 100644 index 58078ca6..00000000 --- a/lib/components/foreignKeyFilter/web.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -import { WebComponentProps } from '../../types/Page'; -import { ED } from '../../types/AbstractComponent'; -import { ColumnProps } from '../../types/Filter'; -export default function Render(props: WebComponentProps; - onSearch: () => void; - formItem: boolean; -}, { - getNamedFilter: (name: string) => Record; - getRefByAttr: (entity: T, attr: keyof ED2[T]['OpSchema']) => { - entity: keyof ED2; - attr: string; - attrType: string; - entityI18n: keyof ED2; - attrI18n: string; - attribute: Record; - }; - getEntityData: (entity: keyof ED2, ids: string[]) => ED2[keyof ED2]['Schema'][]; -}>): JSX.Element | null; diff --git a/lib/components/foreignKeyFilter/web.js b/lib/components/foreignKeyFilter/web.js deleted file mode 100644 index a61fbb4f..00000000 --- a/lib/components/foreignKeyFilter/web.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var jsx_runtime_1 = require("react/jsx-runtime"); -var react_1 = require("react"); -var antd_1 = require("antd"); -var icons_1 = require("@ant-design/icons"); -var utils_1 = require("../filter/utils"); -var picker_1 = tslib_1.__importDefault(require("../picker")); -var lodash_1 = require("oak-domain/lib/utils/lodash"); -var assert_1 = require("oak-domain/lib/utils/assert"); -function Render(props) { - var _a = props.data, onSearch = _a.onSearch, entity = _a.entity, oakFullpath = _a.oakFullpath, _b = _a.formItem, formItem = _b === void 0 ? true : _b, column = _a.column; - var _c = props.methods, t = _c.t, refresh = _c.refresh, getNamedFilter = _c.getNamedFilter, removeNamedFilterByName = _c.removeNamedFilterByName, addNamedFilter = _c.addNamedFilter, getRefByAttr = _c.getRefByAttr, setMessage = _c.setMessage, getEntityData = _c.getEntityData; - var _d = tslib_1.__read((0, react_1.useState)(false), 2), open = _d[0], setOpen = _d[1]; - var _e = tslib_1.__read((0, react_1.useState)([]), 2), selectRows = _e[0], setSelectRows = _e[1]; - var op = column.op, attr = column.attr, label = column.label, _f = column.transformValue, transformValue = _f === void 0 ? function (column, filter) { return (0, lodash_1.get)(filter, (0, utils_1.getOp)(column), ''); } : _f, _g = column.transformFilter, transformFilter = _g === void 0 ? function (column, value) { return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), value); } : _g, placeholder = column.placeholder, refProps = column.refProps; - var name = (0, utils_1.getFilterName)(column); - var filter = getNamedFilter(name); - var params = getRefByAttr(entity, attr); - if (!params) { - return null; - } - var _value = transformValue(column, filter); - var entity2 = params.entity, attr2 = params.attr, attrType = params.attrType, entityI18n = params.entityI18n, attrI18n = params.attrI18n, attribute = params.attribute; - if (attribute.type !== 'ref') { - (0, assert_1.assert)(false, "attr\u4E3A".concat(attr, "\uFF0C\u7C7B\u578B\u3010").concat(attribute.type, "\u3011\u4E0D\u662Fref")); - return null; - } - var _label = ''; - if (label && label.indexOf(':') === -1) { - _label = label; - } - else { - _label = t("".concat(entityI18n, ":attr.").concat(attrI18n)); - } - var inputKey = 'name'; - var projection = (refProps === null || refProps === void 0 ? void 0 : refProps.projection) || { id: 1, name: 1 }; - var modalProps = {}; - var rows = []; - var multiple = !!op && ['$in', '$nin'].includes(op); - if (!multiple) { - modalProps = { - footer: false, - }; - rows = _value - ? getEntityData(attribute.ref, [_value]) - : []; - } - else { - rows = _value - ? getEntityData(attribute.ref, _value) - : []; - } - var _value2; - if (rows.length > 0) { - _value2 = rows.map(function (ele) { return ele[inputKey]; }).join('、'); - } - var deleteFilter = function (interval) { - removeNamedFilterByName(name); - }; - var setFilterAndResetFilter = function (value, getFilter) { - if (value === '' || - value === undefined || - value === null || - (value === null || value === void 0 ? void 0 : value.length) === 0) { - removeNamedFilterByName(name); - return; - } - var filter2 = typeof getFilter === 'function' - ? getFilter() - : transformFilter(column, value); - addNamedFilter({ - filter: filter2, - '#name': name, - }); - }; - var V = ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.select'), onClick: function () { - setOpen(true); - }, - // allowClear - // onChange={() => { - // deleteFilter(); - // }} - value: _value2, readOnly: true, suffix: _value && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function () { - deleteFilter(); - setSelectRows([]); - } }, { children: (0, jsx_runtime_1.jsx)(icons_1.CloseOutlined, { size: 14 }) }))) }) })); - if (formItem) { - V = (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: _label }, { children: V })); - } - return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [V, (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: t('select'), centered: true, open: open, onOk: function () { - if (selectRows.length === 0) { - setMessage({ - type: 'warning', - content: t('select'), - }); - return; - } - var ids = selectRows.map(function (ele) { return ele.id; }); - setFilterAndResetFilter(ids); - setOpen(false); - }, cancelText: t('closed'), onCancel: function () { return setOpen(false); }, width: "50%", destroyOnClose: true }, modalProps, { children: (0, jsx_runtime_1.jsx)(picker_1.default, { multiple: multiple, oakAutoUnmount: true, oakProjection: projection, entity: attribute.ref, oakPath: "$foreignKeyFilter-entity/picker-".concat(entity), onSelect: function (rows) { - setSelectRows(rows); - if (!multiple) { - var ids = rows.map(function (ele) { return ele.id; }); - setFilterAndResetFilter(ids[0]); - setOpen(false); - } - } }) }))] })); -} -exports.default = Render; diff --git a/lib/components/foreignKeyFilter/web.module.less b/lib/components/foreignKeyFilter/web.module.less deleted file mode 100644 index a7371e3f..00000000 --- a/lib/components/foreignKeyFilter/web.module.less +++ /dev/null @@ -1,4 +0,0 @@ -.actionBox { - justify-content: flex-end; - width: 100%; -} \ No newline at end of file diff --git a/lib/components/icon/index.json b/lib/components/icon/index.json deleted file mode 100644 index fba482a4..00000000 --- a/lib/components/icon/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/lib/components/list/index.json b/lib/components/list/index.json deleted file mode 100644 index 4bf9f4ab..00000000 --- a/lib/components/list/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-dialog": "../../miniprogram_npm/lin-ui/dialog/index", - "l-button": "../../miniprogram_npm/lin-ui/button/index", - "popover": "../../miniprogram_npm/popover/popover", - "popover-item": "../../miniprogram_npm/popover/popover-item" - } -} \ No newline at end of file diff --git a/lib/components/map/location/index.d.ts b/lib/components/map/location/index.d.ts new file mode 100644 index 00000000..8052a433 --- /dev/null +++ b/lib/components/map/location/index.d.ts @@ -0,0 +1,8 @@ +/// +declare type LocationProps = { + poiName?: string; + coordinate?: [number, number]; + areaId?: string; +}; +export default function Location(props: LocationProps): JSX.Element; +export {}; diff --git a/lib/components/map/location/index.js b/lib/components/map/location/index.js new file mode 100644 index 00000000..f47f8429 --- /dev/null +++ b/lib/components/map/location/index.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var jsx_runtime_1 = require("react/jsx-runtime"); +var antd_1 = require("antd"); +var map_1 = tslib_1.__importDefault(require("../map")); +function Location(props) { + if (window.innerWidth < 500) { + // 窄屏 + } + return ((0, jsx_runtime_1.jsx)(antd_1.Row, tslib_1.__assign({ gutter: [16, 16] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ xs: 24, sm: 14 }, { children: (0, jsx_runtime_1.jsx)(map_1.default, { center: props.coordinate, undragable: true, unzoomable: true }) })) }))); +} +exports.default = Location; diff --git a/lib/components/map/location/web.module.less b/lib/components/map/location/web.module.less new file mode 100644 index 00000000..e69de29b diff --git a/lib/components/map/map/index.d.ts b/lib/components/map/map/index.d.ts new file mode 100644 index 00000000..a092baf6 --- /dev/null +++ b/lib/components/map/map/index.d.ts @@ -0,0 +1,13 @@ +/// +import 'ol/ol.css'; +declare type MapProps = { + center?: [number, number]; + zoom?: number; + unzoomable?: boolean; + undragable?: boolean; + style?: object; + autoLocate?: boolean; + markers?: Array<[number, number]>; +}; +export default function Map(props: MapProps): JSX.Element; +export {}; diff --git a/lib/components/map/map/index.js b/lib/components/map/map/index.js new file mode 100644 index 00000000..7b26f8f0 --- /dev/null +++ b/lib/components/map/map/index.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var jsx_runtime_1 = require("react/jsx-runtime"); +var react_1 = require("react"); +var Map_1 = tslib_1.__importDefault(require("ol/Map")); +var XYZ_1 = tslib_1.__importDefault(require("ol/source/XYZ")); +var Tile_1 = tslib_1.__importDefault(require("ol/layer/Tile")); +var View_1 = tslib_1.__importDefault(require("ol/View")); +var proj_1 = require("ol/proj"); +var DragPan_1 = tslib_1.__importDefault(require("ol/interaction/DragPan")); +require("ol/ol.css"); +var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); +var locate_1 = require("../../../utils/locate"); +var prefix = Math.ceil(Math.random() * 1000); +var DEFAULT_CENTER = [120.123, 30.259]; // 浙大玉泉 +var DEFAULT_ZOOM = 15; +function Map(props) { + var map; + (0, react_1.useEffect)(function () { + map = new Map_1.default({ + target: "map-".concat(prefix), + layers: [ + new Tile_1.default({ + source: new XYZ_1.default({ + url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}', + wrapX: false, + }), + }), + ], + view: new View_1.default({ + center: (0, proj_1.fromLonLat)(props.center || DEFAULT_CENTER), + zoom: props.zoom || DEFAULT_ZOOM, + minZoom: props.unzoomable ? props.zoom : undefined, + maxZoom: props.unzoomable ? props.zoom : undefined, + }), + controls: props.unzoomable ? [] : undefined, + }); + if (props.undragable) { + map.getInteractions().forEach(function (ele) { + if (ele instanceof DragPan_1.default) { + ele.setActive(false); + } + }); + } + if (props.autoLocate) { + (0, locate_1.locate)().then(function (_a) { + var latitude = _a.latitude, longitude = _a.longitude; + map.getView().setCenter((0, proj_1.fromLonLat)([longitude, latitude])); + }); + } + }, []); + (0, react_1.useEffect)(function () { + if (props.center) { + map && map.getView().setCenter((0, proj_1.fromLonLat)(props.center)); + } + }, [props.center]); + (0, react_1.useEffect)(function () { + if (props.markers) { + var markerLayer = map.getLayers().get('markerLayer'); + if (!markerLayer) { + // todo + } + } + }, [props.markers]); + return (0, jsx_runtime_1.jsx)("div", { id: "map-".concat(prefix), className: web_module_less_1.default.map, style: props.style }); +} +exports.default = Map; +; diff --git a/lib/components/map/map/web.module.less b/lib/components/map/map/web.module.less new file mode 100644 index 00000000..0326bef2 --- /dev/null +++ b/lib/components/map/map/web.module.less @@ -0,0 +1,3 @@ +.map { + height: 400px; +} diff --git a/lib/components/query/index.d.ts b/lib/components/query/index.d.ts deleted file mode 100644 index 8db850c1..00000000 --- a/lib/components/query/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; -export default _default; diff --git a/lib/components/query/index.js b/lib/components/query/index.js deleted file mode 100644 index 0ee06080..00000000 --- a/lib/components/query/index.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var relation_1 = require("oak-domain/lib/store/relation"); -var utils_1 = require("./utils"); -exports.default = OakComponent({ - entity: function () { - var entity = this.props.entity; - return entity; - }, - isList: true, - data: { - open: false, - }, - properties: { - entity: String, - column: Object, - }, - methods: { - getNamedFilter: function (name) { - if (this.state.oakFullpath) { - var filter = this.getFilterByName(name); - return filter; - } - }, - getRefByAttr: function (entity, field) { - if (!this.state.oakFullpath) { - return; - } - var dataSchema = this.features.cache.getSchema(); - var attrs = field.split('.'); - var idx = 0; - var _entity = entity; - var attr; - var attrType; - var attribute; - var entityI18n = entity; - var attrI18n; - while (idx <= attrs.length - 1) { - attr = attrs[idx]; - attrI18n = attr; - if (attr.startsWith('$text')) { - // 全文的话 - attrType = '$text'; - } - else { - var relation = (0, relation_1.judgeRelation)(dataSchema, _entity, attr); - if (relation === 1) { - var attributes = (0, utils_1.getAttributes)(dataSchema[_entity].attributes); - attribute = attributes[attr]; - attrType = attribute.type; - if (attrType === 'ref') { - attrI18n = attribute.ref; - } - } - else if (relation === 2) { - // entity entityId - var ref = attr; - _entity = ref; - entityI18n = ref; - } - else if (typeof relation === 'string') { - var ref = relation; - _entity = ref; - entityI18n = ref; - } - } - idx++; - } - return { - entity: _entity, - attr: attr, - attrType: attrType, - entityI18n: entityI18n, - attrI18n: attrI18n, - attribute: attribute, - }; - }, - }, -}); diff --git a/lib/components/query/utils.d.ts b/lib/components/query/utils.d.ts deleted file mode 100644 index 1866bb4c..00000000 --- a/lib/components/query/utils.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ColumnProps, Ops } from './column'; -export declare function getOp(column: ColumnProps): string; -export declare function getOp2(column: ColumnProps, op: Ops): string; -export declare function getFilterName(column: ColumnProps): string; -export declare function getAttributes(attributes: Record): Record & { - id: { - type: string; - }; - $$createAt$$: { - type: string; - }; - $$updateAt$$: { - type: string; - }; - $$deleteAt$$: { - type: string; - }; - $$seq$$: { - type: string; - }; -}; diff --git a/lib/components/query/utils.js b/lib/components/query/utils.js deleted file mode 100644 index b54c4de3..00000000 --- a/lib/components/query/utils.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getAttributes = exports.getFilterName = exports.getOp2 = exports.getOp = void 0; -function getOp(column) { - return "".concat(column.attr).concat(column.op ? ".".concat(column.op) : ''); -} -exports.getOp = getOp; -function getOp2(column, op) { - return "".concat(column.attr).concat(column.op || op ? ".".concat(column.op || op) : ''); -} -exports.getOp2 = getOp2; -function getFilterName(column) { - return column.filterName || getOp(column); -} -exports.getFilterName = getFilterName; -function getAttributes(attributes) { - return Object.assign({}, attributes, { - id: { - type: 'char', - }, - $$createAt$$: { - type: 'datetime', - }, - $$updateAt$$: { - type: 'datetime', - }, - $$deleteAt$$: { - type: 'datetime', - }, - $$seq$$: { - type: 'datetime', - }, - }); -} -exports.getAttributes = getAttributes; diff --git a/lib/components/query/web.d.ts b/lib/components/query/web.d.ts deleted file mode 100644 index 741ee5b9..00000000 --- a/lib/components/query/web.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import { WebComponentProps } from '../../types/Page'; -import { ED } from '../../types/AbstractComponent'; -import { ColumnProps } from './column'; -export default function Render(props: WebComponentProps void; -}, { - getNamedFilter: (name: string) => Record; - getRefByAttr: (entity: keyof ED, attr: string) => { - entity: keyof ED; - attr: string; - attrType: string; - entityI18n: keyof ED; - attrI18n: string; - attribute: Record; - }; -}>): JSX.Element | null; diff --git a/lib/components/query/web.js b/lib/components/query/web.js deleted file mode 100644 index 75d0e7c4..00000000 --- a/lib/components/query/web.js +++ /dev/null @@ -1,279 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var jsx_runtime_1 = require("react/jsx-runtime"); -var antd_1 = require("antd"); -var money_1 = require("oak-domain/lib/utils/money"); -var Entity_1 = require("oak-domain/lib/types/Entity"); -var dayjs_1 = tslib_1.__importDefault(require("dayjs")); -var weekday_1 = tslib_1.__importDefault(require("dayjs/plugin/weekday")); -var localeData_1 = tslib_1.__importDefault(require("dayjs/plugin/localeData")); -dayjs_1.default.extend(weekday_1.default); -dayjs_1.default.extend(localeData_1.default); -var lodash_1 = require("oak-domain/lib/utils/lodash"); -var assert_1 = require("oak-domain/lib/utils/assert"); -var utils_1 = require("./utils"); -var foreignKeyFilter_1 = tslib_1.__importDefault(require("../foreignKeyFilter")); -function Render(props) { - var _a = props.data, entity = _a.entity, column = _a.column, oakFullpath = _a.oakFullpath; - var _b = props.methods, t = _b.t, addNamedFilter = _b.addNamedFilter, removeNamedFilterByName = _b.removeNamedFilterByName, refresh = _b.refresh, getNamedFilter = _b.getNamedFilter, getRefByAttr = _b.getRefByAttr; - var name = (0, utils_1.getFilterName)(column); - var filter = getNamedFilter(name); - var _c = column.type, type = _c === void 0 ? 'text' : _c, op = column.op, attr = column.attr, label = column.label, _d = column.transformValue, transformValue = _d === void 0 ? function (column, filter) { return (0, lodash_1.get)(filter, (0, utils_1.getOp)(column), ''); } : _d, _e = column.transformFilter, transformFilter = _e === void 0 ? function (column, value) { return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), value); } : _e, placeholder = column.placeholder; - var params = getRefByAttr(entity, attr); - if (!params) { - return null; - } - var entity2 = params.entity, attr2 = params.attr, attrType = params.attrType, entityI18n = params.entityI18n, attrI18n = params.attrI18n, attribute = params.attribute; - var _label = ''; - if (label && label.indexOf(':') === -1) { - _label = label; - } - else if (['$text'].includes(attr2)) { - _label = t("attr.".concat(attr2)); - } - else if (Entity_1.initinctiveAttributes.includes(attr2)) { - _label = t("attr.".concat(attr2)); - } - else { - _label = t("".concat(entityI18n, ":attr.").concat(attrI18n)); - } - var deleteFilter = function (interval) { - removeNamedFilterByName(name); - }; - var setFilterAndResetFilter = function (value, getFilter) { - if (value === '' || - value === undefined || - value === null || - (value === null || value === void 0 ? void 0 : value.length) === 0) { - removeNamedFilterByName(name); - return; - } - var filter2 = typeof getFilter === 'function' - ? getFilter() - : transformFilter(column, value); - addNamedFilter({ - filter: filter2, - '#name': name, - }); - }; - var V; - if (attrType === '$text') { - var ops = ['$search']; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - var _f = column.transformFilter, transformFilter_1 = _f === void 0 ? function (column, value) { - return (0, lodash_1.set)({}, (0, utils_1.getOp2)(column, '$search'), value); - } : _f, _g = column.transformValue, transformValue_1 = _g === void 0 ? function (column, filter) { return (0, lodash_1.get)(filter, (0, utils_1.getOp2)(column, '$search'), ''); } : _g; - var _value_1 = transformValue_1(column, filter); - return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: _label }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: _value_1, onChange: function (e) { - var val = e.target.value; - setFilterAndResetFilter(val, function () { - return transformFilter_1(column, val); - }); - }, allowClear: true, onPressEnter: function () { } }) }) }))); - } - var _value = transformValue(column, filter); - switch (attrType) { - case 'money': { - var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte']; - var moneyVal_1 = _value ? (0, money_1.ToYuan)(_value) : ''; - V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: moneyVal_1, onChange: function (e) { - var val = e.target.value; - var val2 = /^(-?[1-9]\d*(\.\d*[1-9])?)|(-?0\.\d*[1-9])$/.test(val) ? (0, money_1.ToCent)(Number(val)) : moneyVal_1; - setFilterAndResetFilter(val2); - }, allowClear: true, onPressEnter: function () { } })); - break; - } - case 'float': { - var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte']; - V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: _value, onChange: function (e) { - var val = e.target.value; - setFilterAndResetFilter(val); - }, allowClear: true, onPressEnter: function () { } })); - break; - } - case 'integer': - case 'int': { - var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte']; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: _value, onChange: function (e) { - var val = e.target.value; - setFilterAndResetFilter(val); - }, allowClear: true, onPressEnter: function () { } })); - break; - } - case 'char': - case 'varchar': { - var ops = [ - '$eq', - '$ne', - '$endsWith', - '$includes', - '$startsWith', - ]; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: _value, onChange: function (e) { - var val = e.target.value; - setFilterAndResetFilter(val); - }, allowClear: true, onPressEnter: function () { } })); - break; - } - case 'boolean': { - var text2 = void 0; - switch (_value) { - case true: { - text2 = t('tip.yes'); - break; - } - case false: { - text2 = t('tip.no'); - break; - } - default: { - text2 = t('tip.unselected'); - break; - } - } - V = ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { - var val; - if (_value === true) { - val = false; - } - else if (_value === false) { - val = ''; - } - else { - val = true; - } - setFilterAndResetFilter(val); - } }, { children: text2 }))); - break; - } - case 'enum': { - var ops = ['$in', '$nin', '$eq', '$ne']; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - var enumeration = attribute === null || attribute === void 0 ? void 0 : attribute.enumeration; - var selectProps = column.selectProps; - var _h = selectProps || {}, options = _h.options, _j = _h.transformInOption, transformInOption = _j === void 0 ? function (option) { return (typeof option === 'object' ? option.value : option); } : _j, // 根据 - _k = _h.transformOutOption, // 根据 - transformOutOption = _k === void 0 ? function (option) { return (typeof option === 'object' ? option.label : option); } : _k; - var options2 = options || - (enumeration === null || enumeration === void 0 ? void 0 : enumeration.map(function (ele) { return ({ - label: t("".concat(entityI18n, ":v.").concat(attrI18n, ".").concat(ele)), - value: ele, - }); })); - if (op && ['$in', '$nin'].includes(op)) { - var _l = column.transformValue, transformValue_2 = _l === void 0 ? function (column, filter) { - return (0, lodash_1.get)(filter, (0, utils_1.getOp)(column), []); - } : _l; - var selectValue = transformValue_2(column, filter); - V = ((0, jsx_runtime_1.jsx)(antd_1.Select, { mode: "multiple", allowClear: true, placeholder: placeholder || t('placeholder.select'), value: selectValue, onChange: function (value) { - setFilterAndResetFilter(value); - }, options: (options2 === null || options2 === void 0 ? void 0 : options2.length) > 0 ? options2 : [], onClear: function () { - deleteFilter(); - } })); - } - else { - V = ((0, jsx_runtime_1.jsx)(antd_1.Select, { allowClear: true, placeholder: placeholder || t('placeholder.select'), value: _value, onChange: function (value) { - setFilterAndResetFilter(value); - }, options: (options2 === null || options2 === void 0 ? void 0 : options2.length) > 0 ? options2 : [], onClear: function () { - deleteFilter(); - } })); - } - break; - } - case 'datetime': { - var dateProps = column.dateProps; - var _m = dateProps || {}, _o = _m.range, range = _o === void 0 ? false : _o, _p = _m.showTime, showTime = _p === void 0 ? false : _p; - var unitOfTime_1 = 'day'; - if (range) { - var ops = ['$between']; - (0, assert_1.assert)(op, '选择时间范围,算子必须传入'); - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - var _q = column.transformValue, transformValue_3 = _q === void 0 ? function (column, filter) { - return (0, lodash_1.get)(filter, "".concat((0, utils_1.getOp)(column)), []); - } : _q, _r = column.transformFilter, transformFilter_2 = _r === void 0 ? function (column, value) { - var startTime = (0, dayjs_1.default)(value[0]) - .startOf(unitOfTime_1) - .valueOf(); - var endTime = (0, dayjs_1.default)(value[1]) - .endOf(unitOfTime_1) - .valueOf(); - return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), [startTime, endTime]); - } : _r; - var dateValues = transformValue_3(column, filter); - var _s = tslib_1.__read(dateValues, 2), startTime = _s[0], endTIme = _s[1]; - V = ((0, jsx_runtime_1.jsx)(antd_1.DatePicker.RangePicker, { showTime: showTime, value: [ - startTime ? (0, dayjs_1.default)(startTime) : '', - endTIme ? (0, dayjs_1.default)(endTIme) : '', - ], onChange: function (dates, dateStrings) { - setFilterAndResetFilter(dates, function () { - return transformFilter_2(column, dates); - }); - } })); - } - else { - var ops = ['$between', '$gt', '$gte', '$lt', '$lte']; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - var _t = column.transformFilter, transformFilter_3 = _t === void 0 ? function (column, value) { - var startTime = (0, dayjs_1.default)(value) - .startOf(unitOfTime_1) - .valueOf(); - var endTime = (0, dayjs_1.default)(value) - .endOf(unitOfTime_1) - .valueOf(); - if (column.op === '$between') { - var values2 = [startTime, endTime]; - return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), values2); - } - if (column.op === '$gt' || column.op === '$gte') { - return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), startTime); - } - if (column.op === '$lt' || column.op === '$lte') { - return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), endTime); - } - return (0, lodash_1.set)({}, (0, utils_1.getOp)(column), (0, dayjs_1.default)(value).valueOf()); - } : _t, _u = column.transformValue, transformValue_4 = _u === void 0 ? function (column, filter) { - if (column.op === '$between') { - return (0, lodash_1.get)(filter, "".concat((0, utils_1.getOp)(column), ".0"), null); - } - return (0, lodash_1.get)(filter, (0, utils_1.getOp)(column), null); - } : _u; - var dateValue = transformValue_4(column, filter); - V = ((0, jsx_runtime_1.jsx)(antd_1.DatePicker, { format: "YYYY-MM-DD", showTime: showTime, value: dateValue ? (0, dayjs_1.default)(dateValue) : null, onChange: function (date, dateString) { - setFilterAndResetFilter(date, function () { - return transformFilter_3(column, date); - }); - } })); - } - break; - } - case 'ref': { - var ops = ['$in', '$nin', '$eq', '$ne']; - if (op) { - (0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops)); - } - V = ((0, jsx_runtime_1.jsx)(foreignKeyFilter_1.default, { formItem: false, entity: entity, oakPath: oakFullpath, column: column })); - break; - } - default: { - (0, assert_1.assert)(false, "\u7C7B\u578B\u3010".concat(attrType, "\u3011\u6682\u4E0D\u652F\u6301")); - break; - } - } - return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: _label }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: V }) }))); -} -exports.default = Render; -function assertMessage(attr, attrType, op, ops) { - return "attr\u4E3A\u3010".concat(attr, "\u3011, \u4F20\u5165\u7684\u7B97\u5B50\u3010").concat(op, "\u3011\u4E0D\u652F\u6301\uFF0C\u7C7B\u578B\u3010").concat(attrType, "\u3011\u53EA\u652F\u6301\u3010").concat(JSON.stringify(ops), "\u3011"); -} diff --git a/lib/components/queryFilter/index.d.ts b/lib/components/queryFilter/index.d.ts deleted file mode 100644 index 1c6fc744..00000000 --- a/lib/components/queryFilter/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; -export default _default; diff --git a/lib/components/queryFilter/index.js b/lib/components/queryFilter/index.js deleted file mode 100644 index bdbc5aa4..00000000 --- a/lib/components/queryFilter/index.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = OakComponent({ - entity: function () { - var entity = this.props.entity; - return entity; - }, - isList: true, - data: { - open: false, - }, - properties: { - entity: String, - columns: Array, - }, - methods: { - getNamedFilters: function () { - if (this.state.oakFullpath) { - var namedFilters = this.features.runningTree.getNamedFilters(this.state.oakFullpath); - return namedFilters; - } - return []; - }, - }, -}); diff --git a/lib/components/queryFilter/web.d.ts b/lib/components/queryFilter/web.d.ts deleted file mode 100644 index bc4d2fb4..00000000 --- a/lib/components/queryFilter/web.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/// -import { WebComponentProps } from '../../types/Page'; -import { ED } from '../../types/AbstractComponent'; -import { ColSpanType, ColumnProps } from '../query/column'; -declare type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; -declare type ColumnMapType = { - xxl: ColSpanType; - xl: ColSpanType; - lg: ColSpanType; - md: ColSpanType; - sm: ColSpanType; - xs: ColSpanType; -}; -export default function Render(props: WebComponentProps; - onSearch: () => void; - column?: ColSpanType | ColumnMapType; - width: Width; -}, { - getNamedFilters: () => Record[]; -}>): JSX.Element | null; -export {}; diff --git a/lib/components/queryFilter/web.js b/lib/components/queryFilter/web.js deleted file mode 100644 index 10d8e3a9..00000000 --- a/lib/components/queryFilter/web.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var tslib_1 = require("tslib"); -var jsx_runtime_1 = require("react/jsx-runtime"); -var react_1 = require("react"); -var antd_1 = require("antd"); -var icons_1 = require("@ant-design/icons"); -var query_1 = tslib_1.__importDefault(require("../query")); -var utils_1 = require("../query/utils"); -var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); -var DEFAULT_COLUMN_MAP = { - xxl: 4, - xl: 4, - lg: 4, - md: 3, - sm: 2, - xs: 1, -}; -function transformColumns(columns) { - return columns.map(function (column, index) { - var _filterName = (0, utils_1.getFilterName)(column); - return tslib_1.__assign(tslib_1.__assign({}, column), { filterName: _filterName }); - }); -} -function getColumn(column, width) { - if (typeof column === 'number') { - return column; - } - if (typeof column === 'object') { - if (column[width] !== undefined) { - return column[width] || DEFAULT_COLUMN_MAP[width]; - } - } - return 3; -} -function getSpan(colSpan, column) { - return colSpan > column ? column : colSpan; -} -function Render(props) { - var _a = props.data, onSearch = _a.onSearch, columns = _a.columns, _b = _a.column, column = _b === void 0 ? DEFAULT_COLUMN_MAP : _b, width = _a.width, entity = _a.entity, oakFullpath = _a.oakFullpath; - var _c = props.methods, t = _c.t, refresh = _c.refresh, getNamedFilters = _c.getNamedFilters, removeNamedFilterByName = _c.removeNamedFilterByName; - var _d = tslib_1.__read((0, react_1.useState)(false), 2), open = _d[0], setOpen = _d[1]; - if (!columns || columns.length === 0) { - return null; - } - var tfColumns = transformColumns(columns); - var mergedColumn = getColumn(column, width); // 一行放几个 - var gridColumn = Math.ceil(24 / mergedColumn); // 24格 计算一个所需几格 - var totalColSpan = tfColumns.reduce(function (prev, cur, index, arr) { - return getSpan(cur.colSpan || 1, mergedColumn) + prev; - }, 0); //总共多少份 - var rows = Math.ceil(totalColSpan / mergedColumn); - var showExpandButton = totalColSpan > mergedColumn - 1; //需要显示展开按钮 - var filters = getNamedFilters() || []; - var filterNames = tfColumns.map(function (ele) { return ele.filterName; }); - var filters2 = filters === null || filters === void 0 ? void 0 : filters.filter(function (ele) { - return filterNames.includes(ele['#name']); - }); - var count = (filters2 === null || filters2 === void 0 ? void 0 : filters2.length) || 0; //查询条件个数 - var items = []; - var rowSum = 0; - var rowSum2 = 0; - var rows2 = 1; - var firstItem; - var _gridColumn = gridColumn; - tfColumns.forEach(function (column, index) { - var colSpan = column.colSpan; - var colSpan2 = getSpan(colSpan || 1, mergedColumn); - var item = ((0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: gridColumn * colSpan2 }, { children: (0, jsx_runtime_1.jsx)(query_1.default, { column: column, entity: entity, oakPath: oakFullpath }) }))); - if (index === 0) { - firstItem = item; - } - if (!open) { - if (width !== 'xs') { - rowSum += colSpan2; - if (mergedColumn === 1) { - //一行一个 - items.push(item); - } - else if (rowSum <= mergedColumn - 1) { - items.push(item); - rowSum2 = rowSum; - if (totalColSpan === mergedColumn - 1) { - _gridColumn = gridColumn * 1; - } - else if (totalColSpan < mergedColumn) { - _gridColumn = gridColumn * (mergedColumn - rowSum2); - } - } - else { - _gridColumn = gridColumn * (mergedColumn - rowSum2); - } - } - } - else { - items.push(item); - if (rowSum + colSpan2 > rows2 * mergedColumn && - rowSum < rows2 * mergedColumn) { - rowSum += rows2 * mergedColumn - rowSum; - rowSum += colSpan2; - rows2 += 1; - } - else if (rowSum + colSpan2 === rows2 * mergedColumn) { - rowSum += colSpan2; - rows2 += 1; - } - else { - rowSum += colSpan2; - } - } - }); - if (open) { - _gridColumn = 24; - if (rowSum >= mergedColumn) { - var other = rows * mergedColumn - rowSum; - if (other > 0) { - _gridColumn = gridColumn * other; - } - } - else { - _gridColumn = gridColumn * (mergedColumn - rowSum); - } - } - else { - if (width === 'xs') { - items.push(firstItem); - } - } - items.push((0, jsx_runtime_1.jsx)(antd_1.Col, tslib_1.__assign({ span: _gridColumn }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ size: 16, className: web_module_less_1.default.actionBox }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Badge, tslib_1.__assign({ count: count }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "default", onClick: function () { - filterNames.forEach(function (ele) { - return removeNamedFilterByName(ele); - }); - refresh(); - } }, { children: t('common:reset') })) })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { - if (typeof onSearch === 'function') { - onSearch(); - return; - } - refresh(); - } }, { children: t('common:select') })), showExpandButton && ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () { - setOpen(!open); - } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [open ? t('common:shrink') : t('common:expand'), open ? (0, jsx_runtime_1.jsx)(icons_1.UpOutlined, {}) : (0, jsx_runtime_1.jsx)(icons_1.DownOutlined, {})] }) })))] })) }) }))); - return ((0, jsx_runtime_1.jsx)(antd_1.Form, { children: (0, jsx_runtime_1.jsx)(antd_1.Row, tslib_1.__assign({ gutter: [16, 16] }, { children: items })) })); -} -exports.default = Render; diff --git a/lib/components/refAttr/index.d.ts b/lib/components/refAttr/index.d.ts index 1fd1500a..69b6bae7 100644 --- a/lib/components/refAttr/index.d.ts +++ b/lib/components/refAttr/index.d.ts @@ -3,7 +3,7 @@ declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; export default _default; diff --git a/lib/components/refAttr/index.js b/lib/components/refAttr/index.js index df848bb2..b2498f57 100644 --- a/lib/components/refAttr/index.js +++ b/lib/components/refAttr/index.js @@ -11,12 +11,12 @@ exports.default = OakComponent({ multiple: Boolean, entityId: String, entityIds: Array, - pickerDef: Object, + pickerRender: Object, onChange: Function, }, formData: function () { - var _a = this.props, multiple = _a.multiple, entityIds = _a.entityIds, entityId = _a.entityId, pickerDef = _a.pickerDef; - var _b = pickerDef, entity = _b.entity, projection = _b.projection, title = _b.title; + var _a = this.props, multiple = _a.multiple, entityIds = _a.entityIds, entityId = _a.entityId, pickerRender = _a.pickerRender; + var _b = pickerRender, entity = _b.entity, projection = _b.projection, title = _b.title; if (multiple) { var rows = entityIds && this.features.cache.get(entity, { data: typeof projection === 'function' ? projection() : projection, @@ -66,12 +66,12 @@ exports.default = OakComponent({ methods: { refreshData: function () { return tslib_1.__awaiter(this, void 0, void 0, function () { - var _a, pickerDef, multiple, _b, mode, entity, projection, filter, count, title, proj, filter2, data, data2; + var _a, pickerRender, multiple, _b, mode, entity, projection, filter, count, title, proj, filter2, data, data2; return tslib_1.__generator(this, function (_c) { switch (_c.label) { case 0: - _a = this.props, pickerDef = _a.pickerDef, multiple = _a.multiple; - _b = pickerDef, mode = _b.mode, entity = _b.entity, projection = _b.projection, filter = _b.filter, count = _b.count, title = _b.title; + _a = this.props, pickerRender = _a.pickerRender, multiple = _a.multiple; + _b = pickerRender, mode = _b.mode, entity = _b.entity, projection = _b.projection, filter = _b.filter, count = _b.count, title = _b.title; if (mode === 'radio') { // radio的要先取数据出来 (0, assert_1.default)(typeof count === 'number' && count <= 5, 'radio类型的外键选择,总数必须小于5'); diff --git a/lib/components/refAttr/web.pc.d.ts b/lib/components/refAttr/web.pc.d.ts index 671dd485..4792d43e 100644 --- a/lib/components/refAttr/web.pc.d.ts +++ b/lib/components/refAttr/web.pc.d.ts @@ -13,7 +13,7 @@ export default function render(props: WebComponentProps; + pickerRender: OakAbsRefAttrPickerRender; onChange: (value: any) => void; }>): JSX.Element; export {}; diff --git a/lib/components/refAttr/web.pc.js b/lib/components/refAttr/web.pc.js index 3587fb2e..c3dc25ee 100644 --- a/lib/components/refAttr/web.pc.js +++ b/lib/components/refAttr/web.pc.js @@ -6,9 +6,9 @@ var react_1 = require("react"); var antd_1 = require("antd"); var picker_1 = tslib_1.__importDefault(require("../picker")); function render(props) { - var _a = props.data, pickerDef = _a.pickerDef, renderValue = _a.renderValue, data = _a.data, multiple = _a.multiple, onChange = _a.onChange, entityId = _a.entityId, entityIds = _a.entityIds; + var _a = props.data, pickerRender = _a.pickerRender, renderValue = _a.renderValue, data = _a.data, multiple = _a.multiple, onChange = _a.onChange, entityId = _a.entityId, entityIds = _a.entityIds; var t = props.methods.t; - var mode = pickerDef.mode; + var mode = pickerRender.mode; var _b = tslib_1.__read((0, react_1.useState)(false), 2), visibile = _b[0], setVisible = _b[1]; if (!data && mode !== 'list') { return (0, jsx_runtime_1.jsx)("div", { children: " loading... " }); @@ -16,10 +16,10 @@ function render(props) { else { switch (mode) { case 'select': { - return ((0, jsx_runtime_1.jsx)(antd_1.Select, { value: entityId, onChange: onChange, style: { width: '50%' }, options: data.map(function (ele) { return ({ + return ((0, jsx_runtime_1.jsx)(antd_1.Select, { value: entityId, onChange: onChange, options: data.map(function (ele) { return ({ value: ele.id, label: ele.title, - }); }), allowClear: true })); + }); }), allowClear: !pickerRender.required })); } case 'radio': { if (multiple) { @@ -37,16 +37,16 @@ function render(props) { }); }) })); } case 'list': { - var entity = pickerDef.entity, projection = pickerDef.projection, title = pickerDef.title, titleLabel = pickerDef.titleLabel, filter = pickerDef.filter, sorter = pickerDef.sorter; + var entity = pickerRender.entity, projection = pickerRender.projection, title = pickerRender.title, titleLabel = pickerRender.titleLabel, filter = pickerRender.filter, sorter = pickerRender.sorter, required = pickerRender.required; var p = typeof projection === 'function' ? projection() : projection; var f = typeof filter === 'function' ? filter() : filter; var s = typeof sorter === 'function' ? sorter() : sorter; - return ((0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Input, { value: renderValue, allowClear: true, onClick: function () { return setVisible(true); }, onChange: function (_a) { + return ((0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Input, { value: renderValue, allowClear: !required, onClick: function () { return setVisible(true); }, onChange: function (_a) { var currentTarget = _a.currentTarget; if (!currentTarget.value) { onChange(undefined); } - } }), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: "\u9009\u62E9".concat(t("".concat(pickerDef.entity, ":name"))), open: visibile, closable: true, onCancel: function () { return setVisible(false); }, destroyOnClose: true, footer: null }, { children: (0, jsx_runtime_1.jsx)(picker_1.default, { oakPath: "$refAttr-picker-".concat(entity), entity: entity, title: title, titleLabel: titleLabel, oakProjection: p, oakFilters: f ? [f] : undefined, oakSorters: s, onSelect: function (_a) { + } }), (0, jsx_runtime_1.jsx)(antd_1.Modal, tslib_1.__assign({ title: "\u9009\u62E9".concat(t("".concat(pickerRender.entity, ":name"))), open: visibile, closable: true, onCancel: function () { return setVisible(false); }, destroyOnClose: true, footer: null }, { children: (0, jsx_runtime_1.jsx)(picker_1.default, { oakPath: "$refAttr-picker-".concat(entity), entity: entity, title: title, titleLabel: titleLabel, oakProjection: p, oakFilters: f ? [f] : undefined, oakSorters: s, onSelect: function (_a) { var _b = tslib_1.__read(_a, 1), id = _b[0].id; onChange(id); setVisible(false); diff --git a/lib/components/upsert/web.pc.js b/lib/components/upsert/web.pc.js index 3384c1ce..d26df7eb 100644 --- a/lib/components/upsert/web.pc.js +++ b/lib/components/upsert/web.pc.js @@ -95,7 +95,7 @@ function makeAttrInput(attrRender, onValueChange) { }) }))); } case 'ref': { - return ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: false, entityId: value, pickerDef: attrRender, onChange: function (value) { onValueChange(value); } })); + return ((0, jsx_runtime_1.jsx)(refAttr_1.default, { multiple: false, entityId: value, pickerRender: attrRender, onChange: function (value) { onValueChange(value); } })); } default: { throw new Error("\u3010Abstract Update\u3011\u65E0\u6CD5\u652F\u6301\u7684\u6570\u636E\u7C7B\u522B".concat(type, "\u7684\u6E32\u67D3")); @@ -107,7 +107,7 @@ function render(props) { var update = props.methods.update; return ((0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ labelCol: { span: 4 }, layout: "horizontal", style: { margin: '0px auto', - maxWidth: 675, + maxWidth: '100%', } }, { children: [renderData.map(function (ele) { return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: ele.label, rules: [ { required: ele.required, diff --git a/lib/miniprogram_npm/ec-canvas/ec-canvas.json b/lib/miniprogram_npm/ec-canvas/ec-canvas.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/ec-canvas/ec-canvas.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/action-sheet/index.json b/lib/miniprogram_npm/lin-ui/action-sheet/index.json deleted file mode 100644 index 248ca904..00000000 --- a/lib/miniprogram_npm/lin-ui/action-sheet/index.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index", - "l-popup":"../popup/index", - "l-button":"../button/index" - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/album/index.json b/lib/miniprogram_npm/lin-ui/album/index.json deleted file mode 100644 index 78013bde..00000000 --- a/lib/miniprogram_npm/lin-ui/album/index.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "component": true, - "usingComponents": { - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/arc-popup/index.json b/lib/miniprogram_npm/lin-ui/arc-popup/index.json deleted file mode 100644 index e72f4f50..00000000 --- a/lib/miniprogram_npm/lin-ui/arc-popup/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-popup": "../popup/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/avatar/index.json b/lib/miniprogram_npm/lin-ui/avatar/index.json deleted file mode 100644 index dd10af0a..00000000 --- a/lib/miniprogram_npm/lin-ui/avatar/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/badge/index.json b/lib/miniprogram_npm/lin-ui/badge/index.json deleted file mode 100644 index e56592f8..00000000 --- a/lib/miniprogram_npm/lin-ui/badge/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/button/index.json b/lib/miniprogram_npm/lin-ui/button/index.json deleted file mode 100644 index c01e2d7e..00000000 --- a/lib/miniprogram_npm/lin-ui/button/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/calendar/components/day/index.json b/lib/miniprogram_npm/lin-ui/calendar/components/day/index.json deleted file mode 100644 index 32640e0d..00000000 --- a/lib/miniprogram_npm/lin-ui/calendar/components/day/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/calendar/components/header/index.json b/lib/miniprogram_npm/lin-ui/calendar/components/header/index.json deleted file mode 100644 index 32640e0d..00000000 --- a/lib/miniprogram_npm/lin-ui/calendar/components/header/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/calendar/components/mounth/index.json b/lib/miniprogram_npm/lin-ui/calendar/components/mounth/index.json deleted file mode 100644 index d03ef78a..00000000 --- a/lib/miniprogram_npm/lin-ui/calendar/components/mounth/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "day":"../day/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/calendar/index.json b/lib/miniprogram_npm/lin-ui/calendar/index.json deleted file mode 100644 index e97f93a5..00000000 --- a/lib/miniprogram_npm/lin-ui/calendar/index.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "component": true, - "usingComponents": { - "header":"./components/header/index", - "mounth":"./components/mounth/index", - "l-toast": "../toast/index", - "l-popup": "../popup/index", - "l-button": "../button/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/capsule-bar/index.json b/lib/miniprogram_npm/lin-ui/capsule-bar/index.json deleted file mode 100644 index 467ce294..00000000 --- a/lib/miniprogram_npm/lin-ui/capsule-bar/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} diff --git a/lib/miniprogram_npm/lin-ui/card/index.json b/lib/miniprogram_npm/lin-ui/card/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/card/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/checkbox-group/index.json b/lib/miniprogram_npm/lin-ui/checkbox-group/index.json deleted file mode 100644 index 742ff990..00000000 --- a/lib/miniprogram_npm/lin-ui/checkbox-group/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-error-tip":"../error-tip/index", - "l-checkbox": "../checkbox/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/checkbox/index.json b/lib/miniprogram_npm/lin-ui/checkbox/index.json deleted file mode 100644 index f6ca6c10..00000000 --- a/lib/miniprogram_npm/lin-ui/checkbox/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-button": "../button/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/circle/index.json b/lib/miniprogram_npm/lin-ui/circle/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/circle/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/collapse-item/index.json b/lib/miniprogram_npm/lin-ui/collapse-item/index.json deleted file mode 100644 index 86f9e3c9..00000000 --- a/lib/miniprogram_npm/lin-ui/collapse-item/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-list": "../list/index", - "l-icon": "../icon/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/collapse/index.json b/lib/miniprogram_npm/lin-ui/collapse/index.json deleted file mode 100644 index ac34bd70..00000000 --- a/lib/miniprogram_npm/lin-ui/collapse/index.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "component": true, - "usingComponents": { - } -} diff --git a/lib/miniprogram_npm/lin-ui/combined-tabs/index.json b/lib/miniprogram_npm/lin-ui/combined-tabs/index.json deleted file mode 100644 index 398bd031..00000000 --- a/lib/miniprogram_npm/lin-ui/combined-tabs/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index", - "l-badge":"../badge/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/countdown/index.json b/lib/miniprogram_npm/lin-ui/countdown/index.json deleted file mode 100644 index a32a1284..00000000 --- a/lib/miniprogram_npm/lin-ui/countdown/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/counter/index.json b/lib/miniprogram_npm/lin-ui/counter/index.json deleted file mode 100644 index c01e2d7e..00000000 --- a/lib/miniprogram_npm/lin-ui/counter/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/custom-tab-bar/index.json b/lib/miniprogram_npm/lin-ui/custom-tab-bar/index.json deleted file mode 100644 index 32640e0d..00000000 --- a/lib/miniprogram_npm/lin-ui/custom-tab-bar/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/dialog/index.json b/lib/miniprogram_npm/lin-ui/dialog/index.json deleted file mode 100644 index e72f4f50..00000000 --- a/lib/miniprogram_npm/lin-ui/dialog/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-popup": "../popup/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/error-tip/index.json b/lib/miniprogram_npm/lin-ui/error-tip/index.json deleted file mode 100644 index a1d9113f..00000000 --- a/lib/miniprogram_npm/lin-ui/error-tip/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/form-item/index.json b/lib/miniprogram_npm/lin-ui/form-item/index.json deleted file mode 100644 index cc6ba8d7..00000000 --- a/lib/miniprogram_npm/lin-ui/form-item/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-error-tip":"../error-tip/index" - } - } diff --git a/lib/miniprogram_npm/lin-ui/form/index.json b/lib/miniprogram_npm/lin-ui/form/index.json deleted file mode 100644 index a1d9113f..00000000 --- a/lib/miniprogram_npm/lin-ui/form/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/grid-item/index.json b/lib/miniprogram_npm/lin-ui/grid-item/index.json deleted file mode 100644 index 7a47d16b..00000000 --- a/lib/miniprogram_npm/lin-ui/grid-item/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/grid/index.json b/lib/miniprogram_npm/lin-ui/grid/index.json deleted file mode 100644 index 93860eac..00000000 --- a/lib/miniprogram_npm/lin-ui/grid/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-grid-item":"../grid-item/index" - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/icon/index.json b/lib/miniprogram_npm/lin-ui/icon/index.json deleted file mode 100644 index 8bc8f183..00000000 --- a/lib/miniprogram_npm/lin-ui/icon/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/image-clipper-tools/index.json b/lib/miniprogram_npm/lin-ui/image-clipper-tools/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/image-clipper-tools/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/image-clipper/index.json b/lib/miniprogram_npm/lin-ui/image-clipper/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/image-clipper/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/image-picker/index.json b/lib/miniprogram_npm/lin-ui/image-picker/index.json deleted file mode 100644 index 4bc15bca..00000000 --- a/lib/miniprogram_npm/lin-ui/image-picker/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "styleIsolation": "apply-shared", - "usingComponents": { - "l-icon": "../icon/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/index-anchor/index.json b/lib/miniprogram_npm/lin-ui/index-anchor/index.json deleted file mode 100644 index aa80c042..00000000 --- a/lib/miniprogram_npm/lin-ui/index-anchor/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-index-list": "../index-list/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/index-list/index.json b/lib/miniprogram_npm/lin-ui/index-list/index.json deleted file mode 100644 index a89ef4db..00000000 --- a/lib/miniprogram_npm/lin-ui/index-list/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} diff --git a/lib/miniprogram_npm/lin-ui/input/index.json b/lib/miniprogram_npm/lin-ui/input/index.json deleted file mode 100644 index fe1a1ffd..00000000 --- a/lib/miniprogram_npm/lin-ui/input/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-error-tip":"../error-tip/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/list/index.json b/lib/miniprogram_npm/lin-ui/list/index.json deleted file mode 100644 index 0e3378f0..00000000 --- a/lib/miniprogram_npm/lin-ui/list/index.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-badge": "../badge/index", - "l-tag": "../tag/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/loading/index.json b/lib/miniprogram_npm/lin-ui/loading/index.json deleted file mode 100644 index 4a42478b..00000000 --- a/lib/miniprogram_npm/lin-ui/loading/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/loadmore/index.json b/lib/miniprogram_npm/lin-ui/loadmore/index.json deleted file mode 100644 index 270874fc..00000000 --- a/lib/miniprogram_npm/lin-ui/loadmore/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-loading":"../loading/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/mask/index.json b/lib/miniprogram_npm/lin-ui/mask/index.json deleted file mode 100644 index 4a42478b..00000000 --- a/lib/miniprogram_npm/lin-ui/mask/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/message/index.json b/lib/miniprogram_npm/lin-ui/message/index.json deleted file mode 100644 index c01e2d7e..00000000 --- a/lib/miniprogram_npm/lin-ui/message/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/notice-bar/index.json b/lib/miniprogram_npm/lin-ui/notice-bar/index.json deleted file mode 100644 index b5e3f566..00000000 --- a/lib/miniprogram_npm/lin-ui/notice-bar/index.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": true, - "usingComponents": - { - "l-icon": "../icon/index" - } -} - diff --git a/lib/miniprogram_npm/lin-ui/picker/index.json b/lib/miniprogram_npm/lin-ui/picker/index.json deleted file mode 100644 index 906a2ae8..00000000 --- a/lib/miniprogram_npm/lin-ui/picker/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-error-tip": "../error-tip/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/popup/index.json b/lib/miniprogram_npm/lin-ui/popup/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/popup/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/price/index.json b/lib/miniprogram_npm/lin-ui/price/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/price/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/progress/index.json b/lib/miniprogram_npm/lin-ui/progress/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/progress/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/radio-group/index.json b/lib/miniprogram_npm/lin-ui/radio-group/index.json deleted file mode 100644 index 9b5b1c53..00000000 --- a/lib/miniprogram_npm/lin-ui/radio-group/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-error-tip": "../error-tip/index", - "l-radio":"../radio/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/radio/index.json b/lib/miniprogram_npm/lin-ui/radio/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/radio/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/rate/index.json b/lib/miniprogram_npm/lin-ui/rate/index.json deleted file mode 100644 index dd10af0a..00000000 --- a/lib/miniprogram_npm/lin-ui/rate/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/search-bar/index.json b/lib/miniprogram_npm/lin-ui/search-bar/index.json deleted file mode 100644 index ccccaa95..00000000 --- a/lib/miniprogram_npm/lin-ui/search-bar/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-input": "../input/index", - "l-icon": "../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/segment-item/index.json b/lib/miniprogram_npm/lin-ui/segment-item/index.json deleted file mode 100644 index 62389a94..00000000 --- a/lib/miniprogram_npm/lin-ui/segment-item/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} - } \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/segment/index.json b/lib/miniprogram_npm/lin-ui/segment/index.json deleted file mode 100644 index 503bf6fa..00000000 --- a/lib/miniprogram_npm/lin-ui/segment/index.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-badge": "../badge/index", - "l-segment-item":"../segment-item/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/skeleton/index.json b/lib/miniprogram_npm/lin-ui/skeleton/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/skeleton/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/slide-view/index.json b/lib/miniprogram_npm/lin-ui/slide-view/index.json deleted file mode 100644 index 78013bde..00000000 --- a/lib/miniprogram_npm/lin-ui/slide-view/index.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "component": true, - "usingComponents": { - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/spin/index.json b/lib/miniprogram_npm/lin-ui/spin/index.json deleted file mode 100644 index 4a42478b..00000000 --- a/lib/miniprogram_npm/lin-ui/spin/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/status-show/index.json b/lib/miniprogram_npm/lin-ui/status-show/index.json deleted file mode 100644 index 6a37aa32..00000000 --- a/lib/miniprogram_npm/lin-ui/status-show/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-button":"../button/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/step/index.json b/lib/miniprogram_npm/lin-ui/step/index.json deleted file mode 100644 index c01e2d7e..00000000 --- a/lib/miniprogram_npm/lin-ui/step/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/steps/index.json b/lib/miniprogram_npm/lin-ui/steps/index.json deleted file mode 100644 index 5939ac86..00000000 --- a/lib/miniprogram_npm/lin-ui/steps/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index", - "l-step":"../step/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/sticky-item/index.json b/lib/miniprogram_npm/lin-ui/sticky-item/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/sticky-item/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/sticky/index.json b/lib/miniprogram_npm/lin-ui/sticky/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/sticky/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/switch/index.json b/lib/miniprogram_npm/lin-ui/switch/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/switch/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/tab-bar/index.json b/lib/miniprogram_npm/lin-ui/tab-bar/index.json deleted file mode 100644 index 0535339f..00000000 --- a/lib/miniprogram_npm/lin-ui/tab-bar/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "styleIsolation": "apply-shared", - "usingComponents": { - "l-badge":"../badge/index" - } -} diff --git a/lib/miniprogram_npm/lin-ui/tabpanel/index.json b/lib/miniprogram_npm/lin-ui/tabpanel/index.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/lin-ui/tabpanel/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/tabs/index.json b/lib/miniprogram_npm/lin-ui/tabs/index.json deleted file mode 100644 index f4d7f749..00000000 --- a/lib/miniprogram_npm/lin-ui/tabs/index.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index", - "l-badge":"../badge/index", - "l-tabpanel":"../tabpanel/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/tag/index.json b/lib/miniprogram_npm/lin-ui/tag/index.json deleted file mode 100644 index c01e2d7e..00000000 --- a/lib/miniprogram_npm/lin-ui/tag/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/textarea/index.json b/lib/miniprogram_npm/lin-ui/textarea/index.json deleted file mode 100644 index fe1a1ffd..00000000 --- a/lib/miniprogram_npm/lin-ui/textarea/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-error-tip":"../error-tip/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/toast/index.json b/lib/miniprogram_npm/lin-ui/toast/index.json deleted file mode 100644 index 3eb288e6..00000000 --- a/lib/miniprogram_npm/lin-ui/toast/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-mask": "../mask/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/transition/index.json b/lib/miniprogram_npm/lin-ui/transition/index.json deleted file mode 100644 index 3eb288e6..00000000 --- a/lib/miniprogram_npm/lin-ui/transition/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon": "../icon/index", - "l-mask": "../mask/index" - } -} \ No newline at end of file diff --git a/lib/miniprogram_npm/lin-ui/water-flow/index.json b/lib/miniprogram_npm/lin-ui/water-flow/index.json deleted file mode 100644 index 5e96f356..00000000 --- a/lib/miniprogram_npm/lin-ui/water-flow/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": {}, - "componentGenerics": { - "l-water-flow-item": true - } - } \ No newline at end of file diff --git a/lib/miniprogram_npm/popover/popover-item.json b/lib/miniprogram_npm/popover/popover-item.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/popover/popover-item.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/miniprogram_npm/popover/popover.json b/lib/miniprogram_npm/popover/popover.json deleted file mode 100644 index e8cfaaf8..00000000 --- a/lib/miniprogram_npm/popover/popover.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/lib/types/Filter.d.ts b/lib/types/Filter.d.ts index be84425c..9d597956 100644 --- a/lib/types/Filter.d.ts +++ b/lib/types/Filter.d.ts @@ -1,7 +1,7 @@ import { Dayjs } from 'dayjs'; import { EntityDict } from 'oak-domain/lib/types/Entity'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; -import { OakAbsRefAttrPickerDef } from './AbstractComponent'; +import { OakAbsRefAttrPickerRender } from './AbstractComponent'; export declare type Ops = '$gt' | '$lt' | '$gte' | '$lte' | '$eq' | '$ne' | '$startsWith' | '$endsWith' | '$includes' | '$in' | '$nin' | '$between' | '$text' | '$search'; export declare type ColSpanType = 1 | 2 | 3 | 4; export declare type ValueType = string | boolean | number | Array | Dayjs; @@ -22,7 +22,7 @@ export declare type ColumnProps, 'label'>; + refProps?: Omit, 'label'>; transformFilter?: (column: ColumnProps, value: ValueType) => ED[T]['Selection']['filter']; transformValue?: (column: ColumnProps, filter: ED[T]['Selection']['filter']) => any; filterName?: string; diff --git a/lib/utils/locate.d.ts b/lib/utils/locate.d.ts new file mode 100644 index 00000000..5516124d --- /dev/null +++ b/lib/utils/locate.d.ts @@ -0,0 +1,4 @@ +export declare function locate(): Promise<{ + latitude: number; + longitude: number; +}>; diff --git a/lib/utils/locate.js b/lib/utils/locate.js new file mode 100644 index 00000000..d6117159 --- /dev/null +++ b/lib/utils/locate.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.locate = void 0; +var tslib_1 = require("tslib"); +var utils_1 = require("./utils"); +function locateWechat() { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + return [2 /*return*/, wx.getLocation({})]; + }); + }); +} +function locateWeb() { + return tslib_1.__awaiter(this, void 0, void 0, function () { + return tslib_1.__generator(this, function (_a) { + if ('geolocation' in navigator) { + return [2 /*return*/, new Promise(function (resolve, reject) { + navigator.geolocation.getCurrentPosition(function (position) { + console.log(position); + resolve(position.coords); + }, function (err) { + console.error(err); + reject(err); + }); + })]; + } + else { + throw new Error('浏览器不支持定位'); + } + return [2 /*return*/]; + }); + }); +} +function locate() { + return tslib_1.__awaiter(this, void 0, void 0, function () { + var result, err_1, result2, result2; + return tslib_1.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!utils_1.isWeiXin) return [3 /*break*/, 6]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 5]); + return [4 /*yield*/, locateWechat()]; + case 2: + result = _a.sent(); + return [2 /*return*/, result]; + case 3: + err_1 = _a.sent(); + console.warn(err_1); + return [4 /*yield*/, locateWeb()]; + case 4: + result2 = _a.sent(); + return [2 /*return*/, result2]; + case 5: return [3 /*break*/, 8]; + case 6: return [4 /*yield*/, locateWeb()]; + case 7: + result2 = _a.sent(); + return [2 /*return*/, result2]; + case 8: return [2 /*return*/]; + } + }); + }); +} +exports.locate = locate; diff --git a/package.json b/package.json index d1a81499..fdc7b9b8 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "oak-common-aspect": "file:../oak-common-aspect", "oak-domain": "file:../oak-domain", "oak-memory-tree-store": "file:../oak-memory-tree-store", + "ol": "^7.3.0", "react-scripts": "^5.0.1", "rmc-pull-to-refresh": "^1.0.13", "url": "^0.11.0", diff --git a/src/components/filter/web.tsx b/src/components/filter/web.tsx index 3aabfb92..f363593f 100644 --- a/src/components/filter/web.tsx +++ b/src/components/filter/web.tsx @@ -474,7 +474,7 @@ export default function Render( } + pickerRender={column.refProps} onChange={(ids: string[]) => { console.log(ids, '这里等测试到了再写(Xc)') }} /> ); @@ -484,7 +484,7 @@ export default function Render( } + pickerRender={column.refProps} onChange={(id: string) => { console.log(id, '这里等测试到了再写(Xc)') }} /> ); diff --git a/src/components/map/location/index.tsx b/src/components/map/location/index.tsx new file mode 100644 index 00000000..613e1b4c --- /dev/null +++ b/src/components/map/location/index.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { + Modal, + Row, + Col, + ModalProps, + Button, + Input, + List, + Empty, + Spin, +} from 'antd'; +import Map from '../map'; + +type LocationProps = { + poiName?: string; + coordinate?: [number, number]; + areaId?: string; +}; + +export default function Location(props: LocationProps) { + if (window.innerWidth < 500) { + // 窄屏 + + } + + return ( + + + + + + ); +} \ No newline at end of file diff --git a/src/components/map/location/web.module.less b/src/components/map/location/web.module.less new file mode 100644 index 00000000..e69de29b diff --git a/src/components/map/map/index.tsx b/src/components/map/map/index.tsx new file mode 100644 index 00000000..8d322a46 --- /dev/null +++ b/src/components/map/map/index.tsx @@ -0,0 +1,85 @@ +import React, { useEffect } from 'react'; +import OlMap from 'ol/Map'; +import XYZ from 'ol/source/XYZ'; +import TileLayer from 'ol/layer/Tile'; + +import View from 'ol/View'; +import { fromLonLat } from 'ol/proj'; +import DragPan from 'ol/interaction/DragPan'; +import 'ol/ol.css'; +import Styles from './web.module.less'; +import { locate } from '../../../utils/locate'; + +const prefix = Math.ceil(Math.random() * 1000); + +type MapProps = { + center?: [number, number], + zoom?: number; + unzoomable?: boolean; + undragable?: boolean; + style?: object; + autoLocate?: boolean; + markers?: Array<[number, number]>; +} + +const DEFAULT_CENTER = [120.123, 30.259]; // 浙大玉泉 +const DEFAULT_ZOOM = 15; + +export default function Map(props: MapProps) { + let map: OlMap; + useEffect(() => { + map = new OlMap({ + target: `map-${prefix}`, + layers: [ + new TileLayer({ + source: new XYZ({ + url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}', + wrapX: false, + }), + }), + ], + view: new View({ + center: fromLonLat(props.center || DEFAULT_CENTER), + zoom: props.zoom || DEFAULT_ZOOM, + minZoom: props.unzoomable ? props.zoom : undefined, + maxZoom: props.unzoomable ? props.zoom : undefined, + }), + controls: props.unzoomable ? [] : undefined, + }); + + if (props.undragable) { + map.getInteractions().forEach( + (ele) => { + if (ele instanceof DragPan) { + ele.setActive(false); + } + } + ); + } + if (props.autoLocate) { + locate().then( + ({ latitude, longitude }) => { + map.getView().setCenter(fromLonLat([longitude, latitude])); + } + ); + } + }, []); + + useEffect(() => { + if (props.center) { + map && map.getView().setCenter(fromLonLat(props.center)) + } + }, [props.center]); + + useEffect(() => { + if (props.markers) { + let markerLayer = map.getLayers().get('markerLayer'); + if (!markerLayer) { + // todo + } + } + }, [props.markers]); + + return
; +}; + diff --git a/src/components/map/map/web.module.less b/src/components/map/map/web.module.less new file mode 100644 index 00000000..0326bef2 --- /dev/null +++ b/src/components/map/map/web.module.less @@ -0,0 +1,3 @@ +.map { + height: 400px; +} diff --git a/src/components/refAttr/index.ts b/src/components/refAttr/index.ts index 0eb027bb..cf863c47 100644 --- a/src/components/refAttr/index.ts +++ b/src/components/refAttr/index.ts @@ -11,12 +11,12 @@ export default OakComponent({ multiple: Boolean, entityId: String, entityIds: Array, - pickerDef: Object, // OakAbsRefAttrPickerRender + pickerRender: Object, // OakAbsRefAttrPickerRender onChange: Function, }, formData() { - const { multiple, entityIds, entityId, pickerDef } = this.props; - const { entity, projection, title } = pickerDef as OakAbsRefAttrPickerRender; + const { multiple, entityIds, entityId, pickerRender } = this.props; + const { entity, projection, title } = pickerRender as OakAbsRefAttrPickerRender; if (multiple) { const rows = entityIds && this.features.cache.get(entity, { data: typeof projection === 'function' ? projection() : projection, @@ -63,8 +63,8 @@ export default OakComponent({ }, methods: { async refreshData() { - const { pickerDef, multiple } = this.props; - const { mode, entity, projection, filter, count, title } = pickerDef as OakAbsRefAttrPickerDef; + const { pickerRender, multiple } = this.props; + const { mode, entity, projection, filter, count, title } = pickerRender as OakAbsRefAttrPickerDef; if (mode === 'radio') { // radio的要先取数据出来 assert(typeof count === 'number' && count <= 5, 'radio类型的外键选择,总数必须小于5'); diff --git a/src/components/refAttr/web.pc.tsx b/src/components/refAttr/web.pc.tsx index f945ab20..3de27618 100644 --- a/src/components/refAttr/web.pc.tsx +++ b/src/components/refAttr/web.pc.tsx @@ -15,8 +15,7 @@ import { Tag, Switch, } from 'antd'; -import { CheckOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons'; -import { OakAbsRefAttrPickerDef, OakAbsRefAttrPickerRender, OakNativeAttrUpsertRender } from '../../types/AbstractComponent'; +import { OakAbsRefAttrPickerRender } from '../../types/AbstractComponent'; import { WebComponentProps } from '../../types/Page'; import Picker from '../picker'; @@ -33,13 +32,13 @@ export default function render(props: WebComponentProps< multiple: boolean; renderValue: string; data?: { id: string, title: string }[]; - pickerDef: OakAbsRefAttrPickerRender; + pickerRender: OakAbsRefAttrPickerRender; onChange: (value: any) => void; } >) { - const { pickerDef, renderValue, data, multiple, onChange, entityId, entityIds } = props.data; + const { pickerRender, renderValue, data, multiple, onChange, entityId, entityIds } = props.data; const { t } = props.methods; - const { mode } = pickerDef; + const { mode } = pickerRender; const [visibile, setVisible] = useState(false); if (!data && mode !== 'list') { @@ -52,14 +51,13 @@ export default function render(props: WebComponentProps< ); } @@ -93,7 +91,7 @@ export default function render(props: WebComponentProps< ); } case 'list': { - const { entity, projection, title, titleLabel, filter, sorter } = pickerDef; + const { entity, projection, title, titleLabel, filter, sorter, required } = pickerRender; const p = typeof projection === 'function' ? projection() : projection; const f = typeof filter === 'function' ? filter() : filter; const s = typeof sorter === 'function' ? sorter() : sorter; @@ -101,7 +99,7 @@ export default function render(props: WebComponentProps< setVisible(true)} onChange={({ currentTarget }) => { if (!currentTarget.value) { @@ -110,7 +108,7 @@ export default function render(props: WebComponentProps< }} /> setVisible(false)} diff --git a/src/components/upsert/web.pc.tsx b/src/components/upsert/web.pc.tsx index 6878791b..2fff06ed 100644 --- a/src/components/upsert/web.pc.tsx +++ b/src/components/upsert/web.pc.tsx @@ -190,7 +190,7 @@ function makeAttrInput(attrRender: AttrUpsertRender, onValueChange: (value: } + pickerRender={attrRender as OakAbsRefAttrPickerRender} onChange={(value: string) => {onValueChange(value)}} /> ); @@ -218,7 +218,7 @@ export default function render(props: WebComponentProps< layout="horizontal" style={{ margin: '0px auto', - maxWidth: 675, + maxWidth: '100%', }} > { diff --git a/src/types/Filter.ts b/src/types/Filter.ts index 94a114dc..8d294c75 100644 --- a/src/types/Filter.ts +++ b/src/types/Filter.ts @@ -1,7 +1,7 @@ import { Dayjs } from 'dayjs'; import { EntityDict } from 'oak-domain/lib/types/Entity'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; -import { OakAbsRefAttrPickerDef } from './AbstractComponent'; +import { OakAbsRefAttrPickerRender } from './AbstractComponent'; export type Ops = | '$gt' @@ -44,7 +44,7 @@ export type ColumnProps, 'label'>; + refProps?: Omit, 'label'>; transformFilter?: ( column: ColumnProps, value: ValueType diff --git a/src/utils/locate.ts b/src/utils/locate.ts new file mode 100644 index 00000000..928fc6ae --- /dev/null +++ b/src/utils/locate.ts @@ -0,0 +1,45 @@ +import { isWeiXin } from './utils'; + +async function locateWechat() { + return wx.getLocation({}); +} + +async function locateWeb(): Promise<{ latitude: number, longitude: number }> { + if ('geolocation' in navigator) { + return new Promise( + (resolve, reject) => { + navigator.geolocation.getCurrentPosition( + (position) => { + console.log(position); + resolve(position.coords as { latitude: number, longitude: number }); + }, + (err) => { + console.error(err); + reject(err); + } + ); + } + ) + } else { + throw new Error('浏览器不支持定位'); + } +} + +export async function locate(): Promise<{ latitude: number, longitude: number }> { + if (isWeiXin) { + // 先尝试微信定位 + try { + const result = await locateWechat(); + return result; + } + catch(err) { + console.warn(err); + const result2 = await locateWeb(); + return result2; + } + } + else { + const result2 = await locateWeb(); + return result2; + } +} \ No newline at end of file