diff --git a/examples/components/CRUD/Grid.jsx b/examples/components/CRUD/Grid.jsx index 22a6468a3..e74e2ee65 100644 --- a/examples/components/CRUD/Grid.jsx +++ b/examples/components/CRUD/Grid.jsx @@ -1,219 +1,219 @@ export default { - $schema: "https://houtai.baidu.com/v2/schemas/page.json#", - title: "增删改查示例", - remark: "bla bla bla", + $schema: 'https://houtai.baidu.com/v2/schemas/page.json#', + title: '增删改查示例', + remark: 'bla bla bla', body: { - type: "crud", - api: "/api/sample", + type: 'crud', + api: '/api/sample', // api: "/api/mock2/crud/table?waitSeconds=100000", - mode: "cards", + mode: 'cards', defaultParams: { perPage: 12 }, // fixAlignment: true, // masonryLayout: true, filter: { - title: "条件搜索", - submitText: "", + title: '条件搜索', + submitText: '', controls: [ { - type: "text", - name: "keywords", - placeholder: "通过关键字搜索", + type: 'text', + name: 'keywords', + placeholder: '通过关键字搜索', addOn: { - label: "搜索", - type: "submit" + label: '搜索', + type: 'submit' } }, { - type: "plain", - text: "这只是个示例, 目前搜索对查询结果无效." + type: 'plain', + text: '这只是个示例, 目前搜索对查询结果无效.' } ] }, bulkActions: [ { - label: "批量删除", - actionType: "ajax", - api: "delete:/api/sample/${ids|raw}", - confirmText: "确定要批量删除?" + label: '批量删除', + actionType: 'ajax', + api: 'delete:/api/sample/${ids|raw}', + confirmText: '确定要批量删除?' }, { - label: "批量修改", - actionType: "dialog", + label: '批量修改', + actionType: 'dialog', dialog: { - title: "批量编辑", - name: "sample-bulk-edit", + title: '批量编辑', + name: 'sample-bulk-edit', body: { - type: "form", - api: "/api/sample/bulkUpdate2", + type: 'form', + api: '/api/sample/bulkUpdate2', controls: [ { - type: "hidden", - name: "ids" + type: 'hidden', + name: 'ids' }, { - type: "text", - name: "engine", - label: "Engine" + type: 'text', + name: 'engine', + label: 'Engine' } ] } } } ], - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, card: { header: { - title: "$engine", - subTitle: "$platform", - subTitlePlaceholder: "暂无说明", + title: '$engine', + subTitle: '$platform', + subTitlePlaceholder: '暂无说明', avatar: '<%= data.avatar || "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1575350573496/4873dbfaf6a5.png" %>', - avatarClassName: "pull-left thumb b-3x m-r" + avatarClassName: 'pull-left thumb b-3x m-r' }, actions: [ { - type: "button", - label: "查看", - actionType: "dialog", + type: 'button', + label: '查看', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - label: "编辑", - actionType: "dialog", + type: 'button', + label: '编辑', + actionType: 'dialog', dialog: { - title: "编辑", + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "grade", - label: "CSS grade" + type: 'text', + name: 'grade', + label: 'CSS grade' } ] } } }, { - type: "button", - label: "删除", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + label: '删除', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], body: [ { - name: "engine", - label: "engine", + name: 'engine', + label: 'engine', sortable: true, quickEdit: true }, { - name: "browser", - label: "Browser" + name: 'browser', + label: 'Browser' }, { - name: "platform", - label: "Platform" + name: 'platform', + label: 'Platform' }, { - name: "version", - label: "version" + name: 'version', + label: 'version' } ] } diff --git a/examples/components/Carousel.jsx b/examples/components/Carousel.jsx index b71221788..5bb64bb94 100644 --- a/examples/components/Carousel.jsx +++ b/examples/components/Carousel.jsx @@ -1,11 +1,11 @@ export default { - type: "page", - title: "轮播图", + type: 'page', + title: '轮播图', data: { carousel0: [ - "https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg", - "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png", - "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" + 'https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg', + 'https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png', + 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg' ], carousel1: [ { @@ -14,29 +14,29 @@ export default { }, { image: - "https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg" + 'https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg' }, { image: - "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" + 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg' } ] }, body: [ { - type: "grid", + type: 'grid', columns: [ { - type: "panel", - title: "直接页面配置", + type: 'panel', + title: '直接页面配置', body: { - type: "carousel", - controlsTheme: "light", - height: "300", + type: 'carousel', + controlsTheme: 'light', + height: '300', options: [ { image: - "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png" + 'https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png' }, { html: @@ -44,21 +44,21 @@ export default { }, { image: - "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" + 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg' } ] } }, { - type: "panel", - title: "使用itemSchema配置", + type: 'panel', + title: '使用itemSchema配置', body: { - type: "carousel", - name: "carousel0", - controlsTheme: "dark", - height: "300", + type: 'carousel', + name: 'carousel0', + controlsTheme: 'dark', + height: '300', itemSchema: { - type: "tpl", + type: 'tpl', tpl: '
' } @@ -67,20 +67,20 @@ export default { ] }, { - type: "grid", + type: 'grid', columns: [ { - type: "form", - title: "表单内展示", + type: 'form', + title: '表单内展示', sm: 6, controls: [ { - type: "carousel", - controlsTheme: "dark", - name: "carousel1", - label: "carousel", - animation: "slide", - height: "300" + type: 'carousel', + controlsTheme: 'dark', + name: 'carousel1', + label: 'carousel', + animation: 'slide', + height: '300' } ] } diff --git a/examples/components/Form/Full.jsx b/examples/components/Form/Full.jsx index b9e5f4037..555fc3bb4 100644 --- a/examples/components/Form/Full.jsx +++ b/examples/components/Form/Full.jsx @@ -582,8 +582,8 @@ export default { name: 'year-month', inline: true, label: '年月', - "value": "-1month", - "inputFormat": "YYYY-MM" + value: '-1month', + inputFormat: 'YYYY-MM' }, { type: 'divider' @@ -593,8 +593,8 @@ export default { name: 'month', inline: true, label: '月份', - "value": "-1month", - "inputFormat": "MM" + value: '-1month', + inputFormat: 'MM' }, { type: 'divider' diff --git a/examples/components/Form/Picker.jsx b/examples/components/Form/Picker.jsx index e08aa1bed..d28882d08 100644 --- a/examples/components/Form/Picker.jsx +++ b/examples/components/Form/Picker.jsx @@ -1,286 +1,286 @@ export default { - $schema: "https://houtai.baidu.com/v2/schemas/page.json#", - title: "表格编辑", + $schema: 'https://houtai.baidu.com/v2/schemas/page.json#', + title: '表格编辑', body: { - type: "form", - mode: "horizontal", - api: "/api/mock2/form/saveForm?waitSeconds=2", + type: 'form', + mode: 'horizontal', + api: '/api/mock2/form/saveForm?waitSeconds=2', actions: [ { - type: "submit", - label: "提交", + type: 'submit', + label: '提交', primary: true } ], controls: [ - "

常规模式

", + '

常规模式

', { - type: "divider" + type: 'divider' }, { - type: "picker", - name: "type", - label: "单选", + type: 'picker', + name: 'type', + label: '单选', value: 1, inline: true, options: [ { - label: "选项1", + label: '选项1', value: 1 }, { - label: "选项2", + label: '选项2', value: 2 }, { - label: "选项3", + label: '选项3', value: 3 }, { - label: "选项4", + label: '选项4', value: 4 } ] }, { - type: "picker", - name: "type2", - label: "多选", + type: 'picker', + name: 'type2', + label: '多选', multiple: true, options: [ { - label: "选项1", + label: '选项1', value: 1 }, { - label: "选项2", + label: '选项2', value: 2 }, { - label: "选项3", + label: '选项3', value: 3 }, { - label: "选项4", + label: '选项4', value: 4 } ] }, { - type: "divider" + type: 'divider' }, - "

Table 渲染类型

", + '

Table 渲染类型

', { - type: "divider" + type: 'divider' }, { - type: "picker", - name: "type3", + type: 'picker', + name: 'type3', joinValues: true, - valueField: "id", - labelField: "engine", - label: "单选", - source: "/api/sample", - size: "lg", - value: "4", + valueField: 'id', + labelField: 'engine', + label: '单选', + source: '/api/sample', + size: 'lg', + value: '4', pickerSchema: { - mode: "table", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'table', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] }, columns: [ { - name: "engine", - label: "Rendering engine", + name: 'engine', + label: 'Rendering engine', sortable: true, searchable: true, - type: "text", + type: 'text', toggled: true }, { - name: "browser", - label: "Browser", + name: 'browser', + label: 'Browser', sortable: true, - type: "text", + type: 'text', toggled: true }, { - name: "platform", - label: "Platform(s)", + name: 'platform', + label: 'Platform(s)', sortable: true, - type: "text", + type: 'text', toggled: true }, { - name: "version", - label: "Engine version", + name: 'version', + label: 'Engine version', quickEdit: true, - type: "text", + type: 'text', toggled: true }, { - name: "grade", - label: "CSS grade", + name: 'grade', + label: 'CSS grade', quickEdit: { - mode: "inline", - type: "select", - options: ["A", "B", "C", "D", "X"], + mode: 'inline', + type: 'select', + options: ['A', 'B', 'C', 'D', 'X'], saveImmediately: true }, - type: "text", + type: 'text', toggled: true }, { - type: "operation", - label: "操作", + type: 'operation', + label: '操作', width: 100, buttons: [ { - type: "button", - icon: "fa fa-eye", - actionType: "dialog", + type: 'button', + icon: 'fa fa-eye', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - icon: "fa fa-pencil", - actionType: "dialog", + type: 'button', + icon: 'fa fa-pencil', + actionType: 'dialog', dialog: { - position: "left", - size: "lg", - title: "编辑", + position: 'left', + size: 'lg', + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "select", - name: "grade", - label: "CSS grade", - options: ["A", "B", "C", "D", "X"] + type: 'select', + name: 'grade', + label: 'CSS grade', + options: ['A', 'B', 'C', 'D', 'X'] } ] } } }, { - type: "button", - icon: "fa fa-times text-danger", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + icon: 'fa fa-times text-danger', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], toggled: true @@ -290,210 +290,210 @@ export default { }, { - type: "picker", - name: "type4", + type: 'picker', + name: 'type4', joinValues: true, - valueField: "id", - labelField: "engine", - label: "多选", - source: "/api/sample", - size: "lg", - value: "4,5", + valueField: 'id', + labelField: 'engine', + label: '多选', + source: '/api/sample', + size: 'lg', + value: '4,5', multiple: true, pickerSchema: { - mode: "table", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'table', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] }, columns: [ { - name: "engine", - label: "Rendering engine", + name: 'engine', + label: 'Rendering engine', sortable: true, searchable: true, - type: "text", + type: 'text', toggled: true }, { - name: "browser", - label: "Browser", + name: 'browser', + label: 'Browser', sortable: true, - type: "text", + type: 'text', toggled: true }, { - name: "platform", - label: "Platform(s)", + name: 'platform', + label: 'Platform(s)', sortable: true, - type: "text", + type: 'text', toggled: true }, { - name: "version", - label: "Engine version", + name: 'version', + label: 'Engine version', quickEdit: true, - type: "text", + type: 'text', toggled: true }, { - name: "grade", - label: "CSS grade", + name: 'grade', + label: 'CSS grade', quickEdit: { - mode: "inline", - type: "select", - options: ["A", "B", "C", "D", "X"], + mode: 'inline', + type: 'select', + options: ['A', 'B', 'C', 'D', 'X'], saveImmediately: true }, - type: "text", + type: 'text', toggled: true }, { - type: "operation", - label: "操作", + type: 'operation', + label: '操作', width: 100, buttons: [ { - type: "button", - icon: "fa fa-eye", - actionType: "dialog", + type: 'button', + icon: 'fa fa-eye', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - icon: "fa fa-pencil", - actionType: "dialog", + type: 'button', + icon: 'fa fa-pencil', + actionType: 'dialog', dialog: { - position: "left", - size: "lg", - title: "编辑", + position: 'left', + size: 'lg', + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "select", - name: "grade", - label: "CSS grade", - options: ["A", "B", "C", "D", "X"] + type: 'select', + name: 'grade', + label: 'CSS grade', + options: ['A', 'B', 'C', 'D', 'X'] } ] } } }, { - type: "button", - icon: "fa fa-times text-danger", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + icon: 'fa fa-times text-danger', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], toggled: true @@ -503,45 +503,45 @@ export default { }, { - type: "divider" + type: 'divider' }, - "

List 渲染类型

", + '

List 渲染类型

', { - type: "divider" + type: 'divider' }, { - type: "picker", - name: "type5", + type: 'picker', + name: 'type5', joinValues: true, - valueField: "id", - labelField: "engine", - label: "单选", - source: "/api/sample", - size: "lg", - value: "4", + valueField: 'id', + labelField: 'engine', + label: '单选', + source: '/api/sample', + size: 'lg', + value: '4', pickerSchema: { - mode: "list", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'list', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] @@ -549,187 +549,187 @@ export default { listItem: { actions: [ { - type: "button", - icon: "fa fa-eye", - actionType: "dialog", + type: 'button', + icon: 'fa fa-eye', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - icon: "fa fa-pencil", - actionType: "dialog", + type: 'button', + icon: 'fa fa-pencil', + actionType: 'dialog', dialog: { - title: "编辑", + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "grade", - label: "CSS grade" + type: 'text', + name: 'grade', + label: 'CSS grade' } ] } } }, { - type: "button", - icon: "fa fa-times text-danger", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + icon: 'fa fa-times text-danger', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], body: [ { - name: "engine", - label: "Rendering engine", + name: 'engine', + label: 'Rendering engine', sortable: true, quickEdit: true, - labelClassName: "w-sm" + labelClassName: 'w-sm' }, [ { - name: "browser", - label: "Browser", - labelClassName: "w-sm" + name: 'browser', + label: 'Browser', + labelClassName: 'w-sm' }, { - name: "platform", - label: "Platform(s)", - labelClassName: "w-sm" + name: 'platform', + label: 'Platform(s)', + labelClassName: 'w-sm' } ], { - name: "version", - label: "Engine version", - labelClassName: "w-sm" + name: 'version', + label: 'Engine version', + labelClassName: 'w-sm' } ] } } }, { - type: "picker", - name: "type6", + type: 'picker', + name: 'type6', joinValues: true, - valueField: "id", - labelField: "engine", - label: "多选", - source: "/api/sample", - size: "lg", - value: "4,5", + valueField: 'id', + labelField: 'engine', + label: '多选', + source: '/api/sample', + size: 'lg', + value: '4,5', multiple: true, pickerSchema: { - mode: "list", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'list', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] @@ -737,150 +737,150 @@ export default { listItem: { actions: [ { - type: "button", - icon: "fa fa-eye", - actionType: "dialog", + type: 'button', + icon: 'fa fa-eye', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - icon: "fa fa-pencil", - actionType: "dialog", + type: 'button', + icon: 'fa fa-pencil', + actionType: 'dialog', dialog: { - title: "编辑", + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "grade", - label: "CSS grade" + type: 'text', + name: 'grade', + label: 'CSS grade' } ] } } }, { - type: "button", - icon: "fa fa-times text-danger", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + icon: 'fa fa-times text-danger', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], body: [ { - name: "engine", - label: "Rendering engine", + name: 'engine', + label: 'Rendering engine', sortable: true, quickEdit: true, - labelClassName: "w-sm" + labelClassName: 'w-sm' }, [ { - name: "browser", - label: "Browser", - labelClassName: "w-sm" + name: 'browser', + label: 'Browser', + labelClassName: 'w-sm' }, { - name: "platform", - label: "Platform(s)", - labelClassName: "w-sm" + name: 'platform', + label: 'Platform(s)', + labelClassName: 'w-sm' } ], { - name: "version", - label: "Engine version", - labelClassName: "w-sm" + name: 'version', + label: 'Engine version', + labelClassName: 'w-sm' } ] } @@ -888,198 +888,198 @@ export default { }, { - type: "divider" + type: 'divider' }, - "

Cards 渲染类型

", + '

Cards 渲染类型

', { - type: "divider" + type: 'divider' }, { - type: "picker", - name: "type7", + type: 'picker', + name: 'type7', joinValues: true, - valueField: "id", - labelField: "engine", - label: "单选", - source: "/api/sample", - size: "lg", - value: "4", + valueField: 'id', + labelField: 'engine', + label: '单选', + source: '/api/sample', + size: 'lg', + value: '4', pickerSchema: { - mode: "cards", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'cards', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] }, card: { header: { - title: "$engine", - subTitle: "$platform", - subTitlePlaceholder: "暂无说明", + title: '$engine', + subTitle: '$platform', + subTitlePlaceholder: '暂无说明', avatar: '<%= data.avatar || "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1575350573496/4873dbfaf6a5.png" %>', - avatarClassName: "pull-left thumb b-3x m-r" + avatarClassName: 'pull-left thumb b-3x m-r' }, actions: [ { - type: "button", - label: "查看", - actionType: "dialog", + type: 'button', + label: '查看', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - label: "编辑", - actionType: "dialog", + type: 'button', + label: '编辑', + actionType: 'dialog', dialog: { - title: "编辑", + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "grade", - label: "CSS grade" + type: 'text', + name: 'grade', + label: 'CSS grade' } ] } } }, { - type: "button", - label: "删除", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + label: '删除', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], body: [ { - name: "engine", - label: "engine", + name: 'engine', + label: 'engine', sortable: true, quickEdit: true }, { - name: "browser", - label: "Browser" + name: 'browser', + label: 'Browser' }, { - name: "platform", - label: "Platform" + name: 'platform', + label: 'Platform' }, { - name: "version", - label: "version" + name: 'version', + label: 'version' } ] } @@ -1087,190 +1087,190 @@ export default { }, { - type: "picker", - name: "type8", + type: 'picker', + name: 'type8', joinValues: true, - valueField: "id", - labelField: "engine", - label: "多选", - source: "/api/sample", - size: "lg", - value: "4,5", + valueField: 'id', + labelField: 'engine', + label: '多选', + source: '/api/sample', + size: 'lg', + value: '4,5', multiple: true, pickerSchema: { - mode: "cards", - name: "thelist", - quickSaveApi: "/api/sample/bulkUpdate", - quickSaveItemApi: "/api/sample/$id", + mode: 'cards', + name: 'thelist', + quickSaveApi: '/api/sample/bulkUpdate', + quickSaveItemApi: '/api/sample/$id', draggable: true, headerToolbar: { wrapWithPanel: false, - type: "form", - className: "text-right", - target: "thelist", - mode: "inline", + type: 'form', + className: 'text-right', + target: 'thelist', + mode: 'inline', controls: [ { - type: "text", - name: "keywords", + type: 'text', + name: 'keywords', addOn: { - type: "submit", - label: "搜索", - level: "primary", - icon: "fa fa-search pull-left" + type: 'submit', + label: '搜索', + level: 'primary', + icon: 'fa fa-search pull-left' } } ] }, card: { header: { - title: "$engine", - subTitle: "$platform", - subTitlePlaceholder: "暂无说明", + title: '$engine', + subTitle: '$platform', + subTitlePlaceholder: '暂无说明', avatar: '<%= data.avatar || "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1575350573496/4873dbfaf6a5.png" %>', - avatarClassName: "pull-left thumb b-3x m-r" + avatarClassName: 'pull-left thumb b-3x m-r' }, actions: [ { - type: "button", - label: "查看", - actionType: "dialog", + type: 'button', + label: '查看', + actionType: 'dialog', dialog: { - title: "查看", + title: '查看', body: { - type: "form", + type: 'form', controls: [ { - type: "static", - name: "engine", - label: "Engine" + type: 'static', + name: 'engine', + label: 'Engine' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "browser", - label: "Browser" + type: 'static', + name: 'browser', + label: 'Browser' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "platform", - label: "Platform(s)" + type: 'static', + name: 'platform', + label: 'Platform(s)' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "version", - label: "Engine version" + type: 'static', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "static", - name: "grade", - label: "CSS grade" + type: 'static', + name: 'grade', + label: 'CSS grade' }, { - type: "divider" + type: 'divider' }, { - type: "html", + type: 'html', html: - "

添加其他 Html 片段 需要支持变量替换(todo).

" + '

添加其他 Html 片段 需要支持变量替换(todo).

' } ] } } }, { - type: "button", - label: "编辑", - actionType: "dialog", + type: 'button', + label: '编辑', + actionType: 'dialog', dialog: { - title: "编辑", + title: '编辑', body: { - type: "form", - name: "sample-edit-form", - api: "/api/sample/$id", + type: 'form', + name: 'sample-edit-form', + api: '/api/sample/$id', controls: [ { - type: "text", - name: "engine", - label: "Engine", + type: 'text', + name: 'engine', + label: 'Engine', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "browser", - label: "Browser", + type: 'text', + name: 'browser', + label: 'Browser', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "platform", - label: "Platform(s)", + type: 'text', + name: 'platform', + label: 'Platform(s)', required: true }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "version", - label: "Engine version" + type: 'text', + name: 'version', + label: 'Engine version' }, { - type: "divider" + type: 'divider' }, { - type: "text", - name: "grade", - label: "CSS grade" + type: 'text', + name: 'grade', + label: 'CSS grade' } ] } } }, { - type: "button", - label: "删除", - actionType: "ajax", - confirmText: "您确认要删除?", - api: "delete:/api/sample/$id" + type: 'button', + label: '删除', + actionType: 'ajax', + confirmText: '您确认要删除?', + api: 'delete:/api/sample/$id' } ], body: [ { - name: "engine", - label: "engine", + name: 'engine', + label: 'engine', sortable: true, quickEdit: true }, { - name: "browser", - label: "Browser" + name: 'browser', + label: 'Browser' }, { - name: "platform", - label: "Platform" + name: 'platform', + label: 'Platform' }, { - name: "version", - label: "version" + name: 'version', + label: 'version' } ] } diff --git a/examples/polyfills/cloest.ts b/examples/polyfills/cloest.ts index c302864c7..385d03e7d 100644 --- a/examples/polyfills/cloest.ts +++ b/examples/polyfills/cloest.ts @@ -9,7 +9,7 @@ if (!Element.prototype.matches) { } if (!Element.prototype.closest) { - Element.prototype.closest = function(s) { + Element.prototype.closest = function (s) { var el = this; if (!document.documentElement.contains(el)) { return null; diff --git a/fis-conf.js b/fis-conf.js index e05c30206..a734e0f5c 100644 --- a/fis-conf.js +++ b/fis-conf.js @@ -113,24 +113,23 @@ fis.match('/docs/**.md', { parser: [ parserMarkdown, function (contents, file) { - return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function ( - _, - quota, - link - ) { - if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { - let parts = link.split('#'); - parts[0] = parts[0].replace('.md', ''); + return contents.replace( + /\bhref=\\('|")(.+?)\\\1/g, + function (_, quota, link) { + if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { + let parts = link.split('#'); + parts[0] = parts[0].replace('.md', ''); - if (parts[0][0] !== '/') { - parts[0] = path.resolve(path.dirname(file.subpath), parts[0]); + if (parts[0][0] !== '/') { + parts[0] = path.resolve(path.dirname(file.subpath), parts[0]); + } + + return 'href=\\' + quota + parts.join('#') + '\\' + quota; } - return 'href=\\' + quota + parts.join('#') + '\\' + quota; + return _; } - - return _; - }); + ); } ], isMod: true @@ -216,26 +215,25 @@ fis.media('dev').match('_*.scss', { parser: [ parserCodeMarkdown, function (contents, file) { - return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function ( - _, - quota, - link - ) { - if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { - let parts = link.split('#'); - parts[0] = parts[0].replace('.md', ''); + return contents.replace( + /\bhref=\\('|")(.+?)\\\1/g, + function (_, quota, link) { + if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { + let parts = link.split('#'); + parts[0] = parts[0].replace('.md', ''); - if (parts[0][0] !== '/') { - parts[0] = path - .resolve(path.dirname(file.subpath), parts[0]) - .replace(/^\/docs/, ''); + if (parts[0][0] !== '/') { + parts[0] = path + .resolve(path.dirname(file.subpath), parts[0]) + .replace(/^\/docs/, ''); + } + + return 'href=\\' + quota + parts.join('#') + '\\' + quota; } - return 'href=\\' + quota + parts.join('#') + '\\' + quota; + return _; } - - return _; - }); + ); } ], release: '$0', @@ -285,20 +283,19 @@ if (fis.project.currentMedia() === 'publish') { }), function (contents) { return contents - .replace(/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, function ( - _, - quote, - value - ) { - let str = quote + value + quote; - return ( - '(function(){try {return __uri(' + - str + - ')} catch(e) {return ' + - str + - '}})()' - ); - }) + .replace( + /(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, + function (_, quote, value) { + let str = quote + value + quote; + return ( + '(function(){try {return __uri(' + + str + + ')} catch(e) {return ' + + str + + '}})()' + ); + } + ) .replace( /return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g, function (_, tslib, quto, value) { @@ -580,24 +577,25 @@ if (fis.project.currentMedia() === 'publish') { parser: [ parserMarkdown, function (contents, file) { - return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function ( - _, - quota, - link - ) { - if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { - let parts = link.split('#'); - parts[0] = parts[0].replace('.md', ''); + return contents.replace( + /\bhref=\\('|")(.+?)\\\1/g, + function (_, quota, link) { + if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { + let parts = link.split('#'); + parts[0] = parts[0].replace('.md', ''); - if (parts[0][0] !== '/') { - parts[0] = path.resolve(path.dirname(file.subpath), parts[0]); + if (parts[0][0] !== '/') { + parts[0] = path.resolve(path.dirname(file.subpath), parts[0]); + } + + return ( + 'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota + ); } - return 'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota; + return _; } - - return _; - }); + ); } ] }); @@ -606,26 +604,25 @@ if (fis.project.currentMedia() === 'publish') { parser: [ parserCodeMarkdown, function (contents, file) { - return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function ( - _, - quota, - link - ) { - if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { - let parts = link.split('#'); - parts[0] = parts[0].replace('.md', ''); + return contents.replace( + /\bhref=\\('|")(.+?)\\\1/g, + function (_, quota, link) { + if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) { + let parts = link.split('#'); + parts[0] = parts[0].replace('.md', ''); - if (parts[0][0] !== '/') { - parts[0] = path - .resolve(path.dirname(file.subpath), parts[0]) - .replace(/^\/docs/, '/amis'); + if (parts[0][0] !== '/') { + parts[0] = path + .resolve(path.dirname(file.subpath), parts[0]) + .replace(/^\/docs/, '/amis'); + } + + return 'href=\\' + quota + parts.join('#') + '\\' + quota; } - return 'href=\\' + quota + parts.join('#') + '\\' + quota; + return _; } - - return _; - }); + ); } ], isMod: true, @@ -757,18 +754,17 @@ if (fis.project.currentMedia() === 'publish') { DocCSS.getContent(), ExampleJs.getContent() ].join('\n'); - source.replace(/\bpath\b\s*\:\s*('|")(.*?)\1/g, function ( - _, - qutoa, - path - ) { - if (path === '*') { - return; - } + source.replace( + /\bpath\b\s*\:\s*('|")(.*?)\1/g, + function (_, qutoa, path) { + if (path === '*') { + return; + } - pages.push(path.replace(/^\//, '')); - return _; - }); + pages.push(path.replace(/^\//, '')); + return _; + } + ); const contents = indexHtml.getContent(); pages.forEach(function (path) { @@ -825,20 +821,19 @@ if (fis.project.currentMedia() === 'publish') { function (contents) { return contents - .replace(/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, function ( - _, - quote, - value - ) { - let str = quote + value + quote; - return ( - '(function(){try {return __uri(' + - str + - ')} catch(e) {return ' + - str + - '}})()' - ); - }) + .replace( + /(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g, + function (_, quote, value) { + let str = quote + value + quote; + return ( + '(function(){try {return __uri(' + + str + + ')} catch(e) {return ' + + str + + '}})()' + ); + } + ) .replace( /return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g, function (_, tslib, quto, value) { diff --git a/package.json b/package.json index 05e3f4b4d..d39cace0a 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "postcss": "^8.2.1", "postcss-cli": "^8.3.1", "postcss-custom-properties": "^10.0.0", - "prettier": "^2.0.5", + "prettier": "2.2.1", "prismjs": "^1.20.0", "react-frame-component": "^2.0.0", "react-router": "3.2.0", diff --git a/src/components/virtual-list/SizeAndPositionManager.ts b/src/components/virtual-list/SizeAndPositionManager.ts index f1a89c159..9864d4146 100644 --- a/src/components/virtual-list/SizeAndPositionManager.ts +++ b/src/components/virtual-list/SizeAndPositionManager.ts @@ -41,7 +41,7 @@ export default class SizeAndPositionManager { updateConfig({ itemCount, itemSizeGetter, - estimatedItemSize, + estimatedItemSize }: Partial) { if (itemCount != null) { this.itemCount = itemCount; @@ -67,7 +67,7 @@ export default class SizeAndPositionManager { getSizeAndPositionForIndex(index: number) { if (index < 0 || index >= this.itemCount) { throw Error( - `Requested index ${index} is outside of range 0..${this.itemCount}`, + `Requested index ${index} is outside of range 0..${this.itemCount}` ); } @@ -85,7 +85,7 @@ export default class SizeAndPositionManager { this.itemSizeAndPositionData[i] = { offset, - size, + size }; offset += size; @@ -129,7 +129,7 @@ export default class SizeAndPositionManager { align = ALIGNMENT.START, containerSize, currentOffset, - targetIndex, + targetIndex }: { align: ALIGNMENT | undefined; containerSize: number; @@ -168,7 +168,7 @@ export default class SizeAndPositionManager { getVisibleRange({ containerSize, offset, - overscanCount, + overscanCount }: { containerSize: number; offset: number; @@ -204,7 +204,7 @@ export default class SizeAndPositionManager { return { start, - stop, + stop }; } @@ -240,7 +240,7 @@ export default class SizeAndPositionManager { return this.binarySearch({ high: lastMeasuredIndex, low: 0, - offset, + offset }); } else { // If we haven't yet measured this high, fallback to an exponential search with an inner binary search. @@ -248,7 +248,7 @@ export default class SizeAndPositionManager { // The overall complexity for this approach is O(log n). return this.exponentialSearch({ index: lastMeasuredIndex, - offset, + offset }); } } @@ -256,7 +256,7 @@ export default class SizeAndPositionManager { private binarySearch({ low, high, - offset, + offset }: { low: number; high: number; @@ -299,7 +299,7 @@ export default class SizeAndPositionManager { return this.binarySearch({ high: Math.min(index, this.itemCount - 1), low: Math.floor(index / 2), - offset, + offset }); } } diff --git a/src/components/virtual-list/constants.ts b/src/components/virtual-list/constants.ts index 3789bbab2..cfee7383a 100644 --- a/src/components/virtual-list/constants.ts +++ b/src/components/virtual-list/constants.ts @@ -2,40 +2,40 @@ export enum ALIGNMENT { AUTO = 'auto', START = 'start', CENTER = 'center', - END = 'end', + END = 'end' } export enum DIRECTION { HORIZONTAL = 'horizontal', - VERTICAL = 'vertical', + VERTICAL = 'vertical' } export enum SCROLL_CHANGE_REASON { OBSERVED = 'observed', - REQUESTED = 'requested', + REQUESTED = 'requested' } export const scrollProp = { [DIRECTION.VERTICAL]: 'scrollTop', - [DIRECTION.HORIZONTAL]: 'scrollLeft', + [DIRECTION.HORIZONTAL]: 'scrollLeft' }; export const sizeProp = { [DIRECTION.VERTICAL]: 'height', - [DIRECTION.HORIZONTAL]: 'width', + [DIRECTION.HORIZONTAL]: 'width' }; export const positionProp = { [DIRECTION.VERTICAL]: 'top', - [DIRECTION.HORIZONTAL]: 'left', + [DIRECTION.HORIZONTAL]: 'left' }; export const marginProp = { [DIRECTION.VERTICAL]: 'marginTop', - [DIRECTION.HORIZONTAL]: 'marginLeft', + [DIRECTION.HORIZONTAL]: 'marginLeft' }; export const oppositeMarginProp = { [DIRECTION.VERTICAL]: 'marginBottom', - [DIRECTION.HORIZONTAL]: 'marginRight', + [DIRECTION.HORIZONTAL]: 'marginRight' }; diff --git a/src/renderers/DropDownButton.tsx b/src/renderers/DropDownButton.tsx index 99364c0f7..ef55dc586 100644 --- a/src/renderers/DropDownButton.tsx +++ b/src/renderers/DropDownButton.tsx @@ -8,10 +8,7 @@ import type {TooltipObject, Trigger} from '../components/TooltipWrapper'; import {isVisible, noop} from '../utils/helper'; import {filter} from '../utils/tpl'; import {Icon} from '../components/icons'; -import { - BaseSchema, - SchemaClassName -} from '../Schema'; +import {BaseSchema, SchemaClassName} from '../Schema'; import {ActionSchema} from './Action'; import {DividerSchema} from './Divider'; @@ -111,9 +108,7 @@ export default class DropDownButton extends React.Component< static defaultProps: Pick< DropDownButtonProps, - | 'placement' - | 'tooltipTrigger' - | 'tooltipRootClose' + 'placement' | 'tooltipTrigger' | 'tooltipRootClose' > = { placement: 'top', tooltipTrigger: ['hover', 'focus'], diff --git a/src/renderers/Form/ConditionBuilder.tsx b/src/renderers/Form/ConditionBuilder.tsx index bcf064492..26d206c79 100644 --- a/src/renderers/Form/ConditionBuilder.tsx +++ b/src/renderers/Form/ConditionBuilder.tsx @@ -35,9 +35,7 @@ export interface ConditionBuilderProps extends FormControlProps, ConditionBuilderControlSchema {} -export default class ConditionBuilderControl extends React.PureComponent< - ConditionBuilderProps -> { +export default class ConditionBuilderControl extends React.PureComponent { render() { const {className, classnames: cx, ...rest} = this.props; diff --git a/src/renderers/Form/Editor.tsx b/src/renderers/Form/Editor.tsx index 3064e0a77..ebd57b837 100644 --- a/src/renderers/Form/Editor.tsx +++ b/src/renderers/Form/Editor.tsx @@ -274,26 +274,26 @@ export const availableLanguages = [ 'yaml' ]; -export const EditorControls: Array = availableLanguages.map( - (lang: string) => { - @FormItem({ - type: `${lang}-editor`, - sizeMutable: false - }) - class EditorControlRenderer extends EditorControl { - static lang = lang; - static displayName = `${lang[0].toUpperCase()}${lang.substring( - 1 - )}EditorControlRenderer`; - static defaultProps = { - ...EditorControl.defaultProps, - language: lang - }; - } - - return EditorControlRenderer; +export const EditorControls: Array< + typeof EditorControl +> = availableLanguages.map((lang: string) => { + @FormItem({ + type: `${lang}-editor`, + sizeMutable: false + }) + class EditorControlRenderer extends EditorControl { + static lang = lang; + static displayName = `${lang[0].toUpperCase()}${lang.substring( + 1 + )}EditorControlRenderer`; + static defaultProps = { + ...EditorControl.defaultProps, + language: lang + }; } -); + + return EditorControlRenderer; +}); @FormItem({ type: 'js-editor', diff --git a/src/renderers/Form/Image.tsx b/src/renderers/Form/Image.tsx index 3a41c41fe..4a05c53b0 100644 --- a/src/renderers/Form/Image.tsx +++ b/src/renderers/Form/Image.tsx @@ -370,7 +370,7 @@ export default class ImageControl extends React.Component< this.state = { ...this.state, - files: this.files = files, + files: (this.files = files), crop: this.buildCrop(props) }; @@ -436,7 +436,7 @@ export default class ImageControl extends React.Component< } this.setState({ - files: this.files = files + files: (this.files = files) }); } @@ -522,14 +522,14 @@ export default class ImageControl extends React.Component< { uploading: true, locked: true, - files: this.files = this.files.map(file => { + files: (this.files = this.files.map(file => { if (retry && file.state === 'error') { file.state = 'pending'; file.progress = 0; } return file; - }) + })) }, this.tick ); @@ -564,7 +564,7 @@ export default class ImageControl extends React.Component< file.state = 'uploading'; this.setState( { - files: this.files = this.files.concat() + files: (this.files = this.files.concat()) }, () => this.sendFile( @@ -590,7 +590,7 @@ export default class ImageControl extends React.Component< return this.setState( { - files: this.files = files, + files: (this.files = files), error: error }, this.tick @@ -608,7 +608,7 @@ export default class ImageControl extends React.Component< this.current = null; this.setState( { - files: this.files = files + files: (this.files = files) }, () => { const sendTo = @@ -633,7 +633,7 @@ export default class ImageControl extends React.Component< // file 是个非 File 对象,先不copy了直接改。 file.progress = progress; this.setState({ - files: this.files = files + files: (this.files = files) }); } ) @@ -667,7 +667,7 @@ export default class ImageControl extends React.Component< this.setState( { - files: this.files = files + files: (this.files = files) }, this.onChange ); @@ -877,7 +877,7 @@ export default class ImageControl extends React.Component< this.setState( { error: undefined, - files: this.files = currentFiles.concat(inputFiles), + files: (this.files = currentFiles.concat(inputFiles)), locked: true }, () => { @@ -1053,7 +1053,7 @@ export default class ImageControl extends React.Component< this.unmounted || this.setState( { - files: this.files = files + files: (this.files = files) }, !needUploading ? this.onChange : undefined ); diff --git a/src/renderers/Form/TabsTransfer.tsx b/src/renderers/Form/TabsTransfer.tsx index fa45cd585..0386c83a9 100644 --- a/src/renderers/Form/TabsTransfer.tsx +++ b/src/renderers/Form/TabsTransfer.tsx @@ -50,9 +50,7 @@ export interface TabsTransferProps @OptionsControl({ type: 'tabs-transfer' }) -export class TabsTransferRenderer extends BaseTransferRenderer< - TabsTransferProps -> { +export class TabsTransferRenderer extends BaseTransferRenderer { render() { const { className,