mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-19 18:23:32 -04:00
@@ -253,6 +253,24 @@ class MyCustomRule extends ncformCommon.ValidationRule {
|
||||
this.$ncformAddRule({name: 'myCustom', rule: MyCustomRule});
|
||||
```
|
||||
|
||||
- $ncformAllRules()
|
||||
|
||||
Get all registered check rules of ncform
|
||||
|
||||
```
|
||||
// Demo code:
|
||||
const allRules = this.$ncformAllRules();
|
||||
```
|
||||
|
||||
- $ncformAllWidgets()
|
||||
|
||||
Get all registered widgets of ncform
|
||||
|
||||
```
|
||||
// Demo code:
|
||||
const allWidgets = this.$ncformAllWidgets();
|
||||
```
|
||||
|
||||
## ncform event
|
||||
|
||||
- submit
|
||||
|
||||
@@ -254,6 +254,24 @@ class MyCustomRule extends ncformCommon.ValidationRule {
|
||||
this.$ncformAddRule({name: 'myCustom', rule: MyCustomRule});
|
||||
```
|
||||
|
||||
- $ncformAllRules()
|
||||
|
||||
取得ncform所有注册的校验规则
|
||||
|
||||
```
|
||||
// Demo code:
|
||||
const allRules = this.$ncformAllRules();
|
||||
```
|
||||
|
||||
- $ncformAllWidgets()
|
||||
|
||||
取得ncform所有注册的表单组件
|
||||
|
||||
```
|
||||
// Demo code:
|
||||
const allWidgets = this.$ncformAllWidgets();
|
||||
```
|
||||
|
||||
## ncform event
|
||||
|
||||
- submit
|
||||
|
||||
+17
-2
@@ -266,7 +266,12 @@ If you don't like the cold text description, click on the [interactive version](
|
||||
disableItemCollapse: false, // Whether to allow items to be folded
|
||||
itemCollapse: false, // Whether the item is folded by default
|
||||
addTxt: 'Add', // New display text
|
||||
delAllTxt: 'Del All' // Delete all display text
|
||||
delAllTxt: 'Del All', // Delete all display text
|
||||
requiredDelConfirm: false, // Whether the deletion requires confirmation
|
||||
delConfirmText: { // Delete confirmation text
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -280,7 +285,12 @@ If you don't like the cold text description, click on the [interactive version](
|
||||
collapsed: false, // Whether to fold by default
|
||||
disableCollapse: false, // Whether to allow folding
|
||||
addTxt: 'Add', // New display text
|
||||
delAllTxt: 'Del All' // Delete all display text
|
||||
delAllTxt: 'Del All', // Delete all display text
|
||||
requiredDelConfirm: false, // Whether the deletion requires confirmation
|
||||
delConfirmText: { // Delete confirmation text
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -293,5 +303,10 @@ If you don't like the cold text description, click on the [interactive version](
|
||||
tabPosition: 'top', // Optional value:[left | top]
|
||||
collapsed: false, // Whether to fold by default
|
||||
disableCollapse: false, // Whether to allow folding
|
||||
requiredDelConfirm: false, // Whether the deletion requires confirmation
|
||||
delConfirmText: { // Delete confirmation text
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
+17
-2
@@ -266,7 +266,12 @@
|
||||
disableItemCollapse: false, // 是否允许项折叠
|
||||
itemCollapse: false, // 项是否默认折叠
|
||||
addTxt: 'Add', // 新建文字
|
||||
delAllTxt: 'Del All' // 删除全部文字
|
||||
delAllTxt: 'Del All', // 删除全部文字
|
||||
requiredDelConfirm: false, // 是否需要删除确认
|
||||
delConfirmText: { // 删除确认文本
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -280,7 +285,12 @@
|
||||
collapsed: false, // 是否默认折叠
|
||||
disableCollapse: false, // 是否允许折叠
|
||||
addTxt: 'Add', // 新建文字
|
||||
delAllTxt: 'Del All' // 删除全部文字
|
||||
delAllTxt: 'Del All', // 删除全部文字
|
||||
requiredDelConfirm: false, // 是否需要删除确认
|
||||
delConfirmText: { // 删除确认文本
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -293,5 +303,10 @@
|
||||
tabPosition: 'top', // 可选值:left / top
|
||||
collapsed: false, // 是否默认折叠
|
||||
disableCollapse: false, // 是否允许折叠
|
||||
requiredDelConfirm: false, // 是否需要删除确认
|
||||
delConfirmText: { // 删除确认文本
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -68,6 +68,11 @@ export default {
|
||||
disableDel: false,
|
||||
addTxt: "",
|
||||
delAllTxt: "",
|
||||
requiredDelConfirm: false,
|
||||
delConfirmText: {
|
||||
item: '',
|
||||
all: ''
|
||||
},
|
||||
},
|
||||
i18n: {},
|
||||
};
|
||||
@@ -125,12 +130,45 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
delItem(idx) {
|
||||
this.schema.value.splice(idx, 1);
|
||||
delItem(idx, requiredConfirm, confirmText) {
|
||||
if (this.$confirm) { // use element-ui
|
||||
if (requiredConfirm) {
|
||||
this.$confirm(confirmText, '', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.schema.value.splice(idx, 1);
|
||||
})
|
||||
} else {
|
||||
this.schema.value.splice(idx, 1);
|
||||
}
|
||||
} else {
|
||||
if (requiredConfirm) {
|
||||
window.confirm(confirmText) && this.schema.value.splice(idx, 1);
|
||||
} else {
|
||||
this.schema.value.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
delAllItems() {
|
||||
this.schema.value = [];
|
||||
delAllItems(requiredConfirm, confirmText) {
|
||||
if (this.$confirm) { // use element-ui
|
||||
if (requiredConfirm) {
|
||||
this.$confirm(confirmText, '', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.schema.value = [];
|
||||
})
|
||||
} else {
|
||||
this.schema.value = [];
|
||||
}
|
||||
} else {
|
||||
if (requiredConfirm) {
|
||||
window.confirm(confirmText) && (this.schema.value = []);
|
||||
} else {
|
||||
this.schema.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
itemUp(idx) {
|
||||
|
||||
@@ -42,6 +42,20 @@ context('Array', () => {
|
||||
disableItemCollapse: true
|
||||
}
|
||||
}
|
||||
},
|
||||
users3: {
|
||||
type: 'array',
|
||||
value: [
|
||||
'daniel', 'sarah'
|
||||
],
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -50,6 +64,8 @@ context('Array', () => {
|
||||
.invoke('setValue', JSON.stringify(formSchema, null, 2));
|
||||
common.startRun();
|
||||
|
||||
cy.get('body').as('body');
|
||||
|
||||
cy.get('.previewArea').within(() => {
|
||||
// Declare action elements
|
||||
cy.get('legend')
|
||||
@@ -97,6 +113,22 @@ context('Array', () => {
|
||||
cy.get('button:contains("Delete All")').should('not.exist');
|
||||
cy.get('.el-icon-remove').should('not.exist');
|
||||
});
|
||||
|
||||
cy.get('legend')
|
||||
.contains('users3')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('.el-icon-remove').eq(0).click();
|
||||
cy.get('@body').find('.el-message-box__message').should('have.text', 'Are you sure to delete this item?');
|
||||
cy.get('@body').find('.el-message-box__btns .el-button--primary').click();
|
||||
cy.get('input').its('length').should('equal', 1);
|
||||
|
||||
cy.get('button:contains("Delete All")').click();
|
||||
cy.get('@body').find('.el-message-box__message').should('have.text', 'Are you sure to delete all?');
|
||||
cy.get('@body').find('.el-message-box__btns .el-button--primary').click();
|
||||
cy.get('input').should('not.exist');
|
||||
});
|
||||
|
||||
// common.submitForm();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,6 +42,25 @@ context('Table', () => {
|
||||
disableCollapse: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
users3: {
|
||||
type: 'array',
|
||||
value: [
|
||||
'daniel', 'sarah'
|
||||
],
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array-table',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Sure to delete item',
|
||||
all: 'Sure to delete all'
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -50,6 +69,8 @@ context('Table', () => {
|
||||
.invoke('setValue', JSON.stringify(formSchema, null, 2));
|
||||
common.startRun();
|
||||
|
||||
cy.get('body').as('body');
|
||||
|
||||
cy.get('.previewArea').within(() => {
|
||||
// Declare action elements
|
||||
cy.get('legend')
|
||||
@@ -89,6 +110,21 @@ context('Table', () => {
|
||||
cy.get('button:contains("Delete All")').should('not.exist');
|
||||
cy.get('.el-icon-remove').should('not.exist');
|
||||
});
|
||||
|
||||
cy.get('legend')
|
||||
.contains('users3')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('.el-icon-remove').eq(0).click();
|
||||
cy.get('@body').find('.el-message-box__message').should('have.text', 'Sure to delete item');
|
||||
cy.get('@body').find('.el-message-box__btns .el-button--primary').click();
|
||||
cy.get('input').its('length').should('equal', 1);
|
||||
|
||||
cy.get('button:contains("Delete All")').click();
|
||||
cy.get('@body').find('.el-message-box__message').should('have.text', 'Sure to delete all');
|
||||
cy.get('@body').find('.el-message-box__btns .el-button--primary').click();
|
||||
cy.get('input').should('not.exist');
|
||||
});
|
||||
// common.submitForm();
|
||||
});
|
||||
});
|
||||
|
||||
+53
-24
@@ -41,6 +41,24 @@ context('Tabs', () => {
|
||||
disableCollapse: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
users3: {
|
||||
type: 'array',
|
||||
value: [
|
||||
'daniel', 'sarah'
|
||||
],
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array-tabs',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Sure to delete item'
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -49,39 +67,50 @@ context('Tabs', () => {
|
||||
.invoke('setValue', JSON.stringify(formSchema, null, 2));
|
||||
common.startRun();
|
||||
|
||||
cy.get('body').as('body');
|
||||
|
||||
cy.get('.previewArea').within(() => {
|
||||
// Declare action elements
|
||||
cy.get('legend')
|
||||
.contains('users1')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('legend').next().should('not.be.visible');
|
||||
cy.get('legend').click();
|
||||
cy.get('legend').next().should('be.visible');
|
||||
.contains('users1')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('legend').next().should('not.be.visible');
|
||||
cy.get('legend').click();
|
||||
cy.get('legend').next().should('be.visible');
|
||||
|
||||
cy.get('.el-icon-plus').click()
|
||||
cy.get('.el-tabs__item').its('length').should('equal', 2);
|
||||
cy.get('.el-icon-plus').click()
|
||||
cy.get('.el-tabs__item').its('length').should('equal', 2);
|
||||
|
||||
cy.get('input').eq(0).type('daniel')
|
||||
cy.get('.el-tabs__item').eq(1).click();
|
||||
cy.get('input').eq(1).type('sarah')
|
||||
cy.get('input').eq(0).type('daniel')
|
||||
cy.get('.el-tabs__item').eq(1).click();
|
||||
cy.get('input').eq(1).type('sarah')
|
||||
|
||||
cy.get('.el-icon-close:visible').click();
|
||||
cy.get('.el-tabs__item').its('length').should('equal', 1);
|
||||
|
||||
});
|
||||
cy.get('.el-icon-close:visible').click();
|
||||
cy.get('.el-tabs__item').its('length').should('equal', 1);
|
||||
});
|
||||
|
||||
cy.get('legend')
|
||||
.contains('users2')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('legend').next().should('be.visible');
|
||||
cy.get('legend').click();
|
||||
cy.get('legend').next().should('be.visible');
|
||||
.contains('users2')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('legend').next().should('be.visible');
|
||||
cy.get('legend').click();
|
||||
cy.get('legend').next().should('be.visible');
|
||||
|
||||
cy.get('.el-icon-plus').should('not.exist');
|
||||
cy.get('.el-icon-close').should('not.exist');
|
||||
});
|
||||
cy.get('.el-icon-plus').should('not.exist');
|
||||
cy.get('.el-icon-close').should('not.exist');
|
||||
});
|
||||
|
||||
cy.get('legend')
|
||||
.contains('users3')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('.el-icon-close:visible').click();
|
||||
cy.get('@body').find('.el-message-box__message').should('have.text', 'Sure to delete item');
|
||||
cy.get('@body').find('.el-message-box__btns .el-button--primary').click();
|
||||
cy.get('.el-tabs__item').its('length').should('equal', 1);
|
||||
});
|
||||
// common.submitForm();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -80,4 +80,11 @@ context('Others', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('$ncformAllWidgets and $ncformAllRules()', () => {
|
||||
cy.window().then(win => {
|
||||
expect(win.Vue.prototype.$ncformAllRules()).to.deep.equal(["contains", "exclusiveMinimum", "ipv6", "maximum", "minimum", "required", "dateTime", "hostname", "maxItems", "minItems", "multipleOf", "tel", "email", "maxLength", "minLength", "number", "uniqueItems", "exclusiveMaximum", "ipv4", "maxProperties", "minProperties", "pattern", "url", "ajax"]);
|
||||
expect(win.Vue.prototype.$ncformAllWidgets()).to.deep.equal(["object", "array", "array-table", "input"]);
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<playground></playground>
|
||||
</div>
|
||||
<script type="text/javascript" src="../../../node_modules/ace-builds/src-min-noconflict/ace.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/@ncform/ncform-common/dist/ncformCommon.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../node_modules/ace-builds/src-min-noconflict/ace.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/@ncform/ncform-common/dist/ncformCommon.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
<script type="text/javascript" src="../../../node_modules/@ncform/ncform-theme-elementui/dist/ncformStdComps.js"></script>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/axios/dist/axios.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script src="https://unpkg.com/mockjs"></script>
|
||||
<script src="https://unpkg.com/js-url"></script>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../node_modules/vue/dist/vue.min.js"
|
||||
src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
@@ -273,6 +273,49 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
cn: '[属性] requiredDelConfirm: 是否需要删除确认。默认 false',
|
||||
en:
|
||||
'[ATTR] requiredDelConfirm: Whether the deletion requires confirmation. Default is false'
|
||||
},
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
user: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array-table',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Are you sure to delete this item?',
|
||||
all: 'Are you sure to delete all?'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
user: [ 'Daniel', 'Sarah' ]
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
cn: `
|
||||
当 requiredDelConfirm 为 true 时,可通过 delConfirmText 配置提示信息
|
||||
1. delConfirmText.item: 删除项确认信息
|
||||
2. delConfirmText.all: 删除全部确认信息
|
||||
`,
|
||||
en: `
|
||||
Prompt information can be configured via delConfirmText when requiredDelConfirm is true
|
||||
1. delConfirmText.item: delete item confirmation information
|
||||
2. delConfirmText.all: delete all confirmation information
|
||||
`
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../node_modules/vue/dist/vue.min.js"
|
||||
src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
@@ -202,7 +202,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: {
|
||||
cn: '[属性] tabPosition: tab的显示位置,可选值 [left | top]',
|
||||
@@ -234,6 +233,46 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
cn: '[属性] requiredDelConfirm: 是否需要删除确认。默认 false',
|
||||
en:
|
||||
'[ATTR] requiredDelConfirm: Whether the deletion requires confirmation. Default is false'
|
||||
},
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
user: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array-tabs',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Are you sure to delete this item?',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
user: [ 'Daniel', 'Sarah' ]
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
cn: `
|
||||
当 requiredDelConfirm 为 true 时,可通过 delConfirmText 配置提示信息
|
||||
1. delConfirmText.item: 删除项确认信息
|
||||
`,
|
||||
en: `
|
||||
Prompt information can be configured via delConfirmText when requiredDelConfirm is true
|
||||
1. delConfirmText.item: delete item confirmation information
|
||||
`
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../node_modules/vue/dist/vue.min.js"
|
||||
src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
@@ -308,6 +308,48 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
cn: '[属性] requiredDelConfirm: 是否需要删除确认。默认 false',
|
||||
en:
|
||||
'[ATTR] requiredDelConfirm: Whether the deletion requires confirmation. Default is false'
|
||||
},
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
user: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Are you sure to delete this item?',
|
||||
all: 'Are you sure to delete all?'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
user: [ 'Daniel', 'Sarah' ]
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
cn: `
|
||||
当 requiredDelConfirm 为 true 时,可通过 delConfirmText 配置提示信息
|
||||
1. delConfirmText.item: 删除项确认信息
|
||||
2. delConfirmText.all: 删除全部确认信息
|
||||
`,
|
||||
en: `
|
||||
Prompt information can be configured via delConfirmText when requiredDelConfirm is true
|
||||
1. delConfirmText.item: delete item confirmation information
|
||||
2. delConfirmText.all: delete all confirmation information
|
||||
`
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<td v-if="!mergeConfig.disableDel || !mergeConfig.disableReorder" style="width: 130px;">
|
||||
<!-- 项控制按钮 -->
|
||||
<div class="el-button-group">
|
||||
<button @click="delItem(idx)" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i></button>
|
||||
<button @click="delItem(idx, mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.item || $nclang('delItemTips'))" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i></button>
|
||||
<button @click="itemUp(idx)" v-show="idx !== 0" v-if="!mergeConfig.disableReorder" type="button" class="el-button el-button--mini"><i class="el-icon-sort-up"></i></button>
|
||||
<button @click="itemDown(idx)" v-show="idx !== schema.value.length - 1" v-if="!mergeConfig.disableReorder" type="button" class="el-button el-button--mini"><i class="el-icon-sort-down"></i></button>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<!-- 列表控制按钮 -->
|
||||
<div class="el-button-group" v-if="!mergeConfig.disableAdd || !mergeConfig.disableDel">
|
||||
<button @click="addItem()" v-if="!mergeConfig.disableAdd" type="button" class="el-button el-button--mini"><i class="el-icon-circle-plus-outline"></i> {{mergeConfig.addTxt || $nclang('add')}}</button>
|
||||
<button @click="delAllItems()" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i> {{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
<button @click="delAllItems(mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.all || $nclang('delAllTips'))" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i> {{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -127,12 +127,16 @@
|
||||
en: {
|
||||
action: 'Action',
|
||||
add: 'Add',
|
||||
delAll: 'Delete All'
|
||||
delAll: 'Delete All',
|
||||
delItemTips: 'Are you sure to delete this item?',
|
||||
delAllTips: 'Are you sure to delete all?'
|
||||
},
|
||||
zh_cn: {
|
||||
action: '操作',
|
||||
add: '增加',
|
||||
delAll: '删除全部'
|
||||
delAll: '删除全部',
|
||||
delItemTips: '确定要删除该项吗?',
|
||||
delAllTips: '确定要删除全部吗?'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -93,6 +93,15 @@
|
||||
|
||||
mixins: [layoutArrayMixin],
|
||||
|
||||
i18nData: {
|
||||
en: {
|
||||
delItemTips: 'Are you sure to delete this item?',
|
||||
},
|
||||
zh_cn: {
|
||||
delItemTips: '确定要删除该项吗?',
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
defaultConfig: {
|
||||
@@ -107,7 +116,7 @@
|
||||
this.addItem();
|
||||
}
|
||||
if (action === 'remove') {
|
||||
this.delItem(targetName);
|
||||
this.delItem(targetName, this.mergeConfig.requiredDelConfirm, this.mergeConfig.delConfirmText.item || this.$nclang('delItemTips'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="el-button-group">
|
||||
<button @click="collapseItem(dataItem.__dataSchema)" v-show="dataItem.__dataSchema._expand" v-if="!mergeConfig.disableItemCollapse" type="button" class="el-button el-button--mini"><i class="el-icon-arrow-down"></i></button>
|
||||
<button @click="collapseItem(dataItem.__dataSchema)" v-show="!dataItem.__dataSchema._expand" v-if="!mergeConfig.disableItemCollapse" type="button" class="el-button el-button--mini"><i class="el-icon-arrow-up"></i></button>
|
||||
<button @click="delItem(idx)" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i></button>
|
||||
<button @click="delItem(idx, mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.item || $nclang('delItemTips'))" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i></button>
|
||||
<button @click="itemUp(idx)" v-show="idx !== 0" v-if="!mergeConfig.disableReorder" type="button" class="el-button el-button--mini"><i class="el-icon-sort-up"></i></button>
|
||||
<button @click="itemDown(idx)" v-show="idx !== schema.value.length - 1" v-if="!mergeConfig.disableReorder" type="button" class="el-button el-button--mini"><i class="el-icon-sort-down"></i></button>
|
||||
</div>
|
||||
@@ -45,7 +45,7 @@
|
||||
<!-- 列表控制按钮 -->
|
||||
<div v-show="!collapsed" class="el-button-group" v-if="!mergeConfig.disableAdd || !mergeConfig.disableDel">
|
||||
<button @click="addItem()" v-if="!mergeConfig.disableAdd" type="button" class="el-button el-button--mini"><i class="el-icon-circle-plus-outline"></i> {{mergeConfig.addTxt || $nclang('add')}}</button>
|
||||
<button @click="delAllItems()" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i> {{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
<button @click="delAllItems(mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.all || $nclang('delAllTips'))" v-if="!mergeConfig.disableDel" type="button" class="el-button el-button--danger el-button--mini"><i class="el-icon-remove"></i> {{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -101,11 +101,15 @@
|
||||
i18nData: {
|
||||
en: {
|
||||
add: 'Add',
|
||||
delAll: 'Delete All'
|
||||
delAll: 'Delete All',
|
||||
delItemTips: 'Are you sure to delete this item?',
|
||||
delAllTips: 'Are you sure to delete all?'
|
||||
},
|
||||
zh_cn: {
|
||||
add: '增加',
|
||||
delAll: '删除全部'
|
||||
delAll: '删除全部',
|
||||
delItemTips: '确定要删除该项吗?',
|
||||
delAllTips: '确定要删除全部吗?'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
legendEnable(fieldSchema) {
|
||||
return fieldSchema.ui.showLegend && fieldSchema.ui.legend;
|
||||
return fieldSchema.ui && fieldSchema.ui.showLegend && fieldSchema.ui.legend;
|
||||
}
|
||||
},
|
||||
mixins: [layoutObjectMixin]
|
||||
|
||||
@@ -152,6 +152,37 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5('array: deletion requires confirmation'),
|
||||
title: 'array: deletion requires confirmation',
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
users: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
delConfirmText: {
|
||||
item: 'Sure to delete this item?',
|
||||
all: 'Sure to delete all items?'
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
users: [
|
||||
'daniel', 'sarah'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5('array: collapsed / itemCollapse true and txts change'),
|
||||
title: 'array: collapsed / itemCollapse true and txts change',
|
||||
@@ -229,7 +260,34 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5('table: deletion requires confirmation'),
|
||||
title: 'table: deletion requires confirmation',
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
users: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
ui: {
|
||||
widget: 'array-table',
|
||||
widgetConfig: {
|
||||
requiredDelConfirm: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
value: {
|
||||
users: [
|
||||
'daniel', 'sarah'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,6 +22,8 @@ module.exports = {
|
||||
install: (Vue, options = { extComponents: {}, extRules: [], lang: '' }) => {
|
||||
window.__$ncform = {}; // 属于ncform的全局变量
|
||||
|
||||
window.__$ncform.__ncformComponents = {};
|
||||
|
||||
window.__$ncform.__ncFormsGlobalList = {};
|
||||
|
||||
window.__$ncform.__ncformRegularValidation = new RegularValidation();
|
||||
@@ -31,7 +33,7 @@ module.exports = {
|
||||
// 注册组件
|
||||
_map(
|
||||
Object.assign(defLayouts, defControls, options.extComponents || {}),
|
||||
(compItem, name) => Vue.component(`ncform-${_kebabCase(name)}`, compItem)
|
||||
(compItem, name) => { window.__$ncform.__ncformComponents[_kebabCase(name)] = 1; Vue.component(`ncform-${_kebabCase(name)}`, compItem) }
|
||||
);
|
||||
|
||||
// 注册验证规则
|
||||
@@ -62,6 +64,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
Vue.prototype.$ncformAddWidget = function({name, widget}) {
|
||||
window.__$ncform.__ncformComponents[_kebabCase(name)] = 1;
|
||||
Vue.component(`ncform-${_kebabCase(name)}`, widget)
|
||||
}
|
||||
|
||||
@@ -71,6 +74,14 @@ module.exports = {
|
||||
window.__$ncform.__ncformRegularValidation.registerRule(ruleItem);
|
||||
}
|
||||
|
||||
Vue.prototype.$ncformAllRules = function() {
|
||||
return Object.keys(window.__$ncform.__ncformRegularValidation.allRules);
|
||||
}
|
||||
|
||||
Vue.prototype.$ncformAllWidgets = function() {
|
||||
return Object.keys(window.__$ncform.__ncformComponents);
|
||||
}
|
||||
|
||||
Vue.component("ncform", ncform);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<td v-if="!mergeConfig.disableDel || !mergeConfig.disableReorder">
|
||||
<!-- 项控制按钮 -->
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button @click="delItem(idx)" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">Del</button>
|
||||
<button @click="delItem(idx, mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.item || $nclang('delItemTips'))" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">Del</button>
|
||||
<button @click="itemUp(idx)" v-show="idx !== 0" v-if="!mergeConfig.disableReorder" type="button" class="btn btn-secondary">Up</button>
|
||||
<button @click="itemDown(idx)" v-show="idx !== schema.value.length - 1" v-if="!mergeConfig.disableReorder" type="button" class="btn btn-secondary">Down</button>
|
||||
</div>
|
||||
@@ -45,7 +45,7 @@
|
||||
<!-- 列表控制按钮 -->
|
||||
<div class="btn-group btn-group-sm" v-if="!mergeConfig.disableAdd || !mergeConfig.disableDel">
|
||||
<button @click="addItem()" v-if="!mergeConfig.disableAdd" type="button" class="btn btn-secondary">{{mergeConfig.addTxt || $nclang('add')}}</button>
|
||||
<button @click="delAllItems()" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">{{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
<button @click="delAllItems(mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.all || $nclang('delAllTips'))" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">{{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -83,12 +83,16 @@
|
||||
en: {
|
||||
action: 'Action',
|
||||
add: 'Add',
|
||||
delAll: 'Delete All'
|
||||
delAll: 'Delete All',
|
||||
delItemTips: 'Are you sure to delete this item?',
|
||||
delAllTips: 'Are you sure to delete all?'
|
||||
},
|
||||
zh_cn: {
|
||||
action: '操作',
|
||||
add: '增加',
|
||||
delAll: '删除全部'
|
||||
delAll: '删除全部',
|
||||
delItemTips: '确定要删除该项吗?',
|
||||
delAllTips: '确定要删除全部吗?'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button @click="collapseItem(dataItem.__dataSchema)" v-show="dataItem.__dataSchema._expand" v-if="!mergeConfig.disableItemCollapse" type="button" class="btn btn-primary btn-secondary">fold</button>
|
||||
<button @click="collapseItem(dataItem.__dataSchema)" v-show="!dataItem.__dataSchema._expand" v-if="!mergeConfig.disableItemCollapse" type="button" class="btn btn-primary btn-secondary">Expand</button>
|
||||
<button @click="delItem(idx)" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">Del</button>
|
||||
<button @click="delItem(idx, mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.item || $nclang('delItemTips'))" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">Del</button>
|
||||
<button @click="itemUp(idx)" v-show="idx !== 0" v-if="!mergeConfig.disableReorder" type="button" class="btn btn-secondary">Up</button>
|
||||
<button @click="itemDown(idx)" v-show="idx !== schema.value.length - 1" v-if="!mergeConfig.disableReorder" type="button" class="btn btn-secondary">Down</button>
|
||||
</div>
|
||||
@@ -41,7 +41,7 @@
|
||||
<!-- 列表控制按钮 -->
|
||||
<div v-show="!collapsed" class="btn-group btn-group-sm" v-if="!mergeConfig.disableAdd || !mergeConfig.disableDel">
|
||||
<button @click="addItem()" v-if="!mergeConfig.disableAdd" type="button" class="btn btn-secondary">{{mergeConfig.addTxt || $nclang('add')}}</button>
|
||||
<button @click="delAllItems()" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">{{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
<button @click="delAllItems(mergeConfig.requiredDelConfirm, mergeConfig.delConfirmText.all || $nclang('delAllTips'))" v-if="!mergeConfig.disableDel" type="button" class="btn btn-danger btn-secondary">{{mergeConfig.delAllTxt || $nclang('delAll')}}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -71,11 +71,15 @@
|
||||
i18nData: {
|
||||
en: {
|
||||
add: 'Add',
|
||||
delAll: 'Delete All'
|
||||
delAll: 'Delete All',
|
||||
delItemTips: 'Are you sure to delete this item?',
|
||||
delAllTips: 'Are you sure to delete all?'
|
||||
},
|
||||
zh_cn: {
|
||||
add: '增加',
|
||||
delAll: '删除全部'
|
||||
delAll: '删除全部',
|
||||
delItemTips: '确定要删除该项吗?',
|
||||
delAllTips: '确定要删除全部吗?'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
},
|
||||
methods: {
|
||||
legendEnable(fieldSchema) {
|
||||
return fieldSchema.ui.showLegend && fieldSchema.ui.legend;
|
||||
return fieldSchema.ui && fieldSchema.ui.showLegend && fieldSchema.ui.legend;
|
||||
}
|
||||
},
|
||||
mixins: [layoutObjectMixin]
|
||||
|
||||
Reference in New Issue
Block a user