@@ -16,34 +21,7 @@
- +
@@ -88,6 +66,7 @@
+ diff --git a/src/main/resources/web/admin/metadata/form-design.html b/src/main/resources/web/admin/metadata/form-design.html index a02a38be3..5b1388c59 100644 --- a/src/main/resources/web/admin/metadata/form-design.html +++ b/src/main/resources/web/admin/metadata/form-design.html @@ -128,6 +128,7 @@ isSuperAdmin: '[[${isSuperAdmin}]]' === 'true', } + diff --git a/src/main/resources/web/assets/css/form-design.css b/src/main/resources/web/assets/css/form-design.css index 174362393..bc757532b 100644 --- a/src/main/resources/web/assets/css/form-design.css +++ b/src/main/resources/web/assets/css/form-design.css @@ -227,7 +227,8 @@ See LICENSE and COMMERCIAL in the project root for license information. color: #999; } -.field-list .dd-item:hover .dd-handle::before { +.field-list .dd-item:hover .dd-handle::before, +.type-list .dd-item:hover .dd-handle::before { color: #fff; } @@ -235,12 +236,6 @@ See LICENSE and COMMERCIAL in the project root for license information. right: 32px; } -.type-list .dd-item .dd-handle:hover, -.type-list .dd-item .dd-handle:hover::before { - background-color: transparent; - color: #4285f4; -} - form.field-attr { width: 500px; max-width: 400px; @@ -311,3 +306,15 @@ form.field-attr label > span { .field-aside .nav.nav-tabs { margin-top: 7px; } + +.type-list .dd-handle { + padding-left: 38px !important; +} + +.type-list .dd-handle .icon.mdi { + font-size: 1.4rem; + width: 20px; + position: absolute; + left: 13px; + margin-top: -1px; +} diff --git a/src/main/resources/web/assets/js/metadata/entity-new.js b/src/main/resources/web/assets/js/metadata/entity-new.js index cdc834d65..52f279c9d 100644 --- a/src/main/resources/web/assets/js/metadata/entity-new.js +++ b/src/main/resources/web/assets/js/metadata/entity-new.js @@ -23,7 +23,7 @@ $(document).ready(function () { } $new.button('loading') - $.post(`/admin/entity/entity-new?nameField=${$val('#nameField')}`, JSON.stringify(data), (res) => { + $.post(`/admin/entity/entity-new?nameField=${$val('#nameField')}&seriesField=${$val('#seriesField')}`, JSON.stringify(data), (res) => { if (res.error_code === 0) parent.location.href = `${rb.baseUrl}/admin/entity/${res.data}/base` else RbHighbar.error(res.error_msg) }) diff --git a/src/main/resources/web/assets/js/metadata/field-new.js b/src/main/resources/web/assets/js/metadata/field-new.js index 91a7babe1..293b66aea 100644 --- a/src/main/resources/web/assets/js/metadata/field-new.js +++ b/src/main/resources/web/assets/js/metadata/field-new.js @@ -4,6 +4,7 @@ Copyright (c) REBUILD and/or its owners. All rights re rebuild is dual-licensed under commercial and open source licenses (GPLv3). See LICENSE and COMMERCIAL in the project root for license information. */ +/* global FIELD_TYPES */ $(document).ready(function () { const entity = $urlp('entity') @@ -44,7 +45,7 @@ $(document).ready(function () { if ($val('#saveAndNew')) { RbHighbar.success($L('字段已添加')) $('#fieldLabel, #comments').val('') - $('#type').val('TEXT').trigger('change') + // $('#type').val('TEXT').trigger('change') $('#fieldLabel').focus() // @see `field-new.html` @@ -60,6 +61,14 @@ $(document).ready(function () { }) }) + for (let k in FIELD_TYPES) { + const t = FIELD_TYPES[k] + const $o = $(``).appendTo('#type') + if (t[2]) $o.addClass('bosskey-show') + } + + // $('#type, #refEntity').select2({}) + let referenceLoaded = false let classificationLoaded = false $('#type').on('change', function () { diff --git a/src/main/resources/web/assets/js/metadata/field-type.js b/src/main/resources/web/assets/js/metadata/field-type.js new file mode 100644 index 000000000..a47200317 --- /dev/null +++ b/src/main/resources/web/assets/js/metadata/field-type.js @@ -0,0 +1,35 @@ +/*! +Copyright (c) REBUILD and/or its owners. All rights reserved. + +rebuild is dual-licensed under commercial and open source licenses (GPLv3). +See LICENSE and COMMERCIAL in the project root for license information. +*/ + +// 字段类型 +// eslint-disable-next-line no-unused-vars +const FIELD_TYPES = { + 'TEXT': [$L('文本'), 'mdi-form-textbox'], + 'NTEXT': [$L('多行文本'), 'mdi-form-textarea'], + 'PHONE': [$L('电话'), 'mdi-phone-classic'], + 'EMAIL': [$L('邮箱'), 'mdi-email'], + 'URL': [$L('链接'), 'mdi-link'], + 'NUMBER': [$L('整数'), 'mdi-numeric'], + 'DECIMAL': [$L('小数'), 'mdi-numeric'], + 'SERIES': [$L('自动编号'), 'mdi-alphabetical'], + 'DATE': [$L('日期'), 'mdi-calendar-multiselect-outline'], + 'DATETIME': [$L('日期时间'), 'mdi-calendar-multiselect-outline'], + 'TIME': [$L('时间'), 'mdi-clock-time-seven-outline'], + 'PICKLIST': [$L('下拉列表'), 'mdi-form-select'], + 'CLASSIFICATION': [$L('分类'), 'mdi-form-dropdown'], + 'MULTISELECT': [$L('多选'), 'mdi-format-list-checks'], + 'REFERENCE': [$L('引用'), 'mdi-feature-search-outline'], + 'N2NREFERENCE': [$L('多引用'), 'mdi-text-box-search-outline'], + 'FILE': [$L('附件'), 'mdi-attachment'], + 'IMAGE': [$L('图片'), 'mdi-image'], + 'AVATAR': [$L('头像'), 'mdi-account-box-outline'], + 'BARCODE': [$L('二维码'), 'mdi-qrcode'], + 'LOCATION': [$L('位置'), 'mdi-map-marker'], + 'SIGN': [$L('签名'), 'mdi-file-sign'], + 'BOOL': [$L('布尔'), 'mdi-toggle-switch-off-outline'], + 'STATE': [$L('状态'), 'mdi-language-java', true], +} diff --git a/src/main/resources/web/assets/js/metadata/form-design.js b/src/main/resources/web/assets/js/metadata/form-design.js index 7c9e4adf1..2dc0c87fc 100644 --- a/src/main/resources/web/assets/js/metadata/form-design.js +++ b/src/main/resources/web/assets/js/metadata/form-design.js @@ -4,6 +4,7 @@ Copyright (c) REBUILD and/or its owners. All rights re rebuild is dual-licensed under commercial and open source licenses (GPLv3). See LICENSE and COMMERCIAL in the project root for license information. */ +/* global FIELD_TYPES */ const wpc = window.__PageConfig const DIVIDER_LINE = '$DIVIDER$' @@ -48,7 +49,7 @@ $(document).ready(function () { '.form-preview' ) const $action = $('
').appendTo($item.find('.dd-handle')) - $action.find('a').click(function () { + $action.find('a').on('click', function () { $item.remove() }) } else { @@ -66,38 +67,17 @@ $(document).ready(function () { .disableSelection() }) - $('.J_add-divider').click(function () { + $('.J_add-divider').on('click', function () { $('.nav-tabs-classic a[href="#form-design"]').tab('show') render_item({ fieldName: DIVIDER_LINE, fieldLabel: '', colspan: 4 }) }) // @see field-new.html - const FIELD_TYPES = { - 'TEXT': $L('文本'), - 'NTEXT': $L('多行文本'), - 'PHONE': $L('电话'), - 'EMAIL': $L('邮箱'), - 'URL': $L('链接'), - 'NUMBER': $L('整数'), - 'DECIMAL': $L('小数'), - 'SERIES': $L('自动编号'), - 'DATE': $L('日期'), - 'DATETIME': $L('日期时间'), - 'TIME': $L('时间'), - 'PICKLIST': $L('下拉列表'), - 'CLASSIFICATION': $L('分类'), - 'MULTISELECT': $L('多选'), - 'REFERENCE': $L('引用'), - 'N2NREFERENCE': $L('多引用'), - 'FILE': $L('附件'), - 'IMAGE': $L('图片'), - 'AVATAR': $L('头像'), - 'BARCODE': $L('二维码'), - 'LOCATION': $L('位置'), - 'SIGN': $L('签名'), - 'BOOL': $L('布尔'), + // @see field-type.js + for (let k in FIELD_TYPES) { + const ft = FIELD_TYPES[k] + if (!ft[2]) render_type({ name: k, label: ft[0], icon: ft[1] }) } - for (let k in FIELD_TYPES) render_type({ name: k, label: FIELD_TYPES[k] }) // SAVE @@ -119,7 +99,7 @@ $(document).ready(function () { }) } - $('.J_save').click(function () { + $('.J_save').on('click', function () { const formElements = [] $('.form-preview .J_field').each(function () { const $this = $(this) @@ -222,7 +202,7 @@ const render_item = function (data) { $(``) .appendTo($action) - .click(function () { + .on('click', function () { const _onConfirm = function (nv) { // 字段名 if (nv.fieldLabel) $item.find('.dd-handle>span').text(nv.fieldLabel) @@ -254,7 +234,7 @@ const render_item = function (data) { $(``) .appendTo($action) - .click(function () { + .on('click', function () { render_unset(data) $item.remove() }) @@ -264,7 +244,7 @@ const render_item = function (data) { $item.addClass('divider') $(``) .appendTo($action) - .click(function () { + .on('click', function () { const _onConfirm = function (nv) { $item.find('.dd-handle span').text(nv.dividerName || '') } @@ -275,7 +255,7 @@ const render_item = function (data) { $(``) .appendTo($action) - .click(function () { + .on('click', function () { $item.remove() }) } @@ -287,7 +267,7 @@ const render_unset = function (data) { if (data.creatable === false) $item.find('.dd-handle').addClass('readonly') else if (data.nullable === false) $item.find('.dd-handle').addClass('not-nullable') - $item.click(function () { + $item.on('click', function () { $('.nav-tabs-classic a[href="#form-design"]').tab('show') render_item(data) $item.remove() @@ -296,8 +276,8 @@ const render_unset = function (data) { } const render_type = function (fieldType) { - const $item = $(`
  • ${$L(fieldType.label)}
  • `).appendTo('.type-list') - $item.click(function () { + const $item = $(`
  • ${$L(fieldType.label)}
  • `).appendTo('.type-list') + $item.on('click', function () { if (wpc.isSuperAdmin) RbModal.create(`/p/admin/metadata/field-new?entity=${wpc.entityName}&type=${fieldType.name}`, $L('添加字段'), { disposeOnHide: true }) else RbHighbar.error($L('仅超级管理员可添加字段')) }) diff --git a/src/main/resources/web/assets/lib/mdi7/preview.html b/src/main/resources/web/assets/lib/mdi7/preview.html index d36d1a0a5..d5bb3c0ca 100644 --- a/src/main/resources/web/assets/lib/mdi7/preview.html +++ b/src/main/resources/web/assets/lib/mdi7/preview.html @@ -1,406 +1,405 @@ - + - - + - + Material Design Icons - + - +

    - - + + + + Material Design Icons + 7.0.96 + + + - Material Design Icons - 7.0.96 - - - - - npm install @mdi/font - + npm install @mdi/font +

    Usage

    <span class="mdi mdi-name"></span>
    -
    - Click the icon, hex codepoint, or name below to copy the value to your clipboard. -
    +
    Click the icon, hex codepoint, or name below to copy the value to your clipboard.

    New Icons -

    @@ -409,309 +408,7395 @@

    Deprecated Icons -

    -

    - Deprecated icons will be removed in a future major release. -

    +

    Deprecated icons will be removed in a future major release.

    Extras

    -

    The helper CSS classes are listed below.

    -

    Size

    +

    Size

    -
    -
    -
    - -
    -
    - mdi-18px -
    -
    -
    -
    - -
    -
    - mdi-24px -
    -
    -
    -
    - -
    -
    - mdi-36px -
    -
    -
    -
    - -
    -
    - mdi-48px -
    -
    +
    +
    +
    + +
    +
    + mdi-18px +
    +
    +
    + +
    +
    + mdi-24px +
    +
    +
    +
    + +
    +
    + mdi-36px +
    +
    +
    +
    + +
    +
    + mdi-48px +
    +
    +

    Rotate

    +
    -
    - -
    + +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-45 -
    + mdi-rotate-45 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-90 -
    + mdi-rotate-90 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-135 -
    + mdi-rotate-135 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-180 -
    + mdi-rotate-180 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-225 -
    + mdi-rotate-225 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-270 -
    + mdi-rotate-270 +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-rotate-315 -
    + mdi-rotate-315
    +

    Flip

    +
    -
    - -
    + +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-flip-h -
    + mdi-flip-h +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-flip-v -
    + mdi-flip-v
    +
    -

    Note: We do not include the ability to use mdi-flip-* and - mdi-rotate-* at the same time.

    +

    Note: We do not include the ability to use mdi-flip-* and mdi-rotate-* at the same time.

    Spin

    +
    -
    - -
    -
    - mdi-spin -
    +
    -
    - -
    -
    - mdi-spin -
    + mdi-spin
    +
    +
    +
    + +
    +
    + mdi-spin +
    +

    Color

    -
    -
    - -
    -
    - mdi-light -
    +
    +
    +
    -
    - -
    -
    - mdi-light mdi-inactive -
    + mdi-light +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-dark -
    + mdi-light mdi-inactive +
    +
    +
    +
    +
    -
    - -
    -
    - mdi-dark mdi-inactive -
    + mdi-dark
    +
    +
    +
    + +
    +
    + mdi-dark mdi-inactive +
    +
    - - - +